ZScript actor functions

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


ZScript adds a plethora of functions used internally by actors, exposing them all to it. 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.

Math

  • 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

  • ui void DisplayNameTag()
  • name GetClassName()
  • class<Actor> GetClass()
  • static class<Actor> GetReplacement(class<Actor> cls)
  • static class<Actor> GetReplacee(class<Actor> cls)
  • static int GetSpriteIndex(name sprt)
  • clearscope static double GetDefaultSpeed(class<Actor> type)
  • clearscope static Actor GetDefaultByType(class<Actor> type)
  • static class<Actor> GetSpawnableType(int spawnnum)
  • clearscope int GetRenderStyle() const
  • protected void CheckPortalTransition(bool linked = true)
  • clearscope string GetTag(string defstr = "") const
  • clearscope string GetCharacterName() const
  • double GetBobOffset(double frac = 0)
  • clearscope int PlayerNumber() const
  • TerrainDef GetFloorTerrain()
  • clearscope Vector3 PosRelative(sector sec) const
  • clearscope int SpawnHealth() const
  • clearscope double Distance2D(Actor other) const
  • clearscope double Distance3D(Actor other) const
  • clearscope double Distance2DSquared(Actor other) const
  • clearscope double Distance3DSquared(Actor other) const
  • clearscope Actor GetPointer(int aaptr)
  • void CheckFakeFloorTriggers(double oldz, bool oldz_has_viewheight = false)
  • Actor RoughMonsterSearch(int distance, bool onlyseekable = false, bool frontonly = false)
  • int GetModifiedDamage(Name damagetype, int damage, bool passive, Actor inflictor = null, Actor source = null, int flags = 0)
  • clearscope bool CountsAsKill() const
  • bool LineTrace(double angle, double distance, double pitch, int flags = 0, double offsetz = 0., double offsetforward = 0., double offsetside = 0., out FLineTraceData data = null)
  • void FindFloorCeiling(int flags = 0)
  • double, double GetFriction()
  • bool, Actor TestMobjZ(bool quick = false)
  • clearscope double AngleTo(Actor target, bool absolute = false) const
  • clearscope DropItem GetDropItems() const
  • double DistanceBySpeed(Actor other, double speed)
  • name GetSpecies()
  • clearscope double GetCameraHeight() const
  • clearscope double GetGravity() const
  • clearscope int GetLevelSpawnTime() const
  • clearscope int GetAge() const
  • double AccuracyFactor()
  • Actor AimTarget()
  • int GetRadiusDamage(Actor thing, int damage, int distance, int fulldmgdistance = 0, bool oldradiusdmg = false)

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

  • bool SetState(state st, bool nofunction = false)
  • clearscope state FindState(statelabel st, bool exact = false) const
  • bool SetStateLabel(statelabel st, bool nofunction = false)
  • action state ResolveState(statelabel st)
  • static bool InStateSequence(State newstate, State basestate)

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)

Monster AI

  • bool isTeammate(Actor other)
  • bool CheckBossDeath()
  • bool CheckMeleeRange()
  • bool CheckMeleeRange2()
  • bool TriggerPainChance(Name mod, bool forcedPain = false)
  • bool HitFriend()
  • bool MonsterMove()
  • bool TryWalk()
  • bool TryMove(vector2 newpos, int dropoff, bool missilecheck = false, FCheckPosition tm = null)
  • bool CheckMove(vector2 newpos, int flags = 0, FCheckPosition tm = null)
  • void NewChaseDir()
  • void RandomChaseDir()
  • bool CheckMissileRange()
  • bool isFriend(Actor other)
  • bool isHostile(Actor other)
  • bool LookForMonsters()
  • bool LookForTid(bool allaround, LookExParams params = null)
  • bool LookForEnemies(bool allaround, LookExParams params = null)
  • bool LookForPlayers(bool allaround, LookExParams params = null)

Sound Functions

  • void SoundAlert(Actor target, bool splash = false, double maxdist = 0)
  • void DaggerAlert(Actor target)
  • void PlaySpawnSound(Actor missile)
  • SeqNode StartSoundSequenceID(int sequence, int type, int modenum, bool nostop = false)
  • SeqNode StartSoundSequence(Name seqname, int modenum)
  • void StopSoundSequence()
  • void PlayActiveSound()
  • void Howl()
  • void A_StartSound(sound whattoplay, int slot = CHAN_BODY, int flags = 0, double volume = 1.0, double attenuation = ATTN_NORM, double pitch = 0.0)
  • bool IsActorPlayingSound(int channel, Sound snd = 0)

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 UsePuzzleItem(int PuzzleItemType)
  • clearscope Inventory FirstInv()
  • 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)
  • 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)

See also