From e404b780f9882089d1bc10d4f9471ca87b2e48ba Mon Sep 17 00:00:00 2001 From: rafa_99 Date: Fri, 28 Jan 2022 02:03:14 +0000 Subject: Added Tombstone Solo mod --- README.md | 13 +- all/modLoader.gsc | 141 ----------------- counters/bothCounters.gsc | 121 --------------- counters/healthCounter.gsc | 91 ----------- counters/zombieCounter.gsc | 87 ----------- mods/all/modLoader.gsc | 337 ++++++++++++++++++++++++++++++++++++++++ mods/counters/bothCounters.gsc | 121 +++++++++++++++ mods/counters/healthCounter.gsc | 91 +++++++++++ mods/counters/zombieCounter.gsc | 87 +++++++++++ mods/perks/noPerkLimit.gsc | 32 ++++ mods/perks/tombstoneSolo.gsc | 221 ++++++++++++++++++++++++++ perks/noPerkLimit.gsc | 33 ---- 12 files changed, 900 insertions(+), 475 deletions(-) delete mode 100755 all/modLoader.gsc delete mode 100755 counters/bothCounters.gsc delete mode 100755 counters/healthCounter.gsc delete mode 100755 counters/zombieCounter.gsc create mode 100755 mods/all/modLoader.gsc create mode 100755 mods/counters/bothCounters.gsc create mode 100755 mods/counters/healthCounter.gsc create mode 100755 mods/counters/zombieCounter.gsc create mode 100755 mods/perks/noPerkLimit.gsc create mode 100755 mods/perks/tombstoneSolo.gsc delete mode 100755 perks/noPerkLimit.gsc diff --git a/README.md b/README.md index 356ea55..c6ef46d 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,13 @@ A bunch of mods for black ops 2 zombies -## Install Pre-Compiled Mod +## Install + +### With Pre-Compiled Mod Download the mod binaries from the releases and drag and drop them into `%localappdata%\Plutonium\storage\t6\scripts\zm`, if this destination does not exist, then proceed to create it. -## Install with Compilation +### Manually Compiling the Mod 1. You can write/download any GSC of your choice. If you are writing it from scratch/have the source code, note that you will need to compile it. @@ -53,3 +55,10 @@ onplayerspawned() When launching your server or a custom game, you will know if all has gone well or not if the console prints Custom script 'scripts/mp/yourScriptName' loaded. ![Script Loaded](images/oVlCBnI.png) + +## Available Mods + +* Zombie Counter; +* Health Counter; +* Unlimited Perks; +* Tombstone in Solo; diff --git a/all/modLoader.gsc b/all/modLoader.gsc deleted file mode 100755 index 3a39651..0000000 --- a/all/modLoader.gsc +++ /dev/null @@ -1,141 +0,0 @@ -#include common_scripts/utility; -#include maps/mp/gametypes_zm/_hud_util; -#include maps/mp/zombies/_zm_utility; - -init() -{ - level thread onPlayerConnect(); -} - -onPlayerConnect() -{ - while(1) - { - level waittill("connected", player); - player thread onPlayerSpawned(); - } -} - -onPlayerSpawned() -{ - self endon("disconnect"); - level endon("game_ended"); - while(1) - { - self waittill("spawned_player"); - modLoader(self, level); - } -} - -/* - * Function Responsible for Loading the Mods - * comment with // the mods you want to disable - * and then compile with a gsc compiler. - */ -modLoader(p, l) -{ - // Waits for the black preload screen to pass so it can load the mods - flag_wait( "initial_blackscreen_passed" ); - - // Mod to Remove the Perk Limit - thread removePerkLimit(l); - - // Mod that adds a zombie counter to the bottom of the screen - p thread zombieCounter(p, l, 100, 190); - - // Mod that adds a health counter to the bottom of the screen - p thread healthCounter(p, -100, 190); -} - -/* - * Function that removes zombie limit - */ -removePerkLimit(l) -{ - l.perk_purchase_limit = 12; -} - -/* - * Function that draws a zombie counter - */ -zombieCounter(p, l, x, y) -{ - p.zombiecounter = drawCounter(p.zombiecounter, x, y); - - while(1) - { - p.zombiecounter.alpha = checkAfterlife(p); - - zombies = l.zombie_total + get_current_zombie_count(); - if ( zombies > 0 ) - { - p.zombiecounter.label = &"Zombies Left: ^1"; - } - else - { - p.zombiecounter.label = &"Zombies Left: ^6"; - } - - p.zombiecounter setvalue(zombies); - wait 0.05; - } -} - -/* - * Function that draws a health counter - */ -healthCounter(p, x, y) -{ - p.healthcounter = drawCounter(p.healthcounter, x, y); - - while(1) - { - p.healthcounter.alpha = checkAfterlife(p); - - // Setting Counter Colors - health = p.health; - if( health <= 15 ) - { - p.healthcounter.label = &"Health: ^1"; - } - else if ( health <= 50 ) - { - p.healthcounter.label = &"Health: ^3"; - } - else - { - p.healthcounter.label = &"Health: ^2"; - } - - p.healthcounter setValue(health); - wait 0.05; - } -} - - -// Aux Functions - -/* - * Draws the counter in desired position - */ -drawCounter(counterVar, x, y) -{ - counterVar = createfontstring( "Objective", 1.7 ); - counterVar setpoint( "CENTER", "CENTER", x, y); - counterVar.alpha = 1; - counterVar.hidewheninmenu = 1; - counterVar.hidewhendead = 1; - return counterVar; -} - -/* - * Checks if the player has entered afterlife - */ -checkAfterlife(p) -{ - if(isdefined(p.afterlife) && p.afterlife) - { - return 0.2; - } - return 1; -} diff --git a/counters/bothCounters.gsc b/counters/bothCounters.gsc deleted file mode 100755 index a932355..0000000 --- a/counters/bothCounters.gsc +++ /dev/null @@ -1,121 +0,0 @@ -#include common_scripts/utility; -#include maps/mp/gametypes_zm/_hud_util; -#include maps/mp/zombies/_zm_utility; - -init() -{ - level thread onPlayerConnect(); -} - -onPlayerConnect() -{ - while(1) - { - level waittill("connected", player); - player thread onPlayerSpawned(); - } -} - -onPlayerSpawned() -{ - self endon("disconnect"); - level endon("game_ended"); - while(1) - { - self waittill("spawned_player"); - - // Waits for the black preload screen to pass so it can load the mods - flag_wait( "initial_blackscreen_passed" ); - - // Mod that adds a zombie counter to the bottom of the screen - self thread zombieCounter(self, level, 100, 190); - - // Mod that adds a health counter to the bottom of the screen - self thread healthCounter(self, -100, 190); - } -} - -/* - * Function that draws a zombie counter - */ -zombieCounter(p, l, x, y) -{ - p.zombiecounter = drawCounter(p.zombiecounter, x, y); - - while(1) - { - p.zombiecounter.alpha = checkAfterlife(p); - - zombies = l.zombie_total + get_current_zombie_count(); - if ( zombies > 0 ) - { - p.zombiecounter.label = &"Zombies Left: ^1"; - } - else - { - p.zombiecounter.label = &"Zombies Left: ^6"; - } - - p.zombiecounter setvalue(zombies); - wait 0.05; - } -} - -/* - * Function that draws a health counter - */ -healthCounter(p, x, y) -{ - p.healthcounter = drawCounter(p.healthcounter, x, y); - - while(1) - { - p.healthcounter.alpha = checkAfterlife(p); - - // Setting Counter Colors - health = p.health; - if( health <= 15 ) - { - p.healthcounter.label = &"Health: ^1"; - } - else if ( health <= 50 ) - { - p.healthcounter.label = &"Health: ^3"; - } - else - { - p.healthcounter.label = &"Health: ^2"; - } - - p.healthcounter setValue(health); - wait 0.05; - } -} - - -// Aux Functions - -/* - * Draws the counter in desired position - */ -drawCounter(counterVar, x, y) -{ - counterVar = createfontstring( "Objective", 1.7 ); - counterVar setpoint( "CENTER", "CENTER", x, y); - counterVar.alpha = 1; - counterVar.hidewheninmenu = 1; - counterVar.hidewhendead = 1; - return counterVar; -} - -/* - * Checks if the player has entered afterlife - */ -checkAfterlife(p) -{ - if(isdefined(p.afterlife) && p.afterlife) - { - return 0.2; - } - return 1; -} diff --git a/counters/healthCounter.gsc b/counters/healthCounter.gsc deleted file mode 100755 index b93cb71..0000000 --- a/counters/healthCounter.gsc +++ /dev/null @@ -1,91 +0,0 @@ -#include common_scripts/utility; -#include maps/mp/gametypes_zm/_hud_util; -#include maps/mp/zombies/_zm_utility; - -init() -{ - level thread onPlayerConnect(); -} - -onPlayerConnect() -{ - while(1) - { - level waittill("connected", player); - player thread onPlayerSpawned(); - } -} - -onPlayerSpawned() -{ - self endon("disconnect"); - level endon("game_ended"); - while(1) - { - self waittill("spawned_player"); - - // Waits for the black preload screen to pass so it can load the mods - flag_wait( "initial_blackscreen_passed" ); - - // Mod that adds a health counter to the bottom of the screen - self thread healthCounter(self, 0, 190); - } -} - -/* - * Function that draws a health counter - */ -healthCounter(p, x, y) -{ - p.healthcounter = drawCounter(p.healthcounter, x, y); - - while(1) - { - p.healthcounter.alpha = checkAfterlife(p); - - // Setting Counter Colors - health = p.health; - if( health <= 15 ) - { - p.healthcounter.label = &"Health: ^1"; - } - else if ( health <= 50 ) - { - p.healthcounter.label = &"Health: ^3"; - } - else - { - p.healthcounter.label = &"Health: ^2"; - } - - p.healthcounter setValue(health); - wait 0.05; - } -} - -// Aux Functions - -/* - * Draws the counter in desired position - */ -drawCounter(counterVar, x, y) -{ - counterVar = createfontstring( "Objective", 1.7 ); - counterVar setpoint( "CENTER", "CENTER", x, y); - counterVar.alpha = 1; - counterVar.hidewheninmenu = 1; - counterVar.hidewhendead = 1; - return counterVar; -} - -/* - * Checks if the player has entered afterlife - */ -checkAfterlife(p) -{ - if(isdefined(p.afterlife) && p.afterlife) - { - return 0.2; - } - return 1; -} diff --git a/counters/zombieCounter.gsc b/counters/zombieCounter.gsc deleted file mode 100755 index a89a7b8..0000000 --- a/counters/zombieCounter.gsc +++ /dev/null @@ -1,87 +0,0 @@ -#include common_scripts/utility; -#include maps/mp/gametypes_zm/_hud_util; -#include maps/mp/zombies/_zm_utility; - -init() -{ - level thread onPlayerConnect(); -} - -onPlayerConnect() -{ - while(1) - { - level waittill("connected", player); - player thread onPlayerSpawned(); - } -} - -onPlayerSpawned() -{ - self endon("disconnect"); - level endon("game_ended"); - while(1) - { - self waittill("spawned_player"); - - // Waits for the black preload screen to pass so it can load the mods - flag_wait( "initial_blackscreen_passed" ); - - // Mod that adds a zombie counter to the bottom of the screen - self thread zombieCounter(self, level, 0, 190); - } -} - -/* - * Function that draws a zombie counter - */ -zombieCounter(p, l, x, y) -{ - p.zombiecounter = drawCounter(p.zombiecounter, x, y); - - while(1) - { - p.zombiecounter.alpha = checkAfterlife(p); - - zombies = l.zombie_total + get_current_zombie_count(); - if ( zombies > 0 ) - { - p.zombiecounter.label = &"Zombies Left: ^1"; - } - else - { - p.zombiecounter.label = &"Zombies Left: ^6"; - } - - p.zombiecounter setvalue(zombies); - wait 0.05; - } -} - - -// Aux Functions - -/* - * Draws the counter in desired position - */ -drawCounter(counterVar, x, y) -{ - counterVar = createfontstring( "Objective", 1.7 ); - counterVar setpoint( "CENTER", "CENTER", x, y); - counterVar.alpha = 1; - counterVar.hidewheninmenu = 1; - counterVar.hidewhendead = 1; - return counterVar; -} - -/* - * Checks if the player has entered afterlife - */ -checkAfterlife(p) -{ - if(isdefined(p.afterlife) && p.afterlife) - { - return 0.2; - } - return 1; -} diff --git a/mods/all/modLoader.gsc b/mods/all/modLoader.gsc new file mode 100755 index 0000000..060d6c1 --- /dev/null +++ b/mods/all/modLoader.gsc @@ -0,0 +1,337 @@ +#include common_scripts/utility; +#include maps/mp/gametypes_zm/_hud_util; +#include maps/mp/zombies/_zm_utility; +#include maps/mp/zombies/_zm_perks; + +init() +{ + level thread onPlayerConnect(); +} + +onPlayerConnect() +{ + while(1) + { + level waittill("connected", player); + player thread onPlayerSpawned(); + } +} + +onPlayerSpawned() +{ + self endon("disconnect"); + level endon("game_ended"); + while(1) + { + self waittill("spawned_player"); + modLoader(self, level); + } +} + +/* + * Function Responsible for Loading the Mods + * comment with // the mods you want to disable + * and then compile with a gsc compiler. + */ +modLoader(p, l) +{ + // Preloads tombstone before black screen after loading the map + activateTombstone(level); + + // Waits for the black preload screen to pass so it can load the mods + flag_wait( "initial_blackscreen_passed" ); + + // Mod to Remove the Perk Limit + thread removePerkLimit(l); + + // Mod that adds a zombie counter to the bottom of the screen + p thread zombieCounter(p, l, 100, 190); + + // Mod that adds a health counter to the bottom of the screen + p thread healthCounter(p, -100, 190); +} + +/* + * Function that removes zombie limit + */ +removePerkLimit(l) +{ + l.perk_purchase_limit = 12; +} + +/* + * Function that draws a zombie counter + */ +zombieCounter(p, l, x, y) +{ + p.zombiecounter = drawCounter(p.zombiecounter, x, y); + + while(1) + { + p.zombiecounter.alpha = checkAfterlife(p); + + zombies = l.zombie_total + get_current_zombie_count(); + if ( zombies > 0 ) + { + p.zombiecounter.label = &"Zombies Left: ^1"; + } + else + { + p.zombiecounter.label = &"Zombies Left: ^6"; + } + + p.zombiecounter setvalue(zombies); + wait 0.05; + } +} + +/* + * Function that draws a health counter + */ +healthCounter(p, x, y) +{ + p.healthcounter = drawCounter(p.healthcounter, x, y); + + while(1) + { + p.healthcounter.alpha = checkAfterlife(p); + + // Setting Counter Colors + health = p.health; + if( health <= 15 ) + { + p.healthcounter.label = &"Health: ^1"; + } + else if ( health <= 50 ) + { + p.healthcounter.label = &"Health: ^3"; + } + else + { + p.healthcounter.label = &"Health: ^2"; + } + + p.healthcounter setValue(health); + wait 0.05; + } +} + +/* + * Function that activates solo tombstone perk + */ +activateTombstone(l) +{ + if (isDefined(l.zombiemode_using_tombstone_perk) && l.zombiemode_using_tombstone_perk) + { + l thread perk_machine_spawn_init(); + thread solo_tombstone_removal(); + thread turn_tombstone_on(); + } +} + + +// Aux Functions + +/* + * Draws the counter in desired position + */ +drawCounter(counterVar, x, y) +{ + counterVar = createfontstring( "Objective", 1.7 ); + counterVar setpoint( "CENTER", "CENTER", x, y); + counterVar.alpha = 1; + counterVar.hidewheninmenu = 1; + counterVar.hidewhendead = 1; + return counterVar; +} + +/* + * Checks if the player has entered afterlife + */ +checkAfterlife(p) +{ + if(isdefined(p.afterlife) && p.afterlife) + { + return 0.2; + } + return 1; +} + +/* + * Initializes perk machine spawn and location + */ +perk_machine_spawn_init() +{ + match_string = ""; + location = level.scr_zm_map_start_location; + if ( location != "default" && location == "" && isDefined( level.default_start_location ) ) + { + location = level.default_start_location; + } + match_string = ( level.scr_zm_ui_gametype + "_perks_" ) + location; + pos = []; + if ( isDefined( level.override_perk_targetname ) ) + { + structs = getstructarray( level.override_perk_targetname, "targetname" ); + } + else + { + structs = getstructarray( "zm_perk_machine", "targetname" ); + } + _a3578 = structs; + _k3578 = getFirstArrayKey( _a3578 ); + while ( isDefined( _k3578 ) ) + { + struct = _a3578[ _k3578 ]; + if ( isDefined( struct.script_string ) ) + { + tokens = strtok( struct.script_string, " " ); + _a3583 = tokens; + _k3583 = getFirstArrayKey( _a3583 ); + while ( isDefined( _k3583 ) ) + { + token = _a3583[ _k3583 ]; + if ( token == match_string ) + { + pos[ pos.size ] = struct; + } + _k3583 = getNextArrayKey( _a3583, _k3583 ); + } + } + else pos[ pos.size ] = struct; + _k3578 = getNextArrayKey( _a3578, _k3578 ); + } + if ( !isDefined( pos ) || pos.size == 0 ) + { + return; + } + precachemodel( "zm_collision_perks1" ); + i = 0; + while ( i < pos.size ) + { + perk = pos[ i ].script_noteworthy; + if ( isDefined( perk ) && isDefined( pos[ i ].model ) ) + { + use_trigger = spawn( "trigger_radius_use", pos[ i ].origin + vectorScale( ( 0, -1, 0 ), 30 ), 0, 40, 70 ); + use_trigger.targetname = "zombie_vending"; + use_trigger.script_noteworthy = perk; + use_trigger triggerignoreteam(); + perk_machine = spawn( "script_model", pos[ i ].origin ); + perk_machine.angles = pos[ i ].angles; + perk_machine setmodel( pos[ i ].model ); + if ( isDefined( level._no_vending_machine_bump_trigs ) && level._no_vending_machine_bump_trigs ) + { + bump_trigger = undefined; + } + else + { + bump_trigger = spawn( "trigger_radius", pos[ i ].origin, 0, 35, 64 ); + bump_trigger.script_activated = 1; + bump_trigger.script_sound = "zmb_perks_bump_bottle"; + bump_trigger.targetname = "audio_bump_trigger"; + if ( perk != "specialty_weapupgrade" ) + { + bump_trigger thread thread_bump_trigger(); + } + } + collision = spawn( "script_model", pos[ i ].origin, 1 ); + collision.angles = pos[ i ].angles; + collision setmodel( "zm_collision_perks1" ); + collision.script_noteworthy = "clip"; + collision disconnectpaths(); + use_trigger.clip = collision; + use_trigger.machine = perk_machine; + use_trigger.bump = bump_trigger; + if ( isDefined( pos[ i ].blocker_model ) ) + { + use_trigger.blocker_model = pos[ i ].blocker_model; + } + if ( isDefined( pos[ i ].script_int ) ) + { + perk_machine.script_int = pos[ i ].script_int; + } + if ( isDefined( pos[ i ].turn_on_notify ) ) + { + perk_machine.turn_on_notify = pos[ i ].turn_on_notify; + } + if ( perk == "specialty_scavenger" || perk == "specialty_scavenger_upgrade" ) + { + use_trigger.script_sound = "mus_perks_tombstone_jingle"; + use_trigger.script_string = "tombstone_perk"; + use_trigger.script_label = "mus_perks_tombstone_sting"; + use_trigger.target = "vending_tombstone"; + perk_machine.script_string = "tombstone_perk"; + perk_machine.targetname = "vending_tombstone"; + if ( isDefined( bump_trigger ) ) + { + bump_trigger.script_string = "tombstone_perk"; + } + } + if ( isDefined( level._custom_perks[ perk ] ) && isDefined( level._custom_perks[ perk ].perk_machine_set_kvps ) ) + { + [[ level._custom_perks[ perk ].perk_machine_set_kvps ]]( use_trigger, perk_machine, bump_trigger, collision ); + } + } + i++; + } +} + +/* + * Allows notifies of solo tombstone + */ +solo_tombstone_removal() +{ + notify( "tombstone_on" ); +} + +/* + * Turns tombstone on + */ +turn_tombstone_on() +{ + while ( 1 ) + { + machine = getentarray( "vending_tombstone", "targetname" ); + machine_triggers = getentarray( "vending_tombstone", "target" ); + i = 0; + while ( i < machine.size ) + { + machine[ i ] setmodel( level.machine_assets[ "tombstone" ].off_model ); + i++; + } + level thread do_initial_power_off_callback( machine, "tombstone" ); + array_thread( machine_triggers, ::set_power_on, 0 ); + level waittill( "tombstone_on" ); + i = 0; + while ( i < machine.size ) + { + machine[ i ] setmodel( level.machine_assets[ "tombstone" ].on_model ); + machine[ i ] vibrate( vectorScale( ( 0, -1, 0 ), 100 ), 0,3, 0,4, 3 ); + machine[ i ] playsound( "zmb_perks_power_on" ); + machine[ i ] thread perk_fx( "tombstone_light" ); + machine[ i ] thread play_loop_on_machine(); + i++; + } + level notify( "specialty_scavenger_power_on" ); + array_thread( machine_triggers, ::set_power_on, 1 ); + if ( isDefined( level.machine_assets[ "tombstone" ].power_on_callback ) ) + { + array_thread( machine, level.machine_assets[ "tombstone" ].power_on_callback ); + } + level waittill( "tombstone_off" ); + if ( isDefined( level.machine_assets[ "tombstone" ].power_off_callback ) ) + { + array_thread( machine, level.machine_assets[ "tombstone" ].power_off_callback ); + } + array_thread( machine, ::turn_perk_off ); + players = get_players(); + _a1718 = players; + _k1718 = getFirstArrayKey( _a1718 ); + while ( isDefined( _k1718 ) ) + { + player = _a1718[ _k1718 ]; + player.hasperkspecialtytombstone = undefined; + _k1718 = getNextArrayKey( _a1718, _k1718 ); + } + } +} diff --git a/mods/counters/bothCounters.gsc b/mods/counters/bothCounters.gsc new file mode 100755 index 0000000..a2f944d --- /dev/null +++ b/mods/counters/bothCounters.gsc @@ -0,0 +1,121 @@ +#include common_scripts/utility; +#include maps/mp/gametypes_zm/_hud_util; +#include maps/mp/zombies/_zm_utility; + +init() +{ + level thread onPlayerConnect(); +} + +onPlayerConnect() +{ + while(1) + { + level waittill("connected", player); + player thread onPlayerSpawned(); + } +} + +onPlayerSpawned() +{ + self endon("disconnect"); + level endon("game_ended"); + while(1) + { + self waittill("spawned_player"); + + // Waits for the black preload screen to pass so it can load the mods + flag_wait( "initial_blackscreen_passed" ); + + // Mod that adds a zombie counter to the bottom of the screen + self thread zombieCounter(self, level, 100, 190); + + // Mod that adds a health counter to the bottom of the screen + self thread healthCounter(self, -100, 190); + } +} + +/* + * Function that draws a zombie counter + */ +zombieCounter(p, l, x, y) +{ + p.zombiecounter = drawCounter(p.zombiecounter, x, y); + + while(1) + { + p.zombiecounter.alpha = checkAfterlife(p); + + zombies = l.zombie_total + get_current_zombie_count(); + if ( zombies > 0 ) + { + p.zombiecounter.label = &"Zombies Left: ^1"; + } + else + { + p.zombiecounter.label = &"Zombies Left: ^6"; + } + + p.zombiecounter setvalue(zombies); + wait 0.05; + } +} + +/* + * Function that draws a health counter + */ +healthCounter(p, x, y) +{ + p.healthcounter = drawCounter(p.healthcounter, x, y); + + while(1) + { + p.healthcounter.alpha = checkAfterlife(p); + + // Setting Counter Colors + health = p.health; + if( health <= 15 ) + { + p.healthcounter.label = &"Health: ^1"; + } + else if ( health <= 50 ) + { + p.healthcounter.label = &"Health: ^3"; + } + else + { + p.healthcounter.label = &"Health: ^2"; + } + + p.healthcounter setValue(health); + wait 0.05; + } +} + + +// Aux Functions + +/* + * Draws the counter in desired position + */ +drawCounter(counterVar, x, y) +{ + counterVar = createfontstring( "Objective", 1.7 ); + counterVar setpoint( "CENTER", "CENTER", x, y); + counterVar.alpha = 1; + counterVar.hidewheninmenu = 1; + counterVar.hidewhendead = 1; + return counterVar; +} + +/* + * Checks if the player has entered afterlife + */ +checkAfterlife(p) +{ + if(isdefined(p.afterlife) && p.afterlife) + { + return 0.2; + } + return 1; +} diff --git a/mods/counters/healthCounter.gsc b/mods/counters/healthCounter.gsc new file mode 100755 index 0000000..5b8f490 --- /dev/null +++ b/mods/counters/healthCounter.gsc @@ -0,0 +1,91 @@ +#include common_scripts/utility; +#include maps/mp/gametypes_zm/_hud_util; +#include maps/mp/zombies/_zm_utility; + +init() +{ + level thread onPlayerConnect(); +} + +onPlayerConnect() +{ + while(1) + { + level waittill("connected", player); + player thread onPlayerSpawned(); + } +} + +onPlayerSpawned() +{ + self endon("disconnect"); + level endon("game_ended"); + while(1) + { + self waittill("spawned_player"); + + // Waits for the black preload screen to pass so it can load the mods + flag_wait( "initial_blackscreen_passed" ); + + // Mod that adds a health counter to the bottom of the screen + self thread healthCounter(self, 0, 190); + } +} + +/* + * Function that draws a health counter + */ +healthCounter(p, x, y) +{ + p.healthcounter = drawCounter(p.healthcounter, x, y); + + while(1) + { + p.healthcounter.alpha = checkAfterlife(p); + + // Setting Counter Colors + health = p.health; + if( health <= 15 ) + { + p.healthcounter.label = &"Health: ^1"; + } + else if ( health <= 50 ) + { + p.healthcounter.label = &"Health: ^3"; + } + else + { + p.healthcounter.label = &"Health: ^2"; + } + + p.healthcounter setValue(health); + wait 0.05; + } +} + +// Aux Functions + +/* + * Draws the counter in desired position + */ +drawCounter(counterVar, x, y) +{ + counterVar = createfontstring( "Objective", 1.7 ); + counterVar setpoint( "CENTER", "CENTER", x, y); + counterVar.alpha = 1; + counterVar.hidewheninmenu = 1; + counterVar.hidewhendead = 1; + return counterVar; +} + +/* + * Checks if the player has entered afterlife + */ +checkAfterlife(p) +{ + if(isdefined(p.afterlife) && p.afterlife) + { + return 0.2; + } + return 1; +} diff --git a/mods/counters/zombieCounter.gsc b/mods/counters/zombieCounter.gsc new file mode 100755 index 0000000..3ea7557 --- /dev/null +++ b/mods/counters/zombieCounter.gsc @@ -0,0 +1,87 @@ +#include common_scripts/utility; +#include maps/mp/gametypes_zm/_hud_util; +#include maps/mp/zombies/_zm_utility; + +init() +{ + level thread onPlayerConnect(); +} + +onPlayerConnect() +{ + while(1) + { + level waittill("connected", player); + player thread onPlayerSpawned(); + } +} + +onPlayerSpawned() +{ + self endon("disconnect"); + level endon("game_ended"); + while(1) + { + self waittill("spawned_player"); + + // Waits for the black preload screen to pass so it can load the mods + flag_wait( "initial_blackscreen_passed" ); + + // Mod that adds a zombie counter to the bottom of the screen + self thread zombieCounter(self, level, 0, 190); + } +} + +/* + * Function that draws a zombie counter + */ +zombieCounter(p, l, x, y) +{ + p.zombiecounter = drawCounter(p.zombiecounter, x, y); + + while(1) + { + p.zombiecounter.alpha = checkAfterlife(p); + + zombies = l.zombie_total + get_current_zombie_count(); + if ( zombies > 0 ) + { + p.zombiecounter.label = &"Zombies Left: ^1"; + } + else + { + p.zombiecounter.label = &"Zombies Left: ^6"; + } + + p.zombiecounter setvalue(zombies); + wait 0.05; + } +} + + +// Aux Functions + +/* + * Draws the counter in desired position + */ +drawCounter(counterVar, x, y) +{ + counterVar = createfontstring( "Objective", 1.7 ); + counterVar setpoint( "CENTER", "CENTER", x, y); + counterVar.alpha = 1; + counterVar.hidewheninmenu = 1; + counterVar.hidewhendead = 1; + return counterVar; +} + +/* + * Checks if the player has entered afterlife + */ +checkAfterlife(p) +{ + if(isdefined(p.afterlife) && p.afterlife) + { + return 0.2; + } + return 1; +} diff --git a/mods/perks/noPerkLimit.gsc b/mods/perks/noPerkLimit.gsc new file mode 100755 index 0000000..b266218 --- /dev/null +++ b/mods/perks/noPerkLimit.gsc @@ -0,0 +1,32 @@ +#include common_scripts/utility; +#include maps/mp/zombies/_zm_utility; + +init() +{ + level thread onPlayerConnect(); +} + +onPlayerConnect() +{ + while(1) + { + level waittill("connected", player); + player thread onPlayerSpawned(); + } +} + +onPlayerSpawned() +{ + self endon("disconnect"); + level endon("game_ended"); + while(1) + { + self waittill("spawned_player"); + + // Waits for the black preload screen to pass so it can load the mods + flag_wait( "initial_blackscreen_passed" ); + + // Mod to Remove the Perk Limit + level.perk_purchase_limit = 12; + } +} diff --git a/mods/perks/tombstoneSolo.gsc b/mods/perks/tombstoneSolo.gsc new file mode 100755 index 0000000..544a035 --- /dev/null +++ b/mods/perks/tombstoneSolo.gsc @@ -0,0 +1,221 @@ +#include common_scripts/utility; +#include maps/mp/zombies/_zm_utility; +#include maps/mp/zombies/_zm_perks; + +init() +{ + level thread onPlayerConnect(); +} + +onPlayerConnect() +{ + while(1) + { + level waittill("connected", player); + player thread onPlayerSpawned(); + } +} + +onPlayerSpawned() +{ + self endon("disconnect"); + level endon("game_ended"); + while(1) + { + self waittill("spawned_player"); + + activateTombstone(level); + + // Waits for the black preload screen to pass so it can load the mods + flag_wait( "initial_blackscreen_passed" ); + } +} + +activateTombstone(l) +{ + if (isDefined(l.zombiemode_using_tombstone_perk) && l.zombiemode_using_tombstone_perk) + { + l thread perk_machine_spawn_init(); + thread solo_tombstone_removal(); + thread turn_tombstone_on(); + } +} + +/* + * Initializes perk machine spawn and location + */ +perk_machine_spawn_init() +{ + match_string = ""; + location = level.scr_zm_map_start_location; + if ( location != "default" && location == "" && isDefined( level.default_start_location ) ) + { + location = level.default_start_location; + } + match_string = ( level.scr_zm_ui_gametype + "_perks_" ) + location; + pos = []; + if ( isDefined( level.override_perk_targetname ) ) + { + structs = getstructarray( level.override_perk_targetname, "targetname" ); + } + else + { + structs = getstructarray( "zm_perk_machine", "targetname" ); + } + _a3578 = structs; + _k3578 = getFirstArrayKey( _a3578 ); + while ( isDefined( _k3578 ) ) + { + struct = _a3578[ _k3578 ]; + if ( isDefined( struct.script_string ) ) + { + tokens = strtok( struct.script_string, " " ); + _a3583 = tokens; + _k3583 = getFirstArrayKey( _a3583 ); + while ( isDefined( _k3583 ) ) + { + token = _a3583[ _k3583 ]; + if ( token == match_string ) + { + pos[ pos.size ] = struct; + } + _k3583 = getNextArrayKey( _a3583, _k3583 ); + } + } + else pos[ pos.size ] = struct; + _k3578 = getNextArrayKey( _a3578, _k3578 ); + } + if ( !isDefined( pos ) || pos.size == 0 ) + { + return; + } + precachemodel( "zm_collision_perks1" ); + i = 0; + while ( i < pos.size ) + { + perk = pos[ i ].script_noteworthy; + if ( isDefined( perk ) && isDefined( pos[ i ].model ) ) + { + use_trigger = spawn( "trigger_radius_use", pos[ i ].origin + vectorScale( ( 0, -1, 0 ), 30 ), 0, 40, 70 ); + use_trigger.targetname = "zombie_vending"; + use_trigger.script_noteworthy = perk; + use_trigger triggerignoreteam(); + perk_machine = spawn( "script_model", pos[ i ].origin ); + perk_machine.angles = pos[ i ].angles; + perk_machine setmodel( pos[ i ].model ); + if ( isDefined( level._no_vending_machine_bump_trigs ) && level._no_vending_machine_bump_trigs ) + { + bump_trigger = undefined; + } + else + { + bump_trigger = spawn( "trigger_radius", pos[ i ].origin, 0, 35, 64 ); + bump_trigger.script_activated = 1; + bump_trigger.script_sound = "zmb_perks_bump_bottle"; + bump_trigger.targetname = "audio_bump_trigger"; + if ( perk != "specialty_weapupgrade" ) + { + bump_trigger thread thread_bump_trigger(); + } + } + collision = spawn( "script_model", pos[ i ].origin, 1 ); + collision.angles = pos[ i ].angles; + collision setmodel( "zm_collision_perks1" ); + collision.script_noteworthy = "clip"; + collision disconnectpaths(); + use_trigger.clip = collision; + use_trigger.machine = perk_machine; + use_trigger.bump = bump_trigger; + if ( isDefined( pos[ i ].blocker_model ) ) + { + use_trigger.blocker_model = pos[ i ].blocker_model; + } + if ( isDefined( pos[ i ].script_int ) ) + { + perk_machine.script_int = pos[ i ].script_int; + } + if ( isDefined( pos[ i ].turn_on_notify ) ) + { + perk_machine.turn_on_notify = pos[ i ].turn_on_notify; + } + if ( perk == "specialty_scavenger" || perk == "specialty_scavenger_upgrade" ) + { + use_trigger.script_sound = "mus_perks_tombstone_jingle"; + use_trigger.script_string = "tombstone_perk"; + use_trigger.script_label = "mus_perks_tombstone_sting"; + use_trigger.target = "vending_tombstone"; + perk_machine.script_string = "tombstone_perk"; + perk_machine.targetname = "vending_tombstone"; + if ( isDefined( bump_trigger ) ) + { + bump_trigger.script_string = "tombstone_perk"; + } + } + if ( isDefined( level._custom_perks[ perk ] ) && isDefined( level._custom_perks[ perk ].perk_machine_set_kvps ) ) + { + [[ level._custom_perks[ perk ].perk_machine_set_kvps ]]( use_trigger, perk_machine, bump_trigger, collision ); + } + } + i++; + } +} + +/* + * Allows notifies of solo tombstone + */ +solo_tombstone_removal() +{ + notify( "tombstone_on" ); +} + +/* + * Turns tombstone on + */ +turn_tombstone_on() +{ + while ( 1 ) + { + machine = getentarray( "vending_tombstone", "targetname" ); + machine_triggers = getentarray( "vending_tombstone", "target" ); + i = 0; + while ( i < machine.size ) + { + machine[ i ] setmodel( level.machine_assets[ "tombstone" ].off_model ); + i++; + } + level thread do_initial_power_off_callback( machine, "tombstone" ); + array_thread( machine_triggers, ::set_power_on, 0 ); + level waittill( "tombstone_on" ); + i = 0; + while ( i < machine.size ) + { + machine[ i ] setmodel( level.machine_assets[ "tombstone" ].on_model ); + machine[ i ] vibrate( vectorScale( ( 0, -1, 0 ), 100 ), 0,3, 0,4, 3 ); + machine[ i ] playsound( "zmb_perks_power_on" ); + machine[ i ] thread perk_fx( "tombstone_light" ); + machine[ i ] thread play_loop_on_machine(); + i++; + } + level notify( "specialty_scavenger_power_on" ); + array_thread( machine_triggers, ::set_power_on, 1 ); + if ( isDefined( level.machine_assets[ "tombstone" ].power_on_callback ) ) + { + array_thread( machine, level.machine_assets[ "tombstone" ].power_on_callback ); + } + level waittill( "tombstone_off" ); + if ( isDefined( level.machine_assets[ "tombstone" ].power_off_callback ) ) + { + array_thread( machine, level.machine_assets[ "tombstone" ].power_off_callback ); + } + array_thread( machine, ::turn_perk_off ); + players = get_players(); + _a1718 = players; + _k1718 = getFirstArrayKey( _a1718 ); + while ( isDefined( _k1718 ) ) + { + player = _a1718[ _k1718 ]; + player.hasperkspecialtytombstone = undefined; + _k1718 = getNextArrayKey( _a1718, _k1718 ); + } + } +} diff --git a/perks/noPerkLimit.gsc b/perks/noPerkLimit.gsc deleted file mode 100755 index ac3cce0..0000000 --- a/perks/noPerkLimit.gsc +++ /dev/null @@ -1,33 +0,0 @@ -#include common_scripts/utility; -#include maps/mp/gametypes_zm/_hud_util; -#include maps/mp/zombies/_zm_utility; - -init() -{ - level thread onPlayerConnect(); -} - -onPlayerConnect() -{ - while(1) - { - level waittill("connected", player); - player thread onPlayerSpawned(); - } -} - -onPlayerSpawned() -{ - self endon("disconnect"); - level endon("game_ended"); - while(1) - { - self waittill("spawned_player"); - - // Waits for the black preload screen to pass so it can load the mods - flag_wait( "initial_blackscreen_passed" ); - - // Mod to Remove the Perk Limit - level.perk_purchase_limit = 12; - } -} -- cgit v1.2.3