Weapon-related Functions
Weapon
Sets NPC's current weapon state.
Syntax
Weapon select,melee
-- Selects melee weapon, if available
Weapon select,ranged
-- Selects ranged weapon, if available
Weapon arm
-- Automatically selects weapon
Weapon disarm
-- Holsters active weapon
Weapon drop
-- Drops active weapon (won't drop if it's not out)
🆙🪽 Postal III Ultrapatch Syntax
Weapon pickup
-- Attempts to pick up weapon off from the ground, if the target is a weapon and is dropped.
Example
// From ai_mission_pdb.p3s
st_OnSprayStunned
{
Group Alert
Patterns
{
pt_default
{
actions
{
AreaEvent ENEMY,16
// Drops weapon
Weapon drop
ExecutePattern bh_base:st_OnSprayStunned.pt_default
}
}
}
}
// From ai_mission_srm.p3s
// This will unholster it's weapon and aim at the Player
pt_attack
{
actions
{
Timer attacktimer,2:3,repeated
TargetPlayer 1
MoveToTarget false
FreeMovement false
Weapon Arm
Aim true
State st_hitit
}
}
Reload
Forces NPC to play reloading animation.
Syntax
Reload 1
-- Reloads
Example
// From ai_npc_military.p3s (stripped out)
pt_default
{
actions
{
IfAttr "ea_HaveAmmo == 0 Block begin"
ExecutePattern st_reload.xpt_prereload
Reload 1
WaitForEnd 1
Block end
State st_start
}
}
ThrowGrenade
Forces NPC to throw a grenade
Note
Smoke and Flash grenade are never used anywhere else in the game.
Flash isn't recommended to use as it'll apply a permanent sound altering effect.
Syntax
// Grenade types
frag
smoke -- Unused
flash -- Unused (not recommended to use this)
beenest
molotov
krotchy_toy
ThrowGrenade 1,[grenade type],[no_ally]
-- Throws grenade, optional flag
Example
behavior
{
name bh_molotovthrower
inherited bh_human
States
{
st_start
{
Group Neutral
Patterns
{
pt_default
{
actions
{
// Do nothing but throw molotovs at the Player every 5 seconds
SetSquadRelation player_squad:enemy:10
TargetPlayer 1
Wait 1
ThrowGrenade 1, molotov
Repeat 5
}
}
}
}
}
}