Freedom of Movement Functions
FreeMovement
Sets or resets NPC's freedom of movement.
Note
[reset]
will reset FreeMovementParams's parameters.
Syntax
FreeMovement [walk/run],[reset]
-- NPC will walk or run, [reset] is optional
FreeMovement [true/false],[reset]
-- NPC can move or not, [reset] is optional
FreeMovement random,[reset]
-- Chooses between walk or run, [reset] is optional
Example
// (From ai_cashmart_npc.p3s)
// This will reset the NPC's movement to be able to move everywhere
xpt_invalidroute
{
actions
{
Face false
Crouch false
Aim false
FreeMovementParams area_all,-1,-1,area_group,once
FreeMovement run,reset
}
}
FreeMovementParams
Restricts NPC's movement with parameters
// (From ai_st_init.p3s)
Const ED_VERY_CLOSE,32
Const ED_CLOSE,160
Const ED_MIDDLE,320
Const ED_FAR,768
Const ED_FURTHER,1280
Const ED_VERY_FAR,2048
// Flags
current
hint_all
hint_hidden
hint_visible
area_all
area_hidden
area_visible
cover
backaway
// Goal flags
safe
hint_group
from_target
hint_face
use_node
nearest
move_from_target
random
once
area_group
Syntax
FreeMovementParams [flag],[distance min],[distance max],[goalflag1],[goalflag2],[goalflag3], ..
Example
// This will allow the NPC to move everywhere in it's area group
FreeMovementParams area_all,-1,-1,area_group
// This will restrict the NPC to move inside hint groups only
FreeMovementParams hint_all,-1,-1,hint_group
// This will make the NPC move to a hint group or node, only once
FreeMovementParams hint_all,ED_MIDDLE,ED_VERY_FAR,hint_group,hint_face,use_node,once
// This will force the NPC to be really close to it's target
FreeMovementParams area_all,0,ED_VERY_CLOSE,from_target
// This however will make the NPC go away from it's target as far as possible
FreeMovementParams area_all,ED_VERY_FAR,ED_VERY_FAR,move_from_target