Scripting/Server/NPCs/npc.SetDriveTo
Self-driving for an NPC that already sits in a vehicle as DRIVER (npc.Vehicle / VehicleSeat 0). The car AI drives to the point on its own, so a taxi script only needs the NPC seated plus this call. Optional speed = cruise speed (same as SetCruiseSpeed). Returns false when the NPC is not a driver.
Syntax
npc.SetDriveTo(Vector pos [, speed])Arguments
- Vector pos
- float speed (optional)
Example
function onPlayerCommand( player, cmd, params )
{
if ( cmd == "setdriveto" )
{
// npc is a npc handle (see NPC members)
npc.SetDriveTo( player.Pos );
}
}This sample was generated from the signature – adapt the values to your gamemode.
Related pages
Section: NPC members
Categories: Server functions | NPC members