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

Help with NPC movment!

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






PostPosted: Sun Oct 25, 2009 2:42 pm    Post subject: Help with NPC movment! Reply with quote

In my script I'm trying to get a npc to move around yet for some reason it won't. Here is the script...

suspend player
walk hero (me,north,2)
wait for hero (me)
set hero direction (me,west)
wait for hero (me)
set hero direction (me,south)
wait for hero (me)
show text box (14)
wait for text box
create npc (2,29,24,north)
wait for npc (2)
walk npc (3,north,2)
wait for npc (2)
walk npc (3,west,1)
wait for npc (2)
resume player

It works until the npc has to move. When it gets there the npc doesn't move and the script stops. I even check the npc speed in CUSTOM. Please help me with this.
Back to top
NeoSpade
Of course!




Joined: 23 Sep 2008
Posts: 249
Location: Wales GB

PostPosted: Sun Oct 25, 2009 2:55 pm    Post subject: Reply with quote

try suspend NPCs and resume NPCs at the begining and end of the script along with the suspend player and resume player, other than that I can't think of anything wrong with this script, appart from an end command at the end.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Guest
Guest






PostPosted: Sun Oct 25, 2009 3:05 pm    Post subject: Reply with quote

Nope that didn't do anything. And I already had an end command.
Back to top
NeoSpade
Of course!




Joined: 23 Sep 2008
Posts: 249
Location: Wales GB

PostPosted: Sun Oct 25, 2009 3:14 pm    Post subject: Reply with quote

Ah got it (can't believe I missed this before), have you checked to see if your NPC has a speed, if the NPCs speed is 0 then they won't move regardless, speed 4 is player speed, if it matters to you. That fixed it?
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Bob the Hamster
OHRRPGCE Developer




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

PostPosted: Sun Oct 25, 2009 3:15 pm    Post subject: Re: Help with NPC movment! Reply with quote

Code:

  create npc (2,29,24,north)
  wait for npc (2)
  walk npc (3,north,2)
  wait for npc (2)
  walk npc (3,west,1)
  wait for npc (2)


There are a couple problems.

First of all, you "create npc" with ID 2, but you "walk npc" with ID 3. That is the main problem.

Code:

  create npc (2,29,24,north)
  wait for npc (2)
  walk npc (2,north,2)
  wait for npc (2)
  walk npc (2,west,1)
  wait for npc (2)


One minor problem is that you don't need "wait for npc" after "create npc". You only need "wait npc" when the NPC is moving. That is just a minor problem.


Code:

  create npc (2,29,24,north)
  walk npc (2,north,2)
  wait for npc (2)
  walk npc (2,west,1)
  wait for npc (2)


The last problem is that if you have more than one copy of this NPC on your map, the "walk npc" command is only going to work for the first one, which might not be the one you just created. I would suggest using an npc reference, like this:

Code:

  variable(n)
  n := create npc (2,29,24,north)
  walk npc (n,north,2)
  wait for npc (n)
  walk npc (n,west,1)
  wait for npc (n)


This method guarantees that the "walk npc" command will operate on the same NPC that you created with "create npc", and it will work right now matter how many other copies of NPC #2 happen to exist on the map.

Although if there is only one copy of NPC #2 on the map, then you don't need to bother doing it this way.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
NeoSpade
Of course!




Joined: 23 Sep 2008
Posts: 249
Location: Wales GB

PostPosted: Sun Oct 25, 2009 3:24 pm    Post subject: Reply with quote

d'oh...I didn't see that, I must remember to quadruple check posts from now on before openning my trap :S
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Guest
Guest






PostPosted: Sun Oct 25, 2009 3:30 pm    Post subject: Reply with quote

Wow. I did not notice that. Thank you very much, the both of you.
Back to top
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