I need a script that tells one NPC to follow another. There will be no combat involved(plot NPCs) and the only intereuption will be if someone stops the leader to talk then the follower stops and resumes following later. Im making an NPC who walks thru town with a body guard so I cant use two waypoint sets...Thanks in advance. You guys have really helped me alot in the past.
should be an easy one for you master mind scripters
Débuté par
christinetooley
, avril 08 2011 02:26
#1
Posté 08 avril 2011 - 02:26
#2
Posté 08 avril 2011 - 02:46
There's a function called ActionForceFollowObject, it can get cancelled with ClearAllActions.
#3
Posté 08 avril 2011 - 02:58
OK...sorry, im no scripter but how would i set it up?
#4
Posté 08 avril 2011 - 07:57
In my Silverwand Sample Campaign there is a man walking a dog. The dog follows the man. That should work for your needs as well. You can download the campaign from the vault.
#5
Posté 09 avril 2011 - 11:29
Flattery is the best policy, huh?
What you probably want to do is modify the creature's OnHeartbeat script. I would make a new script, and fire the default one from inside it using ExecuteScript() so that default behaviour still gets run (e.g. combat behaviour etc), like so:
Then you will want to make the bodyguard follow the NPC, but I expect you won't want to do this, say, if they are in combat. So, do something like this:
Hope that helps.
What you probably want to do is modify the creature's OnHeartbeat script. I would make a new script, and fire the default one from inside it using ExecuteScript() so that default behaviour still gets run (e.g. combat behaviour etc), like so:
void main()
{
ExecuteScript("nw_c2_defaultX", OBJECT_SELF);
}
(I can't remember the name of the default Heartbeat script, you'll have to replace the X with something).Then you will want to make the bodyguard follow the NPC, but I expect you won't want to do this, say, if they are in combat. So, do something like this:
ExecuteScript("nw_c2_defaultX", OBJECT_SELF);
//Exit here if we are in combat
if(GetIsInCombat(OBJECT_SELF)) {return;}
//Find the NPC
object oNPC = GetNearestObjectByTag("<NPC Tag here>");
if(!GetIsObjectValid(oNPC)){return;}
//Follow the NPC
ActionForceFollowObject(oNPC);
Obviously you will need to replace <NPC Tag here> with the tag of the NPC (this is how the bodyguard knows who to follow).Hope that helps.
#6
Posté 15 juillet 2011 - 02:22
This is what I needed...but its not compiling. LOL
#7
Posté 15 juillet 2011 - 05:02
Just use my walking the dog script. It works.





Retour en haut






