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

Pretty much like stealth?

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
Leonhart




Joined: 25 Feb 2004
Posts: 383
Location: Philippines

PostPosted: Fri Nov 16, 2007 1:37 am    Post subject: Pretty much like stealth? Reply with quote

How do you:

create a script so that if you are (insert number of steps) away from an enemy, it automatically "detects" you, causing a battle?
_________________
The man who smiles when things go wrong has thought of someone to blame it on.
- Robert Bloch
Back to top
View user's profile Send private message
Jack
the fool




Joined: 30 Jul 2004
Posts: 773

PostPosted: Fri Nov 16, 2007 7:57 am    Post subject: Reply with quote

is this a moving enemy or a still enemy?
_________________
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
Leonhart




Joined: 25 Feb 2004
Posts: 383
Location: Philippines

PostPosted: Fri Nov 16, 2007 8:42 pm    Post subject: Reply with quote

It is a moving enemy.
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: Fri Nov 16, 2007 8:57 pm    Post subject: Reply with quote

well you have your standard distance script:

Code:
script, abs, n, begin
  if (n << 0) then (return (n * -1)) else (return (n))
end

script, distance, x1, y1, x2, y2, begin
 return (abs (x1 -- x2) + abs (y1 -- y2))
end


And then you just have a loop in the background (or if the NPC isn't moving, an on footstep script instead) to check the distance:

Code:
plotscript, check range, begin
  while (current map == ...) do (
    if (distance (hero x, hero y, npc x (...), npc y (...)) <= ...) then (
      fight formation (...)
    )
    wait
  )
end


Fill in the dots with map number (note: this doesn't work well, see the FAQ), an npc reference/id, distance in tiles, and formation. You can have several of these.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Page 1 of 1

 
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