ACS built-in functions: Difference between revisions

From Eternity Wiki
Jump to navigationJump to search
(Created page with "These ACS functions are imported from ZDoom. ==Special TID info== For functions affecting things, some TIDs (thing tags) carry special meaning. TID 0 means the activator, and...")
 
Line 98: Line 98:
*void SetLineSpecial (int lineid, int special [, int arg0 [, int arg1 [, int arg2 [, int arg3 [, int arg4]]]]])
*void SetLineSpecial (int lineid, int special [, int arg0 [, int arg1 [, int arg2 [, int arg3 [, int arg4]]]]])
*void SetLineTexture(int lineid, int line_side, int sidedef_texture, str texturename);
*void SetLineTexture(int lineid, int line_side, int sidedef_texture, str texturename);
*fixed GetLineX(int lineId, fixed ratioAlongLine, fixed distanceFromLine);
*fixed GetLineY(int lineId, fixed ratioAlongLine, fixed distanceFromLine);
:These two functions return the coordinates on top of a linedef tagged as ''lineId''. Other parameters are:
:*''ratioAlongLine'': 0 means that you get the position of first vertex; 1.0 (65536) means the position of the second vertex. Any value between them is partly between them. Negative values are before the first vertex and values over 1.0 (65536) are beyond the second one.
:*''distanceFromLine'': the distance in map units perpendicular from the line. 0 means that you get a coordinate exactly on the linedef. Positive values put it in front of the first sidedef. Negative values put it behind.


==Sky==
==Sky==

Revision as of 15:19, 31 October 2016

These ACS functions are imported from ZDoom.

Special TID info

For functions affecting things, some TIDs (thing tags) carry special meaning. TID 0 means the activator, and TIDs -1 ... -4 mean each of the four players in the game -- this in an Eternity extension

Sound and music

  • void ActivatorSound(str sound, int volume)
Starts a sound from script's activator, at the given volume. If there's no activating thing, the sound will be ambient.
  • void AmbientSound(str sound, int volume)
Starts an ambient sound.
  • void LocalAmbientSound(str sound, str volume)
Starts an ambient sound that can only be heard by the activator, normally a player.
  • void PlaySound (int tid, str sound [, int channel [, fixed volume [, bool looping [, fixed attenuation]]]])
  • void PlayActorSound (int tid, int sound, int channel, fixed volume, bool looping, fixed attenuation)
  • void SectorSound(str sound, int volume);
  • void SetMusic (str song [, int order [, int unused]])
  • void LocalSetMusic (str song [, int order [, int unused]])
  • void SoundSequence (str sndseq);
  • void SoundSequenceOnActor (int tid, str sndseq);
  • void StopSound (int tid, int channel);
  • void ThingSound (int tid, str sound, int volume);

Sectors

  • void ChangeCeiling(int tag, str flatname)
Changes the ceiling texture of tagged sectors to flatname.
  • void ChangeFloor(int tag, str flatname)
Changes the floor texture of tagged sectors to flatname.
  • fixed GetSectorCeilingZ (int tag, int x, int y)
Gets sector ceiling height. Currently x and y are reserved for the time Eternity gets working slope physics.
  • fixed GetSectorFloorZ (int tag, int x, int y)
Gets sector floor height. Currently x and y are reserved for the time Eternity gets working slope physics.
  • int GetSectorLightLevel (int tag)

Things

  • bool CheckSight(int source, int dest, int flags)
Returns true if there's a line of sight between at least one thing tagged as source and one thing tagged as dest. Currently flags is reserved and must be 0.
  • bool CheckFlag(int tid, str flag)
Returns true if the first thing with the given tid has the given flag enabled.
  • bool CheckActorClass(int tid, str class)
Returns true if the first thing with the given tid is of the given class.
  • bool CheckActorProperty(int tid, int property, int/float/bool value)
Returns true if the first thing with the given tid has a property with the given value. Currently the following properties are supported:
  • APROP_HEALTH: hit points
  • APROP_SPEED: thing nominal speed, as defined in EDF. Depending on movement type, this can be expressed in units (e.g. 8 for zombieman) or multiples of 65536 (e.g. 655360 for imp fireball).
  • APROP_DAMAGE: thing nominal damage, such as the one set for projectiles (e.g. 3 for imp fireballs).
  • APROP_ALPHA: thing opacity. 65536 or 1.0 means full opacity, 0 means invisible.
  • APROP_Ambush: whether the thing has the AMBUSH flag, either as set in the editor or EDF.
  • APROP_Invulnerable: whether the thing has the INVULNERABLE flag
  • APROP_Friendly: whether the thing has the FRIEND flag
  • APROP_SpawnHealth: initial health
  • APROP_Dropped: whether the thing has the DROPPED flag, such as being dropped ammo that doesn't respawn and disappears if crushed
  • APROP_TargetTID: the thing's current enemy's TID
  • APROP_TracerTID: the thing's current "tracer"'s TID. A tracer has various meanings, most notable the homing missile target, the archvile fire target or a friend's guide player.
  • APROP_ScaleX, APROP_ScaleY: the thing sprite's scale, expressed in floating point (0.0 - 1.0 - ...) or fixed point (0 - 65536 - ...)
  • APROP_Dormant: whether the thing has the DORMANT flag
  • APROP_Mass: thing's "mass" as defined in EDF, i.e. how much it's thrusted when damaged.
  • APROP_Height: thing's height, in floating point / fixed point.
  • APROP_Radius: thing's radius (half of bounding box width), in floating point / fixed point.
  • APROP_ReactionTime: thing's reaction time, usually defined to 8 in EDF
  • APROP_MeleeRange: thing's melee range, currently constant to 64.0
  • int ClassifyActor(int tid)
Checks the kind of thing tagged tid. It returns a set of flags, possibly combined:
  • ACTOR_PLAYER (2): it's player-controlled
  • ACTOR_VOODOODOLL (8): it's a duplicate player start, not controlled by the player but still linked to it. Used in Boom maps for advanced mapping tricks
  • ACTOR_MONSTER (16): it's a monster (has COUNTKILL or KILLABLE thing type flag set)
  • ACTOR_MISSILE (128): it's a projectile in flight (has MISSILE thing type flag set)
  • ACTOR_GENERIC (256): neither a monster, nor a projectile
  • ACTOR_ALIVE (32): has positive health
  • ACTOR_DEAD (64): has health <= 0
  • ACTOR_NONE (0): no thing found with this TID
  • ACTOR_WORLD (1): TID is 0 but activator isn't a thing
  • int GetActorProperty (int tid, int property)
  • bool IsTIDUsed (int tid)
  • void SectorDamage (int tag, int amount, str type, str protection_item, int flags)
  • int SetActivator (int tid[, pointer_selector])
  • bool SetActivatorToTarget (int tid)
  • void SetActorAngle (int tid, fixed angle)
  • bool SetActorVelocity (int tid, fixed velx, fixed vely, fixed velz, bool add, bool setbob)
  • void SetActorPitch (int tid, int pitch)
  • bool SetActorPosition (int tid, fixed x, fixed y, fixed z, bool fog)
  • void SetThingSpecial (int tid, int special [, int arg0 [, int arg1 [, int arg2 [, int arg3 [, int arg4]]]]])
  • int SetActorState(int tid, str statename[, bool exact]);
  • void SetActorProperty (int tid, int property, int/float/bool value)
  • int Spawn (str classname, fixed x, fixed y, fixed z [, int tid [, int angle]])
  • int SpawnForced (str classname, fixed x, fixed y, fixed z [, int tid [, int angle]])
  • void SpawnProjectile (int tid, string type, int angle, int speed, int vspeed, int gravity, int newtid);
  • int SpawnSpot (str classname, int spottid [, int tid [, int angle]])
  • int SpawnSpotForced (str classname, int spottid [, int tid [, int angle]])
  • int SpawnSpotFacing (str classname, int spottid [, int tid])
  • int SpawnSpotFacingForced (str classname, int spottid [, int tid])
  • int ThingCount (int type, int tid)
  • int ThingCountName (str classname, int tid)
  • int ThingCountSector (int type, int tid, int tag)
  • int ThingCountNameSector (str classname, int tid, int tag)
  • int Thing_Damage2 (int tid, int amount, str type);
  • void Thing_Projectile2 (int tid, int type, int angle, int speed, int vspeed, int gravity, int newtid)
  • int UniqueTID ([int tid[, int limit]])

Linedefs and sidedefs

  • void ReplaceTextures (str oldtexturename, str newtexturename [, int flags])
  • void SetLineSpecial (int lineid, int special [, int arg0 [, int arg1 [, int arg2 [, int arg3 [, int arg4]]]]])
  • void SetLineTexture(int lineid, int line_side, int sidedef_texture, str texturename);
  • fixed GetLineX(int lineId, fixed ratioAlongLine, fixed distanceFromLine);
  • fixed GetLineY(int lineId, fixed ratioAlongLine, fixed distanceFromLine);
These two functions return the coordinates on top of a linedef tagged as lineId. Other parameters are:
  • ratioAlongLine: 0 means that you get the position of first vertex; 1.0 (65536) means the position of the second vertex. Any value between them is partly between them. Negative values are before the first vertex and values over 1.0 (65536) are beyond the second one.
  • distanceFromLine: the distance in map units perpendicular from the line. 0 means that you get a coordinate exactly on the linedef. Positive values put it in front of the first sidedef. Negative values put it behind.

Sky

  • void SetSkyScrollSpeed (int sky, fixed skyspeed);

Scripts

  • bool ACS_NamedExecuteAlways(str script, int map, int arg1, int arg2, int arg3)
  • Executes a named script, starting a new instance if one already exists. Returns true if successfully started.
  • bool ACS_NamedExecute(str script, int map, int arg1, int arg2, int arg3)
  • Executes a named script. Returns true if successfully started.
  • int ACS_NamedExecuteWithResult (string script, int s_arg1, int s_arg2, int s_arg3, int s_arg4)
  • bool ACS_NamedSuspend (string script, int map)
  • bool ACS_NamedTerminate (string script, int map)

Console

  • int GetCVar (str cvar)
  • string GetCVarString (str cvar)
  • int GetPlayerInput (int player, int input)

Polyobjects

  • fixed GetPolyobjX (int po)
  • fixed GetPolyobjY (int po)

Quake

  • void Radius_Quake2 (int tid, int intensity, int duration, int damrad, int tremrad, str sound)

Math

  • int Random (int min, int max)
  • int Sqrt (int number)
  • fixed FixedSqrt (fixed number)
  • int VectorLength (int x, int y)

Strings

  • str StrLeft (str string, int length)
  • str StrMid (str string, int start, int length)
  • str StrRight (str string, int length)