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?
Target character leaving moduel after conversation is finish.
Débuté par
simomate
, sept. 18 2010 12:31
#1
Posté 18 septembre 2010 - 12:31
#2
Posté 18 septembre 2010 - 04:01
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.
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
Posté 23 septembre 2010 - 10:45
Hey thanks, it worked. But what say, I have 4 children, who all run into the forest after the convo is finished?
#4
Posté 23 septembre 2010 - 04:20
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++)
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
Posté 24 septembre 2010 - 06:29
I require the tags to be different, for each one talks during the conversation.
#6
Posté 24 septembre 2010 - 03:44
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 ));
}
}
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 .





Retour en haut






