Castle Paradox Forum Index Castle Paradox

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Gamelist   Review List   Song List   All Journals   Site Stats   Search Gamelist   IRC Chat Room

Changing Shop Prices, Hiding map layers in-game
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
Nepenthe




Joined: 27 Sep 2004
Posts: 132

PostPosted: Fri Jan 28, 2011 11:35 am    Post subject: Reply with quote

Just read through that script. Really nice! In fact, I'll probably steal these if I ever get back to a project that requires LOS.

For the sake of variety, I thought of another way to possibly tackle this problem. Instead of checking distances, what about building the guard's awareness shape out of slices (possibly a separate circle for "can hear" and cone for "can see")? Draw a bounding box for the hero, and a simple slice collide check would determine if the hero is within that range. Obstruction checking is still an issue though.
Back to top
View user's profile Send private message Visit poster's website AIM Address
BlastedEarth




Joined: 05 Oct 2009
Posts: 243

PostPosted: Fri Jan 28, 2011 9:12 pm    Post subject: Reply with quote

To TMC:
Wow, it's done, I can't wait to try it, thanks a lot :-D

To Nepenthe:
That's another great idea, having seperate checks for different senses would mean much flexible talents for the heroes and enemies. Like just because you have light feet doesn't mean you disappear completely in front of the enemy. Or just because the samurai master is blind doesn't mean it can't hear your footsteps and determine your direction from that. Also if you moved in the shade cast by objects (or poorly lit areas in a room) should reduce the enemy's chance of spotting you. I haven't studied the script yet but looking at what you guys have been discussing I guess a lot of things are possible if you know slices and the stuff in the script.

Still: Alright that's another skill done, (It's the most complicated in the game I'm making) so a thousand thanks once again.
_________________
So many ideas, so little focus. Monk spirit please lend me your power!

Back to top
View user's profile Send private message
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Sun Jan 30, 2011 9:07 am    Post subject: Reply with quote

Yes, there lots of alternatives to using sectors of circles. It would be easy to rip out the view distance part of the script and replace it with something else. Eventually you'll be able to draw and probe pixels on sprites with scripts, so that will also be a good way to specify fields of view.

Quote:
That's another great idea, having seperate checks for different senses would mean much flexible talents for the heroes and enemies. ...

Actually, most of the things you mentioned can be done without even modifying the script, but by just modifying the forward/read view distance global variables. For example you could use a zone to paint all the shaded areas on the map, and write an on-foot-step script which changes the forward view distance if your in the zone.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
BlastedEarth




Joined: 05 Oct 2009
Posts: 243

PostPosted: Sun Jan 30, 2011 9:09 pm    Post subject: Reply with quote

Yes, you're right! It does do a lot of the stuff I mentioned without even changing the complicated parts of the script.



Code:
plotscript, onkeypress, begin
  # Press D to toggle LOS debugging
  if ((keyval (key: d) >> 1),and,(check tag(tag:expert stealth)==on))
  then (
    clear debug map
    debug guard LOS := debug guard LOS, xor, 1
   
  )
  if (keyval (key: w) >> 1) then (
  #press w to start walking
    if (keyhandler running == false) then (
    keyhandler running := true
     set tag(tag:sneaking,on)
     set hero speed (me,2)
     wait(5)
      keyhandler running := false
   )
  )   

  else
  if (keyval (key: r) >> 1) then (
  # pressing r goes back to basic running speed which is 4
   if (keyhandler running == false) then (
    keyhandler running := true
    set tag(tag:sneaking,off)
    set hero speed (me,4)
    wait(5)
    keyhandler running := false
   )
  )
 
 
end

plotscript, vigilant guards loop, begin
  variable (this map)
  this map := current map

  while (this map == current map) do, begin
    forward view distance := 10
    rear view distance := 5
    sneak modifier
    if (debug guard LOS) then (clear debug map)

    vigilant guard (0)  #change '0' to the correct NPC ID
    vigilant guard (1) #repeat as desired
    vigilant guard (2) #repeat as desired

    wait (1)
  end
end

#sneak modifier script

script, sneak modifier, begin
       if ((check tag(tag:sneaking)==on),and,(check tag(tag:basic stealth)==on))
       then (
        decrement(forward view distance,2)
        decrement(rear view distance,2)
      )
       
   if ((check tag(tag:sneaking)==on),and,(check tag(tag:expert stealth)==on))
          then (       
          decrement(forward view distance,2)
          decrement(rear view distance,2)
          )
       
         if ((check tag(tag:sneaking)==on),and,(check tag(tag: master stealth)==on))
          then (
          decrement(forward view distance,2)
          decrement(rear view distance,2)
          )
end
#...rest of the script here(the difficult part i wouldn't dare to touch^^)


What if you only want to use one button to toggle walk/run mode? And i also thought the debug code would be a cool feature if you have the stealth skill on an "expert" level. So how do you include all these three codes into one key?

Like:
Just pressing the W key does:
- Goes into walk mode
- Checks the stealth skill tag and runs the debug graphics too if applicable
Pressing W again would:
- Switch back to run mode
- Clears the debug mode graphics
_________________
So many ideas, so little focus. Monk spirit please lend me your power!

Back to top
View user's profile Send private message
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Mon Jan 31, 2011 2:03 am    Post subject: Reply with quote

Heh, I didn't expect anyone to use the debug mode like that.

Combining the keys is easy enough:

Code:
plotscript, onkeypress, begin
  if (keyval (key: w) >> 1) then (
    #press w to toggle walking
    if (keyhandler running == false) then (
      keyhandler running := true
      if (check tag (tag:sneaking)) then (
        # start running
        set tag(tag:sneaking, off)
        set hero speed (me,2)
        if (check tag(tag:expert stealth)==on) then (
          clear debug map
          debug guard LOS := off
        )
      ) else (
        # start walking
        set tag(tag:sneaking, on)
        set hero speed (me,2)
        if (check tag(tag:expert stealth)==on) then (
          debug guard LOS := on
        )
      )
      wait (5)
      keyhandler running := false
    )
  )   
end

_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
BlastedEarth




Joined: 05 Oct 2009
Posts: 243

PostPosted: Mon Jan 31, 2011 7:25 am    Post subject: Reply with quote

Cool!
_________________
So many ideas, so little focus. Monk spirit please lend me your power!

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group