Aller au contenu

Photo

should be an easy one for you master mind scripters


  • Veuillez vous connecter pour répondre
6 réponses à ce sujet

#1
christinetooley

christinetooley
  • Members
  • 58 messages
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.

#2
Lugaid of the Red Stripes

Lugaid of the Red Stripes
  • Members
  • 955 messages
There's a function called ActionForceFollowObject, it can get cancelled with ClearAllActions.

#3
christinetooley

christinetooley
  • Members
  • 58 messages
OK...sorry, im no scripter but how would i set it up?

#4
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 598 messages
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
The Fred

The Fred
  • Members
  • 2 516 messages
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:

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
christinetooley

christinetooley
  • Members
  • 58 messages
This is what I needed...but its not compiling. LOL

#7
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 598 messages
Just use my walking the dog script. It works.