 |
Castle Paradox
|
View previous topic :: View next topic |
Author |
Message |
Serg

Joined: 17 Feb 2003 Posts: 28
|
Posted: Mon Dec 15, 2003 3:07 pm Post subject: moving npc |
|
|
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  |
|
Back to top |
|
 |
Sephyroth Renegade Rebel Redmage Class A Minstrel

Joined: 04 Feb 2003 Posts: 644 Location: Schmocation
|
Posted: Mon Dec 15, 2003 3:26 pm Post subject: |
|
|
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  |
|
Back to top |
|
 |
Me HI.

Joined: 30 Mar 2003 Posts: 870 Location: MY CUSTOM TITLE CAME BACK
|
Posted: Mon Dec 15, 2003 3:29 pm Post subject: |
|
|
It's labeled as "NPC argument," I believe. _________________ UP DOWN UP DOWN LEFT LEFT RIGHT RIGHT A B START |
|
Back to top |
|
 |
Sephyroth Renegade Rebel Redmage Class A Minstrel

Joined: 04 Feb 2003 Posts: 644 Location: Schmocation
|
Posted: Mon Dec 15, 2003 3:35 pm Post subject: |
|
|
My mistake. Sorry. _________________ im realy ded  |
|
Back to top |
|
 |
Serg

Joined: 17 Feb 2003 Posts: 28
|
Posted: Mon Dec 15, 2003 3:50 pm Post subject: not working |
|
|
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  |
|
Back to top |
|
 |
fyrewulff Guest
|
Posted: Mon Dec 15, 2003 8:32 pm Post subject: Fyre's Handy Dandy One Use Script |
|
|
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
|
Posted: Mon Dec 15, 2003 9:16 pm Post subject: |
|
|
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 |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Mon Dec 15, 2003 9:34 pm Post subject: a cool trick |
|
|
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 |
|
 |
Serg

Joined: 17 Feb 2003 Posts: 28
|
Posted: Tue Dec 16, 2003 11:59 am Post subject: thankz |
|
|
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  |
|
Back to top |
|
 |
TMC On the Verge of Insanity
Joined: 05 Apr 2003 Posts: 3240 Location: Matakana
|
Posted: Wed Dec 17, 2003 3:03 am Post subject: |
|
|
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 |
|
 |
|
|
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
|