Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #library "global"
- #include "zcommon.acs"
- //Included for easy manipulation in case of conflicting script numbers.
- #define FIRST 701 //OPEN
- #define SECOND 702 //ENTER
- #define THIRD 703 //RESPAWN
- #define FOURTH 704 //(Melee).......Also referenced in keyconf.txt.
- #define FIFTH 705 //(Kill)
- #define SIXTH 706 //(Win)
- #define SEVENTH 707 //(Regen).......Also referenced in /actors/player.txt.
- #define EIGHTH 708 //DISCONNECT
- #define NINTH 709 //(Display killer info)
- #define NUMOFGUNS 21 //This must be equal to the total number of elements in the GunList array.
- #define NUMOFOLDGUNS 12 //This must be equal to the total number of elements in the ClassicGunList array.
- #define MAXNUMOFGUNS NUMOFGUNS+NUMOFOLDGUNS
- //Element 0 will be given whenever the melee bind is used.
- str GunList[MAXNUMOFGUNS] =
- {
- "Kick",
- "Revolver",
- "DualPistols",
- "CoachGun",
- "WesternShotgun",
- "DukeShotgun",
- "AK47",
- "MachineGun",
- "Rifle",
- "M16",
- "G3",
- "MP40",
- "GatlingGun",
- "M60",
- "SniperRifle",
- "HeavyRifle",
- "Bazooka",
- "M79",
- "Flametosser",
- "SawThrower",
- "IronCrossbow",
- };
- str ClassicGunList[MAXNUMOFGUNS] =
- {
- "Kick",
- "~Pistol",
- "~Shotgun",
- "~Chaingun",
- "~Supershotgun",
- "~Minigun",
- "~RocketLauncher",
- "~GrenadeLauncher",
- "~PlasmaRifle",
- "~Railgun",
- "~BFG9000",
- "~BFG10k",
- };
- //----------------------DECLARING VARIABLES.
- int GunLevel[32];
- //Variables used in the For loops which set up Classic and Random mode.
- int qwerty = 0;
- str asdf = "~Chainsaw";
- int randy = 0;
- //Regeneration stuff.
- bool AlreadyRunning[32];
- bool InPain[32];
- int PainDelayCount[32];
- bool GameOver = 0;
- //----------------------VARIABLES DECLARED.
- function int Max (int a, int b)
- {
- if (a>b) {return a;}
- return b;
- }
- Script FIRST OPEN //Activated on map load. (Setting up game modifiers.)
- {
- qwerty=NUMOFGUNS;
- if (GetCVar("Buckshot")==1)
- {
- Log(s:"Buckshot is enabled, running Classic mode.");
- For(qwerty=0; qwerty<NUMOFOLDGUNS; qwerty++)
- {
- GunList[qwerty]=ClassicGunList[qwerty];
- }
- }
- if (GetCVar("Instagib")==1)
- {
- Log(s:"Instagib is enabled, running Random mode.");
- For(qwerty=0; qwerty<NUMOFOLDGUNS-1; qwerty++)
- {
- GunList[qwerty+NUMOFGUNS]=ClassicGunList[qwerty+1];
- }
- For(qwerty=1; qwerty<MAXNUMOFGUNS-1; qwerty++)
- {
- asdf=GunList[qwerty]; //Store original weapon.
- randy=Random(1,MAXNUMOFGUNS-2); //Pick a random weapon.
- GunList[qwerty]=GunList[randy]; //Set original weapon to randomly chosen one.
- GunList[randy]=asdf; //Set randomly chosen weapon to original one.
- }
- }
- }
- Script SECOND ENTER //Activated at spawn. (Setting up inventory.)
- {
- Delay(1); //Make sure the OPEN script is run first.
- if (GameOver==1) {SetPlayerProperty(1,1,4); SetPlayerProperty(1,1,5);} //Make sure the game isn't ending.
- Thing_ChangeTID(0,PlayerNumber()+1001);
- SetThingSpecial(0,ACS_ExecuteAlways,FIFTH,0,PlayerNumber()); //On death, run script FIFTH, but make the killer the activator.
- ClearInventory(); //So Buckshot and Instagib don't break everything.
- GiveInventory("AllKeys",1);
- if (GunLevel[PlayerNumber()]<1) {GunLevel[PlayerNumber()]=1;} //Prevent negative weapon level.
- GiveInventory(GunList[GunLevel[PlayerNumber()]],1); //Give whatever weapon they are up to.
- //Update ACS Mini-HUD.
- SetFont("BIGFONT");
- HUDMessage(s:"\cg",s:GunList[GunLevel[PlayerNumber()]],s:" (\cb",d:GunLevel[PlayerNumber()],s:"\cg/\cb",d:qwerty-1,s:"\cg)";
- HUDMSG_PLAIN,42,0,1.0,0.0,0);
- }
- Script THIRD RESPAWN //Activated at respawn.
- {
- ACS_ExecuteAlways(SECOND,0); //Reset inventory again.
- }
- Script FOURTH (void) net //Melee script.
- {
- if (GetActorProperty(0,APROP_Health)<=0 | GameOver==1) {Terminate;} //Make sure they're not dead and the game isn't ending.
- GiveInventory(GunList[0],1); SetWeapon(GunList[0]); //Give (and switch to) melee weapon.
- }
- Script FIFTH (int victim) //Activated at death, with the killer as the activator. (Leveling up.)
- {
- GiveActorInventory(victim+1001,"HideHUD",1); //Hide the dead player's HUD.
- if (!(ClassifyActor(0) & ACTOR_PLAYER)) {GunLevel[victim]--; Terminate;} //If they died from a "world" event, decrease their weapon level and end script.
- if (PlayerNumber()==victim) {GunLevel[PlayerNumber()]--; Terminate;} //If they killed themself, decrease their weapon level and end script.
- if (CheckWeapon(GunList[0])==1) {GunLevel[victim]--; Terminate;} //If they used the melee weapon, lower the victim's weapon level and end script.
- if (GunLevel[PlayerNumber()]+1>=qwerty) {ACS_ExecuteAlways(SIXTH,0); Terminate;} //If they're up to the last weapon in the array, go directly to win script.
- ACS_ExecuteAlways(NINTH,0,PlayerNumber(),victim); //Display killer info to dead guy.
- //Everything checked out fine, level up.
- ClearInventory(); //Remove old weapon.
- GiveInventory("AllKeys",1);
- GunLevel[PlayerNumber()]++; //Increase weapon level.
- if (GetActorProperty(0,APROP_Health)<=0) {Terminate;} //Make sure they're alive.
- GiveInventory(GunList[GunLevel[PlayerNumber()]],1); //Give new weapon.
- //Update ACS Mini-HUD.
- SetFont("BIGFONT");
- HUDMessage(s:"\cg",s:GunList[GunLevel[PlayerNumber()]],s:" (\cb",d:GunLevel[PlayerNumber()],s:"\cg/\cb",d:qwerty-1,s:"\cg)";
- HUDMSG_PLAIN,42,0,1.0,0.0,0);
- }
- Script SIXTH (void) //Activated on win. (Ending the level.)
- {
- if (GameOver==1) {Terminate;} //Prevent more than one player winning.
- GameOver=1;
- Log(n:0,s:"\cc won."); //Console message.
- SetFont("BIGFONT");
- HUDMessageBold(s:"\cg",n:0,s:"\cg wins!";HUDMSG_PLAIN,0,0,0.5,0.45,0); //Main HUD message.
- SetActivator(-1); //In case the script activator disconnects.
- SetPlayerProperty(1,1,4); //Freeze players.
- SetPlayerProperty(1,1,5); //Make players invulnerable.
- Delay(35*3);
- SetPlayerProperty(1,0,4); //Unfreeze players.
- SetPlayerProperty(1,0,5); //Make players vulnerable.
- Exit_Normal(0); //Exit map.
- }
- Script SEVENTH (int HealDelay) //Activated when damage is inflicted. (Regen script.)
- {
- if (GetActorProperty(0,APROP_Health)>=100) {Terminate;} //Don't heal if they have over 100 health already.
- InPain[PlayerNumber()]=1; //Set pain variable for player.
- if (AlreadyRunning[PlayerNumber()]==1) {Terminate;} //Make sure they aren't already being healed.
- AlreadyRunning[PlayerNumber()]=1; //Declare that they are being healed.
- While (GetActorProperty(0,APROP_Health)<100 && GetActorProperty(0,APROP_Health)>0) //Regenerate only while their health is between 0 and 100.
- {
- if (InPain[PlayerNumber()]==1) //Take a pause if damage is inflicted while healing.
- {
- InPain[PlayerNumber()]=0; //Reset pain variable.
- For(PainDelayCount[PlayerNumber()]=1; PainDelayCount[PlayerNumber()]<35*HealDelay; PainDelayCount[PlayerNumber()]++) //Count to variable set in /actors/player.txt (in seconds.)
- {
- if (InPain[PlayerNumber()]==1) {InPain[PlayerNumber()]=0; PainDelayCount[PlayerNumber()]=1;} //If damage is inflicted during pause, restart counter.
- Delay(1);
- }
- }
- HealThing(1);
- Delay(2);
- }
- AlreadyRunning[PlayerNumber()]=0; //Full health reached, reset variable before ending script.
- }
- Script EIGHTH (int quitter) DISCONNECT //Activated on disconnect/spectate. (Resetting variables.)
- {
- GunLevel[quitter]=0; //Reset gun level for new players.
- //Reset health regen variables.
- AlreadyRunning[quitter]=0;
- InPain[quitter]=0;
- PainDelayCount[quitter]=0;
- }
- Script NINTH (int killer, int victim) //Display killer info to dead guy.
- {
- SetActivator(victim+1001);
- SetFont("BIGFONT");
- HUDMessage(s:"\ccKiller's Health: \cg",d:Max(GetActorProperty(killer+1001,APROP_Health),0);
- HUDMSG_FADEOUT,11,0,0.5,0.45,2.0,1.0);
- HUDMessage(s:"\ccKiller's Gun: \cg",s:GunList[GunLevel[killer]-1],s:" (\cb",d:GunLevel[killer]-1,s:"\cg/\cb",d:qwerty-1,s:"\cg)";
- HUDMSG_FADEOUT,328,0,0.5,0.50,2.0,1.0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement