fuaZandroX modding reference

Q-Zandronum's ACS functions

Availability

Q-Zandronum's functions at ZandroX's numbers. They keep the names Q-Zandronum gave them, but Q-Zandronum's numbers (149, 150, 154, 155, 157, 158, 168) belong to other Zandronum functions here, so they sit at 24110-24116. A script compiled with Q-Zandronum's own header calls something else here: compile against zt-bcc's zcommon.bcs or fua.acs. Elsewhere these numbers return 0.

Number Function Returns
24110 CheckSolidFooting(int tid [, fixed threshold]) CSF_SOLIDGROUND when the actor is within threshold of its floor (default 0), else CSF_SOLIDACTORS when it stands on another actor, else CSF_INAIR, also for no actor
24111 GetNetworkState() NETSTATE_SINGLE, NETSTATE_SINGLE_MULTIPLAYER, NETSTATE_CLIENT or NETSTATE_SERVER for the machine running the script
24112 UnlaggedReconcile(int tid) on a server, the world rewound to what the actor's player saw; the tics it went back, 0 when nothing was rewound
24113 UnlaggedRestore(int tid) the rewind put back
24114 TagActive(int tag) true while a sector with the tag has a floor or ceiling mover
24115 InCampaign() true on a campaign's map
24116 VelIntercept(int tid, int targettid, fixed speed [, bool useptr]) 0; the actor turned to meet the target with a shot of speed, leading a moving target; with useptr, targettid is an AAPTR_ of the actor

Usage

  • Footing. A threshold lets a player count as grounded while a step above its floor, as a jump or slide script wants: CheckSolidFooting(0, 4.0) != CSF_INAIR.
  • Network state. NETSTATE_SINGLE_MULTIPLAYER is an offline game in a multiplayer mode, such as a skirmish with bots. A CLIENTSIDE script on a client sees NETSTATE_CLIENT.
  • Unlagged. Between UnlaggedReconcile and UnlaggedRestore, the other players and the moving sectors stand where the activator's player saw them, so a script's own hitscan check, such as a LineAttack or a fua_LineTrace, judges what that player aimed at. Only a server rewinds; offline and on a client both return 0. A weapon fired while the script holds the rewind uses it rather than rewinding again, and the rewind is put back when the script stops running for the tic (a Delay, or its end) even without UnlaggedRestore, so nothing stays rewound by mistake. A second UnlaggedReconcile before the first is put back returns 0.
  • Movers by tag. TagActive lets a script wait for a door, lift or floor to finish: while ( TagActive( 5 ) ) Delay( 1 );.
  • Leading a target. VelIntercept only turns the actor; fire the projectile after it, with the same speed. A target subject to gravity and not under water is led along the ground only. One moving straight toward or away from the actor is aimed at directly. Each call jitters the lead by up to a fifth of the target's speed, as Q-Zandronum's does, and a server sends the new angle to every client.

Examples

Where the player stands and what the game is:

#library "qzfoot"
#import "zcommon.bcs"

script "QzWhere" ( void ) {
   int footing = CheckSolidFooting( 0 );
   Log( s: "footing ", d: footing, s: ", grounded ", d: footing == CSF_SOLIDGROUND,
      s: ", net ", d: GetNetworkState(), s: ", campaign ", d: InCampaign() );
}

A server-side hitscan check judged as the activator's player saw the target, put back before the script waits:

#library "qzunlag"
#import "zcommon.bcs"

script "QzSnipeCheck" ( void ) net {
   int tics = UnlaggedReconcile( 0 );
   LineAttack( 0, GetActorAngle( 0 ), GetActorPitch( 0 ), 25 );
   UnlaggedRestore( 0 );
   Log( s: "rewound ", d: tics, s: " tics" );
}

A turret leading the player with a 20-unit rocket, for ACC:

#library "qzturret"
#include "fua.acs"

script "QzTurret" (int turret)
{
    VelIntercept(turret, AAPTR_PLAYER1, 20.0, TRUE);
    // fire now, at the same speed: SpawnProjectile(turret, "Rocket", GetActorAngle(turret) >> 8, 20 * 8, 0, 0, 0);
    Log(s: "turret faces ", f: GetActorAngle(turret));
}

Not here yet

Q-Zandronum's client-predicted functions, SetActionScript, SetPredictableValue, GetPredictableValue, SetEffectActor, SetNetworkReplicationFlags and SyncPlayerNetwork, need its prediction of scripts, which ZandroX does not have. The first three keep their reserved Zandronum numbers (141-143) and return 0; the other three would take 24117-24119.