×
Меню
Индекс

MSFD Make an NPC walk to a new location

 
 
AiTravel, float_enum_x, float_enum_y, float_enum_z, [reset]
 
     Actor->AITravel, 1359, 2700, 1045
 
To make an NPC walk between different defined places in the game world you use the AITravel function.
The variables x, y, z are world coordinates. You can determine these by moving your camera to the desired endpoint of the movement or by selecting a path grid point or an object nearby coordinates are displayed below the object window. The usage of the optional reset flag is unknown.
 
When using this function in scripts it is important to provide conditions where the AI package is called only once. Consider the following NPC bound script
 
Begin Travel
 
AiTravel, 1359, 2700, 1045
 
End Travel
 
The previous script will not work, as the script “fires” continuously, and the effect is that the NPC freezes and never performs the desired movement.
 
Begin Travel
Short do_once
 
If ( do_once == 0 )
AiTravel, 1359, 2700, 1045
Set do_once to 1
endif
 
End Travel
 
This should work; the NPC will wander to the designated coordinates as soon as his script becomes active, meaning as soon as his cell is loaded.