Last active
March 1, 2016 19:18
-
-
Save wallabra/213ef739f8086fea93b3 to your computer and use it in GitHub Desktop.
Assault ACS code for Zandronum
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#library "as_acs" | |
#include "zcommon.acs" | |
int PlayersReady[64]; | |
int PR_Size = 0; | |
int GoalsCompleted = 0; | |
int NumGoals = 0; | |
int ECT; | |
int ASTIC; | |
bool bInitialized; | |
bool bMatchStarted = 0; | |
script 151 (int endcamtid) | |
{ | |
if ( PlayerTeam() == 1 ) | |
{ | |
GoalsCompleted ++; | |
ECT = EndCamTID; | |
} | |
} | |
script 150 OPEN | |
{ | |
SetCVar("teamgame", 1); | |
if ( !GetCVar("assault") ) | |
terminate; | |
if ( !bInitialized ) | |
{ | |
log(s:"Assault loaded!"); | |
ASTIC = 0; | |
} | |
else | |
{ | |
ASTIC++; | |
} | |
bool bAutoRestarted = 0; | |
NumGoals = ThingCountName("ShootableAssaultGoal", 0) + ThingCountName("UsableAssaultGoal", 0); | |
if ( bMatchStarted ) | |
{ | |
SetPlayerProperty(1, 0, PROP_TOTALLYFROZEN); | |
HUDMessage(i:GetCVar("sv_as_remainingtics") / 35; HUDMSG_PLAIN, 2915, CR_YELLOW, 0.5, 0.8, 1 << 16); | |
SetCVar("sv_as_remainingtics", GetCVar("sv_as_remainingtics") - 1); | |
if ( GetCVar("sv_as_remainingtics") < 1 ) | |
{ | |
ACS_Execute(156, 0, 0); | |
terminate; | |
} | |
if ( GoalsCompleted == NumGoals ) | |
{ | |
ACS_Execute(156, 0, 1); | |
terminate; | |
} | |
} | |
else | |
{ | |
if ( GetCVar("sv_as_autorestarttics") != 0 && bAutoRestarted == 0 ) | |
{ | |
ACS_Execute(152, 0); | |
bAutoRestarted = 1; | |
} | |
else if ( PR_Size == PlayerCount() && !(PlayerCount() == 0) ) | |
{ | |
bMatchStarted = 1; | |
HudMessage(s:"Match Started!"; HUDMSG_PLAIN, 2914, cr_darkred, 0.5, 0.7, 5 << 16); | |
} | |
else | |
{ | |
HudMessage(s:"Press the key \"Ready for Match\" in controls to Get Ready!\nBind the button in Controls if you haven't yet!"; HUDMSG_PLAIN, 2914, cr_yellow, 0.5, 0.5, 1, 1 << 16); | |
SetPlayerProperty(1, 1, PROP_TOTALLYFROZEN); | |
} | |
} | |
Delay(1); | |
bInitialized = true; | |
restart; | |
} | |
script 152 (void) | |
{ | |
Delay(GetCVar("sv_as_autorestarttics")); | |
bMatchStarted = 1; | |
} | |
script 153 ENTER | |
{ | |
if ( PlayerIsBot(PlayerNumber()) ) | |
{ | |
PlayersReady[PR_Size + 1] = PlayerNumber(); | |
PR_Size++; | |
} | |
Log(s:"Player ", i:PlayerNumber(), s:" is ready!"); | |
Thing_ChangeTID(0, 6046 + PlayerNumber()); | |
} | |
script 154 (void) NET | |
{ | |
PlayersReady[PR_Size + 1] = PlayerNumber(); | |
PR_Size++; | |
} | |
script 155 (int parted) DISCONNECT | |
{ | |
bool RP = 0; | |
for ( int i = 0; i < 64; i++ ) | |
{ | |
if ( PlayersReady[i] == parted ) | |
{ | |
PlayersReady[i] = 0; | |
PR_Size--; | |
RP = 1; | |
} | |
if ( RP ) | |
{ | |
if ( i < 63 ) | |
PlayersReady[i] = PlayersReady[i + 1]; | |
} | |
} | |
} | |
script 156 (int AttackerSuccess) | |
{ | |
SetPlayerProperty(1, 1, PROP_TOTALLYFROZEN); | |
ChangeCamera(ECT, 1, 0); | |
if ( AttackerSuccess == 1 ) | |
{ | |
ACS_Execute(160, 0); | |
HudMessage(s:"The attackers won the match!"; HUDMSG_PLAIN, 2915, CR_RED, 0.5, 0.3, 0.0); | |
Delay(500); | |
Exit_Normal(0); | |
terminate; | |
} | |
ACS_Execute(161, 0); | |
HudMessage(s:"The defenders won the match!"; HUDMSG_PLAIN, 2915, CR_RED, 0.5, 0.3, 0.0); | |
Delay(500); | |
Exit_Normal(0); | |
} | |
script 157 (void) | |
{ | |
if ( PlayerTeam() == 1 ) GoalsCompleted = NumGoals; | |
} | |
script 158 (int EndCamTag) | |
{ | |
if ( PlayerTeam() == 1 ) ECT = EndCamTag; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment