Skip to content

CP3SObj@

The scripting interface which is attached to all POSTAL3 entities and is Postal3Script itself.

Methods

  • float GetSoundExpireDuration() -- Gets the expire duration to the sound.
  • CSound@ GetSoundPtr() -- Gets the pointer to CSound.
  • CBaseEntity@ GetBaseEntity() -- Gets the pointer to CBaseEntity.
  • bool opEquals(CP3SObj@ other) --
  • bool IsDeleted() -- Returns true if P3S object is deleted.
  • bool IsValid() -- Returns true if P3S object is valid.
  • int GetAttr(const string&in attribute) -- Gets the value of the attribute.
  • int GetAttrMin(const string&in attribute) -- Gets the minimum value of the attribute.
  • int GetAttrMax(const string&in attribute) -- Gets the maximum value of the attribute.
  • string GetAttrEvent(const string&in attribute) -- Gets the event of the attribute, if it has any.
  • bool HasAttr(const string&in attribute) -- Returns true if this attribute exists.
  • bool SetAttr(const string&in attribute, int val, int min = -1, int max = 100) -- Sets the value of the attribute. Returns true if the new value doesn't match old value. (min and max are optional)
  • bool RemoveAttr(const string&in attribute) -- Returns true if attribute removal was successful.
  • CP3SObj@ GetTarget() -- Gets the current P3S target.
  • CP3SObj@ GetEnemy() -- Gets the current P3S enemy.
  • CP3SObj@ GetCaller() -- Gets the current P3S caller.
  • CP3SObj@ GetMemory(int slot) -- Gets a P3S object from memory index.
  • CP3SObj@ GetWeapon() -- Gets the pointer to held weapon. (Player & NPC only)
  • CP3SObj@ GetMyOwner() -- Gets the pointer to owner if object is a weapon or item.
  • CP3SObj@ GetAnchor() -- Gets the pointer to anchor.
  • CP3SObj@ GetItem() -- Gets the pointer to currently held item. (NPC only)
  • CP3Weapon@ GetWeaponPtr() -- Gets the pointer to CP3Weapon. (Player & NPC get the pointer to held weapon)
  • CP3Player@ GetPlayerPtr() -- Gets the pointer to CP3Player. (Players only)
  • CPhysObj@ GetRagdollPtr() -- Gets the pointer to CPhysObj. (Ragdolls only)
  • void SetTarget(CP3SObj@ ent) -- Sets P3S target.
  • void SetEnemy(CP3SObj@ pEnemy, bool bSetCondNewEnemy = true) -- Sets P3S enemy.
  • void SetCaller(CP3SObj@ ent) -- Sets P3S caller.
  • void SetMemory(CP3SObj@ ent, int slot) -- Saves P3S object into memory.
  • void Ignore(CP3SObj@ ent, float flTime) -- Ignores P3S object for a specified amount of time.
  • bool IsIgnored(CP3SObj@ ent) -- Returns true if P3S object is ignored for this object.
  • bool State(string&in stateName) -- Returns true if P3S State CHANGE was successful.
  • bool Pattern(string&in patternName) -- Returns true if P3S Pattern CHANGE was successful.
  • void ExecutePattern(string&in xptpatternName) -- Returns true if P3S Pattern EXECUTION was successful.
  • void FireEvent(string&in event, CP3SObj@ obj = null) -- Fires a P3S event. (Caller is optional)
  • bool HasAI() -- Returns true if object has proper P3S scripting. (Behavior is not default_behavior)
  • void BeginAction() -- Locks/Pauses the P3S state of the entity. (This ensures no event will disrupt the object)
  • void EndAction() -- Unlocks/Unpauses the P3S state of the entity.
  • bool GetTimer(string&in timerName) -- Returns true if Timer exists.
  • void SetTimer(string&in timerName, float flTime, bool bRepeated) -- Sets the (new) Timer's interval and loop.
  • float GetTimerVal(string&in timerName) -- Gets the Timer's current value.
  • float GetTimerFreq(string&in timerName) -- Gets the Timer's interval.
  • bool IsTimerRepeated(string&in timerName) -- Returns true if Timer is looped.
  • void SetBehavior(string&in behavior, string&in Manner = "", string&in Faction = "", string&in Init = "", string&in Start = "") -- Sets a new P3S behavior for this object.
  • string GetManner() -- Gets the P3S Manner.
  • string GetFaction() -- Gets the P3S Faction.
  • string GetCurState() -- Gets the current State's name.
  • string GetCurGroup() -- Gets the current State's Group. (Neutral, Alert, Combat)
  • string GetBehavior() -- Gets the current Behavior's name.
  • string GetInherit() -- Gets the inherited Behavior's name.
  • string GetCurPattern() -- Gets the current Pattern's name.
  • string GetCurAreaGroup() -- Gets the current area group name.
  • string GetCusCurAreaGroup() -- Gets the current custom area group name.
  • bool IsPlayer() -- Returns true if Player.
  • bool IsNPC() -- Returns true if NPC.
  • bool IsHuman() -- Returns true if Human.
  • bool IsAnimal() -- Returns true if Animal.
  • bool IsDog() -- Returns true if Dog.
  • bool IsCat() -- Returns true if Cat.
  • bool IsMonkey() -- Returns true if Monkey.
  • bool IsMotorhead() -- Returns true if Motorhead.
  • bool IsProp() -- Returns true if Prop. (Item+Weapon+Corpse)
  • bool IsItem() -- Returns true if Item.
  • bool IsWeapon() -- Returns true if Weapon.
  • bool IsCorpse() -- Returns true if Corpse.
  • bool IsVehicle() -- Returns true if Vehicle. (UNIMPLEMENTED)
  • bool IsFSM() -- Returns true if FSM. (Anchor+Flame+LaserDot+AttackPos)
  • bool IsAnchor() -- Returns true if Anchor.
  • bool IsAttackPos() -- Returns true if AttackPos. (UNIMPLEMENTED)
  • bool IsLaserDot() -- Returns true if LaserDot.
  • bool IsEffect() -- Returns true if Effect. (Flame+CatnipMark+TaserBeam)
  • void KnockOut(CP3SObj@ attacker = null) -- Knocks out object. (NPC only)
  • void Suicide(CP3SObj@ attacker = null) -- Kills the object. (Anything that takes damage and has health)
  • void Relationship(CP3SObj@ ent, int disp, int prio) -- Sets relation to object.
  • bool CanSee(CP3SObj@ ent, bool bFOV = true) -- Returns true if object can see the target.
  • void Follow(bool bEnabled, int iMode = 0, float fDist = 0.0f) -- Behaves the same as Postal3Script's Follow.
  • void MoveToTarget(int movementType, int face, int flags, float fDist, float fAngle, float flLeaderAdvanceTime = 0.0f, bool bScriptCommand = true) -- Behaves the same as Postal3Script's MoveToTarget.
  • bool IsOnFire() -- Returns true if on fire.
  • void Ignite(CBaseEntity@ activator, float flFlameLifetime, bool bNPCOnly, float flSize, bool bCalledByLevelDesigner) -- Sets the object on fire.
  • void Extinguish() -- Extinguishes the object.
  • int FreeMovement(P3SMovementType_t movementType, P3SGoalInfo_t goalInfo = AIGIP_COUNT) -- Behaves the same as Postal3Script's FreeMovement.
  • bool HasWeapon(int weaponId, bool bAmmoCheck = true) -- Returns true if object has specific weapon.
  • bool HasHeldWeapon() -- Returns true if object has any held weapon. (Anything other than Empty Hands)
  • bool HasHeldItem() -- Returns true if object has any held item.
  • int GetAmmoCount(int ammoIndex) -- Gets the count of an ammo.
  • int Sequence(string&in seq, float dur, int flags = 0) -- Behaves the same as Postal3Script's Sequence.
  • void ResetSequence() -- Behaves the same as Postal3Script's ResetSequence.
  • int Say(string&in sentence, int priority = 0) -- Behaves the same as Postal3Script's Say.
  • void EmitSound(string&in name) -- Behaves the same as Postal3Script's EmitSound.
  • void TeleportTo(CP3SObj@ ent) -- Teleports the object to a target.
  • void Headblob(string&in hbName) -- Sets a headblob.
  • float GetTargetDot(CBaseEntity@ target) -- Gets the dot between the object and the target.
  • void SetMeleeType(int iType) -- Sets the melee type. (Prop Items only)
  • int GetMeleeType() -- Gets the melee type. (Prop Items only)
  • int ExecuteAction(string&in name, string&in param, CP3SObj@ target = null) -- Executes a Postal3Script function. (Slow in execution, not recommended)