CP3SObj@
The scripting entity which is attached to all POSTAL3 entities, this is what Postal3Script is using for it's scripting.
Methods
Attributes
int GetAttr(const string&in sAttr)
-- Gets the value of an entity.bool HasAttr(const string&in sAttr)
-- Checks if an attribute exists.bool SetAttr(const string&in sAttr, int val, int min = -1, int max = 100)
-- Sets or creates an attribute with values specified.bool RemoveAttr(const string&in sAttr)
-- Removes an attribute if it exists.
Pointers
CBaseEntity@ GetBaseEntity()
-- Gets the base entity pointer.CP3SObj@ GetTarget()
-- Gets the current P3S target.CP3SObj@ GetCaller()
-- Gets the current P3S caller.CP3SObj@ GetMemory(int iSlot)
-- Gets the object from a memory slot, if it exists. Min: 0 Max: 15CP3SObj@ GetWeapon()
-- Gets the held weapon, if there's any.CP3SObj@ GetAnchor()
-- Gets the anchor, if there's any.CP3SObj@ GetItem()
-- Gets currently held item, if there's any.CP3Weapon@ GetWeaponPtr()
-- Gets the weapon pointer for the object's weapon. For Player it is always the active weapon, for NPCs it is always the Melee or Ranged weapon stored.
Targeting
void SetTarget(CP3SObj@ ent)
-- Sets P3S target.void SetEnemy(CP3SObj@ pEnemy, bool bSetCondNewEnemy = true)
-- Sets the enemy.void SetCaller(CP3SObj@ ent)
-- Sets P3S caller.void SetMemory(CP3SObj@ ent, int iSlot)
-- Saves an object to the memory slot. Min: 0 Max: 15void Ignore(CP3SObj@ ent, float flTime)
-- Ignores an object for a specified amount of time.bool IsIgnored(CP3SObj@ ent)
-- Checks if object is already ignored.
States, Patterns
bool State(string&in sState)
-- Sets the P3S state.bool Pattern(string&in sPattern)
-- Sets the P3S pattern, from it's current P3S state.void ExecutePattern(string&in sXptPattern)
-- Executes a P3S pattern externally.void FireEvent(string&in sEvent, CP3SObj@ obj = null)
-- Fires a P3S event, caller(obj) is optional.bool HasAI()
-- Checks if entity has a behavior defined.
Timers
bool GetTimer(string&in timerName)
-- Checks if Timer exists.void SetTimer(string&in timerName, float flTime, bool bRepeated)
-- Sets a Timer, seconds, and should it repeat.float GetTimerVal(string&in timerName)
-- Gets a Timer's current interval (seconds). 0 or below means the Timer has elapsed.float GetTimerFreq(string&in timerName)
-- Gets the Timer's frequency.bool IsTimerRepeated(string&in timerName)
-- Checks if Timer is repeated.
Data
void SetBehavior(string&in Behavior, string& Manner = null, string& Faction = null, string& Init = null, string& Start = null)
-- Sets the new behavior for the object.string GetManner()
-- Gets the manner's name.string GetFaction()
-- Gets the faction's name.string GetCurState()
-- Gets the current P3S state's name.string GetCurGroup()
-- Gets the current P3S state's group's name. (Neutral, Alert, Combat)string GetBehavior()
-- Gets the behavior name.string GetInherit()
-- Gets the inherited behavior name, if there's any.string GetCurPattern()
-- Gets the current P3S pattern's name.
Identify
bool IsPlayer()
-- Checks if object is a player.bool IsNPC()
-- Checks if object is an NPC.bool IsHuman()
-- Checks if object is a human NPC.bool IsAnimal()
-- Checks if object is an animal. (Dog, Cat, Monkey, Motorhead, Rhino, Pigeon)bool IsDog()
-- Checks if object is a Dog.bool IsCat()
-- Checks if object is a Cat.bool IsMonkey()
-- Checks if object is a monkey. (+Motorhead)bool IsMotorhead()
-- Checks if object is Motorhead.bool IsProp()
-- Checks if object is a prop. (Item, Weapon, Corpse)bool IsItem()
-- Checks if object is an item. (Inventory items)bool IsWeapon()
-- Checks if object is a weapon.bool IsCorpse()
-- Checks if object is a corpse/limb.bool IsVehicle()
-- Checks if object is a vehicle.bool IsFSM()
-- Checks if object is Anchor, AttackPos, LaserDot, or Effect.bool IsAnchor()
-- Checks if object is an Anchor.bool IsAttackPos()
-- Checks if object is attack pos.bool IsLaserDot()
-- Checks if object is laser dot.bool IsEffect()
-- Checks if object is effect.
Stimuli
void KnockOut(CP3SObj@ attacker = null)
-- Knocks the object out. Attacker is optional.void Suicide(CP3SObj@ attacker = null)
-- Kills the object. Attacker is optional.void Relationship(CP3SObj@ ent, int disp, int prio)
-- Sets the relationship towards an object.bool CanSee(CP3SObj@ ent, bool bFOV = true)
-- Checks if object can see the entity. If bFOV is false, then it checks if vision is obstructed.void Follow(bool bEnabled, int iMode = 0, double fDist = 0.0f)
-- Forces the object to follow it's current target. Modesvoid MoveToTarget(int movementType, int face, int flags, double fDist, double fAngle, double flLeaderAdvanceTime = 0.0f, bool bScriptCommand = true)
-- Forces the object to move to it's current target. (Face types|Movement types)bool IsOnFire()
-- Checks if object is on fire.void Ignite(CBaseEntity@ activator, float flFlameLifetime, bool bNPCOnly, float flSize, bool bCalledByLevelDesigner)
-- Ignites the object.void Extinguish()
-- Extinguishes the object.
Inventory
bool HasWeapon(int weaponId, bool bAmmoCheck = true)
-- Checks if object has a weapon. Ammo check is only needed for players. Weapon IDsbool HasHeldWeapon()
-- Checks if object is holding a weapon.bool HasHeldItem()
-- Checks if object is holding an item.int GetAmmoCount(int ammoIndex)
-- Gets the ammo count.
Appearance
int Sequence(string&in seq, float dur, int flags = 0)
-- Starts a sequence. (NPC only) Returns 1 if it was successful. Flagsvoid ResetSequence()
-- Resets current sequence. (NPC only)int Say(string&in sentence, int priority = 0)
-- Makes the object say a sentence. Priority Flagsvoid EmitSound(string&in name)
-- Plays a sound. Equivalent to Postal3Script's EmitSound.
Other
void TeleportTo(CP3SObj@ ent)
-- Teleports the object to an object.void AngelScript(string&in sClass, string&in sFunc, CP3SObj@ caller = null)
-- Executes AngelScript calls for this object.void Headblob(string&in hbName)
-- Sets Headblob.float GetTargetDot(CBaseEntity@ target)
-- Gets the dot between target.