Zandronum-specific scripting documentation

Discuss all aspects related to modding Zandronum here.
Post Reply
User avatar
Dusk
Developer
Posts: 581
Joined: Thu May 24, 2012 9:59 pm
Location: Turku

Zandronum-specific scripting documentation

#1

Post by Dusk » Fri Aug 31, 2012 3:20 pm

== This thread is old and outdated, please use the wiki instead. ==

Zandronum supports the following ACS and Decorate features in addition to the ones inherited from Skulltag 98d:

GAMEMODE:
GAMEMODE is a definition lump that allows to alter the behavior of built-in gamemodes. Its syntax is as follows:

Code: Select all

<gamemode> {
    properties
}
<gamemode> can be one of the following:
  • Cooperative
  • Survival
  • Invasion
  • Deathmatch
  • TeamPlay
  • Duel
  • Terminator
  • LastManStanding
  • TeamLMS
  • Possession
  • TeamPossession
  • TeamGame
  • CTF
  • OneFlagCTF
  • Skulltag
  • Domination
properties can be any number of either of the following:
  • AddFlag <flag>
  • RemoveFlag <flag>
<flag> can be one of the following:
  • Cooperative
  • Deathmatch
  • TeamGame
  • UseFlagsAsTeamItem
  • PlayersEarnKills
  • PlayersEarnFrags
  • PlayersEarnPoints
  • PlayersEarnWins
  • DontSpawnMapThings
  • MapResets
  • DeadSpectators
  • PlayersOnTeams
  • UseMaxLives
  • UseTeamItem
  • MapReset_Resets_MapTime
ACS:
ResetMap()
Resets the entire map, as if it was restarted.

NOTE: In order for maps to be reset properly, the initial values need to be stored on the machine. Since this requires some additional resources to work properly, this requires the gamemode to have the MapResets flag set. This is only set by default in Survival, Duel, Invasion, LMS and TeamLMS. In order to use this in other gamemodes, the MapResets flag has to be set via GAMEMODE described above.

PlayerIsSpectator(int player)
Returns 1, if the player is a true spectator, 2 if a dead spectator (dead in a LMS/survival round) or 0 otherwise.

ConsolePlayerNumber()
Returns the player index of the client executing the script. Only useful in client-side scripts. In server-side scripts this will always return -1.

GetTeamProperty (int team, int property)
Returns various information of teams. Naturally, only really useful in team-based gamemodes. Team is 0-based team numbers (TEAM_BLUE (0), TEAM_RED (1)), property is one of the following:
  • TPROP_Name: Returns the name of the team
  • TPROP_Score: Returns the effective score of the team (wins in LMS, frags in TDM, flags in CTF, etc)
  • TPROP_IsValid: 1 if the team actually exists.
  • TPROP_NumPlayers: Amount of players on the team.
  • TPROP_NumLivePlayers: Amount of live players on the team. Only makes sense in TLMS.
  • TPROP_TextColor: Text color range of the team. You can use this value in conjuction with the color field in HudMessage.
  • TPROP_PlayerStartNum: Editor number of the player starts of this team.
  • TPROP_Spread: Amount of effective score minus the leading team's effective score. This is positive if the team is leading, 0 if tied for first place, negative if the team is not first.
  • TPROP_Carrier: The number of the player holding this team's item.
  • TPROP_Assister: The number of the player who returned this team's item. If a capture/tag occurrs for this team, this player will get an assist medal.
  • TPROP_FragCount: Overall amount of frags this team has made.
  • TPROP_DeathCount: Overall count of this team's deaths.
  • TPROP_WinCount: Amount of times this team has won a TLMS round.
  • TPROP_PointCount: Amount of points this team has. This is effective in CTF, Skulltag, Possession and teamgame.
  • TPROP_ReturnTics: Amount of tics until this team's item is returned automatically.
  • TPROP_TeamItem: Name of the team's item.
  • TPROP_WinnerTheme: Name of the intermission music played when this team wins.
  • TPROP_LoserTheme: Name of the intermission music played when this team loses.
NOTES
  • TPROP_ReturnTics cannot be retrieved properly in client-side scripts
  • TPROP_Carrier returns the player holding the team's item. It's an enemy player! However, TPROP_Assister refers to a member of the team.
  • TPROP_Name, TPROP_WinnerTheme and TPROP_LoserTheme return dynamic strings akin to those returned by strparam. They will disappear after a tic.
IMPORTANT NOTE
The default shipped ACC does NOT recognize any of the above commands. In order to use these functions, you need to append some data to some of the definition files:

zspecial.acs:

Code: Select all

	-100:ResetMap(0),
	-101:PlayerIsSpectator(1),
	-102:ConsolePlayerNumber(0),
	-103:GetTeamProperty(2),
These go directly above the "-1000:__EndOfList__(10);" line. NOT BELOW IT.

zdefs.acs:

Code: Select all

#define TPROP_Name 0
#define TPROP_Score 1
#define TPROP_IsValid 2
#define TPROP_NumPlayers 3
#define TPROP_NumLivePlayers 4
#define TPROP_TextColor 5
#define TPROP_PlayerStartNum 6
#define TPROP_Spread 7
#define TPROP_Carrier 8
#define TPROP_Assister 9
#define TPROP_FragCount 10
#define TPROP_DeathCount 11
#define TPROP_WinCount 12
#define TPROP_PointCount 13
#define TPROP_ReturnTics 14
#define TPROP_TeamItem 15
#define TPROP_WinnerTheme 16
#define TPROP_LoserTheme 17
DECORATE:
A_FaceConsolePlayer [(float MaxTurnAngle)]
Makes the calling actor turn towards the player. In network games it appears to look at the player the client controls (even if the player is looking through the eyes of someone else). MaxTurnAngle defines how much this actor will turn at most. It defaults to 0, which causes the actor to turn to face the console player immediately.

Note: this will inevitably cause desync with the angle of the actor, so it's not advised to be used on non-decorative actors.
This codepointer encapsulates Hissy's behavior, which was moved out to skulltag_actors.pk3 and thus could not be native anymore. Hissy uses a MaxTurnAngle value of 5 and calls this codepointer every tic.
Last edited by Dusk on Wed Nov 26, 2014 10:58 pm, edited 1 time in total.

User avatar
Dusk
Developer
Posts: 581
Joined: Thu May 24, 2012 9:59 pm
Location: Turku

RE: Zandronum-specific scripting documentation

#2

Post by Dusk » Wed Nov 26, 2014 10:57 pm

Unstickied, this thread is old and outdated, please use the wiki instead.

Post Reply