Aller au contenu

Photo

Target character leaving moduel after conversation is finish.


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

#1
simomate

simomate
  • Members
  • 83 messages
So for my Mod, I require the person, in which the player speaks to, to leave the area after the conversation is over. How do I achieve this?

#2
Mudeye

Mudeye
  • Members
  • 126 messages
One way to do it is to have the creature walk away towards a waypoint and disappear on the way.

This is an ActionsTaken script for the last line of the conversation when the npc is going to leave.
1) Make a waypoint at the location you want the npc to walk to.  ( I tagged mine "ExitWaypoint")
2) ClearAllActions makes sure that the Npc won't do anything unexpected.
3) Destroy the npc (but not for 5 seconds)
4) Immediately have the npc walk to the waypoint.

Notice that the walk action happens before destroy even though destroy is first in the script.  That is because of the 5.0 which is a delay time.


void main()
{
    object wp = GetWaypointByTag( "ExitWaypoint" );
    ClearAllActions(TRUE);
    DestroyObject( OBJECT_SELF, 5.0 );
    ActionMoveToObject( wp );
}


If you want the npc to be somewhere else later. You can create one at the destination. 

#3
simomate

simomate
  • Members
  • 83 messages
Hey thanks, it worked. But what say, I have 4 children, who all run into the forest after the convo is finished?

#4
Mudeye

Mudeye
  • Members
  • 126 messages
Ok, this assumes that the 4 children all have the same tag which is "ChildTag".

void main()
{
    int i;
    object child;
    for( i=0; i<4; i++ )
    {
        child = GetObjectByTag("ChildTag",i);
        AssignCommand( child, ClearAllActions(TRUE) );
        DestroyObject( child, 5.0 );
        AssignCommand( child, ActionMoveToObject( wp ));
    }
}

The lexicon looks like the GetObjectByTag uses 0 to (N-1) for the children.  It might be wrong.  If so then the loop would be:
for( i=1; i<=4; i++)

#5
simomate

simomate
  • Members
  • 83 messages
I require the tags to be different, for each one talks during the conversation.

#6
Mudeye

Mudeye
  • Members
  • 126 messages
Then incorporate the number into the tag.
Like: Child0,Child1,Child2,Child3

void main()
{
     int i;
     object child;
     for( i=0; i<4; i++)
     {
         string childTag = "Child"+IntToString(i);
         child = GetObjectByTag(childTag);
         AssignCommand( child, ClearAllActions(TRUE) );
         DestroyObject( child, 5.0 );
         AssignCommand( child, ActionMoveToObject( wp ));
     }
}

Modifié par Mudeye, 24 septembre 2010 - 03:45 .