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 npc

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




Joined: 17 Feb 2003
Posts: 28

PostPosted: Mon Dec 15, 2003 3:07 pm    Post subject: moving npc Reply with quote

Question yo, im having trouble with npc's, i have 1 script, and 3 different npcs, how can i make each of them move using the same script when the hero talks to them, (example-- if the hero talk to npc 3 it moves down 2, and if he talk to npc 1 it walks down 2.) do i need three scripts for each of them or do i use variables or someting. thankz if u can help out Question
Back to top
View user's profile Send private message
Sephyroth
Renegade Rebel Redmage
Class A Minstrel



Joined: 04 Feb 2003
Posts: 644
Location: Schmocation

PostPosted: Mon Dec 15, 2003 3:26 pm    Post subject: Reply with quote

Simple.

Quote:
include, plotscr.hsd

define script(1,npcswalkdown,1,0)

script, npcswalkdown, npcid, begin #Where npcid is the id of the npc you're trying to move
walk npc(npcid,south,2)
end


When you edit NPCs for a map, you can see two slots labeled Run Script and NPC variable. For a script like this, you'd just put the script above into the Run Script slot and the ID of the NPC into the NPC variables to make the script work.
_________________
im realy ded Sad...
Back to top
View user's profile Send private message Send e-mail AIM Address
Me
HI.




Joined: 30 Mar 2003
Posts: 870
Location: MY CUSTOM TITLE CAME BACK

PostPosted: Mon Dec 15, 2003 3:29 pm    Post subject: Reply with quote

It's labeled as "NPC argument," I believe.
_________________
UP DOWN UP DOWN LEFT LEFT RIGHT RIGHT A B START
Back to top
View user's profile Send private message AIM Address
Sephyroth
Renegade Rebel Redmage
Class A Minstrel



Joined: 04 Feb 2003
Posts: 644
Location: Schmocation

PostPosted: Mon Dec 15, 2003 3:35 pm    Post subject: Reply with quote

My mistake. Sorry.
_________________
im realy ded Sad...
Back to top
View user's profile Send private message Send e-mail AIM Address
Serg




Joined: 17 Feb 2003
Posts: 28

PostPosted: Mon Dec 15, 2003 3:50 pm    Post subject: not working Reply with quote

Arrow yo, thankz, but its not working, im trying to make each npc walk down 2, but they'er different npcs,not copies of the same npc, (example-- i talk to npc 1 and it walks down 2, then i walk towards npc 2 and it walks down 2,and same for 3,thankz again Arrow
Back to top
View user's profile Send private message
fyrewulff
Guest






PostPosted: Mon Dec 15, 2003 8:32 pm    Post subject: Fyre's Handy Dandy One Use Script Reply with quote

If you want to have one script you can use to always make a NPC walk down 2 spaces, -no matter- what NPC it is, use this script (CAUTION: UNTESTED)

use your own number for the script number.

Code:


define script(1500,2stepnpc,none)


script, 2 step npc, begin
 if (hero direction == north) then (  walknpc(npcatspot(herox,heroy--1), south, 2 )
 if (hero direction == south) then (  walknpc(npcatspot(herox,heroy +1), south, 2 )
 if (hero direction == east) then (  walknpc(npcatspot(herox+1,heroy), south, 2 )
 if (hero direction == west) then (  walknpc(npcatspot(herox --1,heroy), south, 2 )

end


As I've said, untested, but I'm pretty sure that should work.
Have it be the script called when the player uses the NPC.
Back to top
Me
HI.




Joined: 30 Mar 2003
Posts: 870
Location: MY CUSTOM TITLE CAME BACK

PostPosted: Mon Dec 15, 2003 9:16 pm    Post subject: Reply with quote

Serg: Do you have NPC 1 with NPC argument set to 1, NPC 2 with argument 2, and NPC 3 with argument 3? Because, if you do, the script that Sephyroth gave should work. Just make sure you get the arguments set in there correctly.
Also, Fyre's script should work, i can't see anything wrong with it (but I haven't tested it, of course), but I would try to get the argument one to work, as knowing how to use arguments well can be a great asset in scripting.
_________________
UP DOWN UP DOWN LEFT LEFT RIGHT RIGHT A B START
Back to top
View user's profile Send private message AIM Address
Bob the Hamster
OHRRPGCE Developer




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

PostPosted: Mon Dec 15, 2003 9:34 pm    Post subject: a cool trick Reply with quote

Code:

define script(1,npcswalkdown,2,0,0)

script, npcswalkdown, arg, reference, begin
  walk npc(reference,south,2)
end


A very cool thing, that should be better documented than it is (it's burried in the FAQ somewhere) is the fact tha5t any NPC-activated script automatically passes an NPC reference to the triggering NPC as the *second* argument, so you can make this script work without even having to set the NPC's "script argument" value to anything at all.

(Notice the presence of the useless "arg" placeholder argument. That is just there because you can't give a name to the second argument unless you give a name to the first argument too)

Ah, here we go. It is in the Plot Script Tutor, not in the FAQ. http://hamsterrepublic.com/ohrrpgce/plotscripttutor.html#triggering
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Serg




Joined: 17 Feb 2003
Posts: 28

PostPosted: Tue Dec 16, 2003 11:59 am    Post subject: thankz Reply with quote

Arrow yo, thankz james, and all that helped, it works i have multiple npcs and when the hero uses them they all use the same script it even works with copies of the same npc, thankz again Arrow
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: Wed Dec 17, 2003 3:03 am    Post subject: Reply with quote

Ah, you missed a closing bracket there Fyre:

if (hero direction == north) then ( walknpc(npcatspot(herox,heroy--1), south, 2 )

should be

if (hero direction == north) then (walknpc(npcatspot(herox,heroy--1), south, 2 ))

etc.
_________________
"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