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

Stop NPC

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




Joined: 20 Mar 2003
Posts: 382

PostPosted: Mon Oct 24, 2005 1:31 pm    Post subject: Stop NPC Reply with quote

Hey folks,

Is there a command (or sequence of commands) that makes an NPC stop in its tracks?

My problem is, I want an NPC to walk from A to B. However, an event may occur at any time in between, at which time I want the NPC to stop and do something else. Since the event is player-controlled, I don't know when (or even if) it will happen.

At this point, the only thing I can think to do is this:
Code:
walk NPC to(NPC x(it),NPC y(it))

However, this is rather clunky, and may cause the NPC to "backtrack" to the tile it is walking off of (if it's walking east or south).

What I really want it to do is finish its walk action to the next whole tile, then do whatever it was going to do.

Any suggestions?


Thanks,
-B
Back to top
View user's profile Send private message
Iblis
Ghost Cat




Joined: 26 May 2003
Posts: 1233
Location: Your brain

PostPosted: Mon Oct 24, 2005 2:01 pm    Post subject: Reply with quote

Perhaps you could walk the NPC one tile at a time, and check whether the event occurs inbetween steps. I'm not sure whether this would allow for smooth movement though.
_________________
Locked
OHR Piano
Back to top
View user's profile Send private message Send e-mail
Bob the Hamster
OHRRPGCE Developer




Joined: 22 Feb 2003
Posts: 2526
Location: Hamster Republic (Southern California Enclave)

PostPosted: Mon Oct 24, 2005 2:12 pm    Post subject: stopping an NPC Reply with quote

You can cancel a "walk NPC" command by giving the same NPC another walk command

Code:

walk NPC (0,south,10)
wait(random(10,40))
walk NPC (0,south,0)
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



Joined: 15 Jul 2004
Posts: 3377
Location: Seattle, WA

PostPosted: Mon Oct 24, 2005 2:14 pm    Post subject: Reply with quote

Metamorphosis did this. Use walknpc with the distance parameter 0. (I'd have to go back and check the script on it, honestly, but I think that does it. The script file is included with the game IIRC.)
_________________
Back to top
View user's profile Send private message Visit poster's website AIM Address
msw188




Joined: 02 Jul 2003
Posts: 1041

PostPosted: Tue Oct 25, 2005 8:36 am    Post subject: Reply with quote

This would make the NPC stop on the tile that it is currently walking onto, it seems. If instead one wants the NPC to stop on the pixel, what could be done? Perhaps changing said NPC's speed to 0...?
Back to top
View user's profile Send private message Visit poster's website
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



Joined: 15 Jul 2004
Posts: 3377
Location: Seattle, WA

PostPosted: Tue Oct 25, 2005 9:49 am    Post subject: Reply with quote

No, it makes him stop where he is. This can muck up your game if used incorrectly, but it is the foundation of the game Metamorphosis, a SoM-style game released before pixel movement was available.
_________________
Back to top
View user's profile Send private message Visit poster's website AIM Address
Mr B




Joined: 20 Mar 2003
Posts: 382

PostPosted: Tue Oct 25, 2005 3:34 pm    Post subject: Reply with quote

Iblis wrote:
Perhaps you could walk the NPC one tile at a time, and check whether the event occurs inbetween steps. I'm not sure whether this would allow for smooth movement though.

This would ordinarily be a good idea, but in this case I already have a continuously-looping script with a large number of if-then statements. Moving the NPC like this would, I think, simply overwhelm the script. In another application it would work pretty well, I think.

Moogle1 wrote:
Metamorphosis did this. Use walknpc with the distance parameter 0. (I'd have to go back and check the script on it, honestly, but I think that does it. The script file is included with the game IIRC.)

Unfortunately, I need to have tile-based movement for this specific application.

I think I know what I will do. Thanks for the suggestions, guys.
Back to top
View user's profile Send private message
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



Joined: 15 Jul 2004
Posts: 3377
Location: Seattle, WA

PostPosted: Tue Oct 25, 2005 7:16 pm    Post subject: Reply with quote

No, that IS tile-based movement. While he's moving, tell him to walk in that direction with distance 0.
_________________
Back to top
View user's profile Send private message Visit poster's website AIM Address
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