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

Moving Lots of NPCs at Once

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
G-Wreck
OHRRPGCE Game Designer




Joined: 28 Feb 2010
Posts: 32
Location: Oklahoma

PostPosted: Thu Jul 22, 2010 7:51 am    Post subject: Moving Lots of NPCs at Once Reply with quote

I need to move several copies of the same NPC at the same time, in the same direction.

I read a page somewhere on the wiki about how to do this, but for the life of me I can't find it.

Here's the script I'm using to do this:
Code:


#This script is supposed to walk all copies of NPC 9 down 100 spaces at the same time.

plotscript,song,begin

variable(loop,green count,green note)

green note := NPC copy count(9)

for(loop,0,green count)
   
   do (

    green note := NPC reference(9,loop)

   
    walk NPC(green note,down,100)

   )

end


I have speeds set for the NPCs (at 4 if it matters), so I know they're able to move, but usually only the first copy actually does anything. Any ideas where I went wrong?
_________________
Syzygy - .01% (Extremely Random Number)

Finishing the main story arcs and gameplay elements before I do anything else.
Back to top
View user's profile Send private message
Calehay
...yeah.
Class B Minstrel



Joined: 07 Jul 2004
Posts: 549

PostPosted: Thu Jul 22, 2010 12:44 pm    Post subject: Reply with quote

It looks like if you swapped the "green note" and "green count" variables in the for loop, it would work fine.
_________________
Calehay
Back to top
View user's profile Send private message AIM Address
G-Wreck
OHRRPGCE Game Designer




Joined: 28 Feb 2010
Posts: 32
Location: Oklahoma

PostPosted: Thu Jul 22, 2010 8:57 pm    Post subject: Reply with quote

And you were right, thank you.
_________________
Syzygy - .01% (Extremely Random Number)

Finishing the main story arcs and gameplay elements before I do anything else.
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: Thu Jul 22, 2010 10:35 pm    Post subject: Reply with quote

There's another bug:
Code:
for(loop,0,green count)

should be
Code:
for(loop,0,green count--1)

Otherwise, you'll find that "NPC reference(9,loop)" returns 0 for the extra "loop" value, which causes it to walk the first copy of NPC ID 0!

To understand why the "--1" is needed, realise that if there are 5 copies of the NPC, then they are numbered (for the purpose of the "NPC reference" command) 0, 1, 2, 3, 4.
_________________
"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