ZScript actor functions

From ZDoom Wiki
Jump to navigation Jump to search
Note: This feature is for ZScript only.


This page lists ZScript-specific factors that are not part of the classic Action functions list. There is no guarantee these will work in DECORATE, especially anything that is not type int, double, bool or void.

This list does not include ZScript virtual functions and functions intrinsic to all ZScript classes, including actors.

Math

  • clearscope double AngleTo(Actor target, bool absolute = false) const
  • clearscope double PitchTo(Actor target, double zOfs = 0, double targZOfs = 0, bool absolute = false) const
  • clearscope static double DeltaAngle(double ang1, double ang2)
  • clearscope static double AbsAngle(double ang1, double ang2)
  • clearscope static Vector2 AngleToVector(double angle, double length = 1)
  • clearscope static Vector2 RotateVector(Vector2 vec, double angle)
  • clearscope static double Normalize180(double ang)
  • clearscope static double BobSin(double fb)
  • clearscope Vector2 Vec2To(Actor other) const
  • clearscope Vector3 Vec3To(Actor other) const
  • clearscope Vector3 Vec3Offset(double x, double y, double z, bool absolute = false) const
  • clearscope Vector3 Vec3Angle(double length, double angle, double z = 0, bool absolute = false) const
  • clearscope Vector2 Vec2Angle(double length, double angle, bool absolute = false) const
  • clearscope Vector2 Vec2Offset(double x, double y, bool absolute = false) const
  • clearscope Vector3 Vec2OffsetZ(double x, double y, double atz, bool absolute = false) const
  • void VelIntercept(Actor targ, double speed = -1, bool aimpitch = true, bool oldvel = false)
  • void VelFromAngle(double speed = 1e37, double angle = 1e37)
  • void Vel3DFromAngle(double speed, double angle, double pitch)

Checks

Information

Actor Control

Spawn Functions

  • static Actor Spawn(class<Actor> type, vector3 pos = (0,0,0), int replace = NO_REPLACE)
  • void SpawnTeleportFog(Vector3 pos, bool beforeTele, bool setTarget)
  • void SpawnBlood(Vector3 pos1, double dir, int damage)
  • void BloodSplatter(Vector3 pos, double hitangle, bool axe = false)
  • void SpawnDirt(double radius)

State Functions

Movement Functions

  • void SetOrigin(vector3 newpos, bool moving)
  • void SetXYZ(vector3 newpos)
  • bool Teleport(Vector3 pos, double angle, int flags)
  • void AddZ(double zadd, bool moving = true)
  • void SetZ(double z)
  • void Thrust(double speed = 1e37, double angle = 1e37)
  • bool TeleportMove(Vector3 pos, bool telefrag, bool modifyactor = true)
  • bool SinkMobj(double speed)
  • bool RaiseMobj(double speed)
  • bool Warp(Actor dest, double xofs = 0, double yofs = 0, double zofs = 0, double angle = 0, int flags = 0, double heightoffset = 0, double radiusoffset = 0, double pitch = 0)
  • bool BounceActor(Actor blocking, bool onTop)
  • bool BounceWall(Line l = null)
  • bool BouncePlane(SecPlane plane)
  • bool ReflectOffActor(Actor blocking)

Monster AI

Sound Functions

Attack Functions

  • void RailAttack(FRailParams p)
  • double BulletSlope(out FTranslatedLineTarget pLineTarget = null, int aimflags = 0)
  • Actor SpawnMissile(Actor dest, class<Actor> type, Actor owner = null)
  • Actor SpawnMissileXYZ(Vector3 pos, Actor dest, Class<Actor> type, bool checkspawn = true, Actor owner = null)
  • Actor SpawnMissileZ(double z, Actor dest, class<Actor> type)
  • Actor SpawnMissileAngleZSpeed(double z, class<Actor> type, double angle, double vz, double speed, Actor owner = null, bool checkspawn = true)
  • Actor SpawnMissileZAimed(double z, Actor dest, Class<Actor> type)
  • Actor SpawnSubMissile(Class<Actor> type, Actor target)
  • Actor, Actor SpawnPlayerMissile(class<Actor> type, double angle = 1e37, double x = 0, double y = 0, double z = 0, out FTranslatedLineTarget pLineTarget = null, bool nofreeaim = false, bool noautoaim = false, int aimflags = 0)
  • Actor OldSpawnMissile(Actor dest, class<Actor> type, Actor owner = null)
  • Actor SpawnPuff(class<Actor> pufftype, vector3 pos, double hitdir, double particledir, int updown, int flags = 0, Actor victim = null)
  • void TraceBleed(int damage, Actor missile)
  • void TraceBleedAngle(int damage, double angle, double pitch)
  • void PoisonMobj (Actor inflictor, Actor source, int damage, int duration, int period, Name type)
  • double AimLineAttack(double angle, double distance, out FTranslatedLineTarget pLineTarget = null, double vrange = 0., int flags = 0, Actor target = null, Actor friender = null)
  • Actor, int LineAttack(double angle, double distance, double pitch, int damage, Name damageType, class<Actor> pufftype, int flags = 0, out FTranslatedLineTarget victim = null, double offsetz = 0., double offsetforward = 0., double offsetside = 0.)
  • Actor SpawnMissileAngle(class<Actor> type, double angle, double vz)
  • Actor SpawnMissileAngleZ(double z, class<Actor> type, double angle, double vz)
  • static void AimBulletMissile(Actor proj, Actor puff, int flags, bool temp, bool cba)
  • void DoMissileDamage(Actor target)

Inventory Functions

  • clearscope Inventory FindInventory(class<Inventory> itemtype, bool subclass = false) const
  • Inventory GiveInventoryType(class<Inventory> itemtype)
  • bool GiveInventory(Class<Inventory> type, int amount, bool givecheat = false)
  • bool TakeInventory(class<Inventory> itemclass, int amount, bool fromdecorate = false, bool notakeinfinite = false)
  • bool SetInventory(class<Inventory> itemclass, int amount, bool beyondMax = false)
  • bool UsePuzzleItem(int PuzzleItemType)
  • clearscope Inventory FirstInv()
  • Inventory DropInventory(Inventory item, int amt = -1)
  • bool GiveAmmo(Class<Ammo> type, int amount)
  • static bool DoGiveInventory(Actor receiver, bool orresult, class<Inventory> mi, int amount, int setreceiver)
  • bool DoTakeInventory(Actor receiver, bool orresult, class<Inventory> itemtype, int amount, int flags, int setreceiver = AAPTR_DEFAULT)
  • void TossItem()
  • clearscope int CountInv(class<Inventory> itemtype, int ptr_select = AAPTR_DEFAULT) const
  • bool CheckInventory(class<Inventory> itemtype, int itemamount, int owner = AAPTR_DEFAULT)
  • void ObtainInventory(Actor other)
  • bool InitSpawnedItem(Actor mo, int flags)
  • int GetAmmoCapacity(class<Ammo> type)
  • void SetAmmoCapacity(class<Ammo> type, int amount)

Behavior functions

(Pull request #2908 only)

This is a list of all actor functions used by the behavior system.

  • clearscope Behavior FindBehavior(class<Behavior> type) const
Returns the specified Behavior if it exists, otherwise returning null.
  • type
The type of Behavior to look for. This is exact and can't return child classes. A BehaviorIterator should be used for getting all child class types on a given Actor.
  • bool RemoveBehavior(class<Behavior> type)
Removes the given behavior if it exists. Returns true if it was removed or false if nothing was removed.
  • type
The type of Behavior to remove. This is exact and won't remove child classes. ClearBehaviors() passed with a type should be used for that.
  • Behavior AddBehavior(class<Behavior> type)
Adds a new Behavior to the Actor, returning the Behavior it either created or found. Calls Initialize() if created and Reinitialize() if it already existed.
  • type
The type of Behavior to add.
  • void TickBehaviors()
Calls Tick() on all the Actor's existing Behaviors. This is normally done automatically but if an Actor has a full Tick() override or more control is desired for when Behaviors can tick, this can be used to handle this.
  • void ClearBehaviors(class<Behavior> type = null)
Removes all Behaviors the Actor currently has.
  • type
If not null, only remove classes of this type. Note that if null is passed, the removal will be absolute and any residual Behaviors after clean up will be automatically removed as well.
  • void MoveBehaviors(Actor from)
Transfers all the Behaviors from an existing Actor to this one and calls TransferredOwner() in the process.
  • from
The Actor to transfer the Behaviors from.

See also