From 539e15d7f51b2deb7b2c4b73e407354b343226cb Mon Sep 17 00:00:00 2001 From: Jbleezy Date: Fri, 7 Apr 2023 09:56:26 -0700 Subject: [PATCH] All quests give players all perks on completion --- README.md | 3 ++- scripts/zm/replaced/_zm_sq.gsc | 26 +++++++++++++++++++ scripts/zm/replaced/zm_buried_sq.gsc | 18 +++++++++++++ scripts/zm/replaced/zm_highrise_sq.gsc | 13 +++------- scripts/zm/replaced/zm_prison_sq_final.gsc | 10 +++++++ .../zm/replaced/zm_tomb_ee_main_step_8.gsc | 9 +++++++ scripts/zm/replaced/zm_transit_sq.gsc | 21 +++++---------- scripts/zm/zm_buried/zm_buried_reimagined.gsc | 2 ++ 8 files changed, 77 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index b0737809..f50c3b3e 100644 --- a/README.md +++ b/README.md @@ -469,6 +469,7 @@ ## Maps * All quests can be completed with any amount of players +* All quests give players all perks on completion ### Tranzit * Any door that requires a Turbine to open is automatically open whenever the power is on @@ -488,7 +489,6 @@ * Zombies spawn in the Warehouse zone when in the Outside Power Station zone before the Warehouse door is opened * Zombies spawn in the Outside Power Station zone when in the Fog After Power Station zone * Zombies spawn in the Warehouse zone when in the Fog After Power Station zone -* Quest: players gain all perks on completion * Quest (Maxis): Avogadro step only requires 1 Turbine under the pylon * Quest (Maxis): Turbine can get destroyed by the EMP during the Avogadro step and it will still count as completed * Quest (Maxis): lamp posts step requires all 8 lamp posts to get powered by a Turbine @@ -609,6 +609,7 @@ * Added buildable table hint strings on buildable purchase * Quest: all 5 signs must be meleed for wisp to spawn * Quest: changed number of targets that need to be hit to 20 multiplied by the amount of player +* Quest: perks given on completion are no longer permament * Quest: completion button always activatable after completing the quest * Quest (Maxis): no longer need to activate the Time Bomb to be able to spawn the 2nd wisp * Quest (Maxis): no longer need to activate the lever in the Mansion before activating the bells diff --git a/scripts/zm/replaced/_zm_sq.gsc b/scripts/zm/replaced/_zm_sq.gsc index 3855217d..6a8c73ef 100644 --- a/scripts/zm/replaced/_zm_sq.gsc +++ b/scripts/zm/replaced/_zm_sq.gsc @@ -40,4 +40,30 @@ navcomputer_waitfor_navcard() } } } +} + +sq_give_player_all_perks() +{ + machines = array_randomize( getentarray( "zombie_vending", "targetname" ) ); + perks = []; + + for ( i = 0; i < machines.size; i++ ) + { + if ( machines[i].script_noteworthy == "specialty_weapupgrade" ) + continue; + + perks[perks.size] = machines[i].script_noteworthy; + } + + foreach ( perk in perks ) + { + if ( isdefined( self.perk_purchased ) && self.perk_purchased == perk ) + continue; + + if ( self hasperk( perk ) || self maps\mp\zombies\_zm_perks::has_perk_paused( perk ) ) + continue; + + self maps\mp\zombies\_zm_perks::give_perk( perk, 0 ); + wait 0.25; + } } \ No newline at end of file diff --git a/scripts/zm/replaced/zm_buried_sq.gsc b/scripts/zm/replaced/zm_buried_sq.gsc index eb07fdb2..9882889e 100644 --- a/scripts/zm/replaced/zm_buried_sq.gsc +++ b/scripts/zm/replaced/zm_buried_sq.gsc @@ -116,4 +116,22 @@ richtofen_zombie_deathfunction_override() } return self [[ self.deathfunction_old ]](); +} + +sq_give_player_rewards() +{ + players = get_players(); + + foreach ( player in players ) + { + if ( is_player_valid( player ) ) + { + player thread scripts\zm\replaced\_zm_sq::sq_give_player_all_perks(); + } + } +} + +mule_kick_allows_4_weapons() +{ + level.additionalprimaryweapon_limit = 4; } \ No newline at end of file diff --git a/scripts/zm/replaced/zm_highrise_sq.gsc b/scripts/zm/replaced/zm_highrise_sq.gsc index e71b6df4..ab84f802 100644 --- a/scripts/zm/replaced/zm_highrise_sq.gsc +++ b/scripts/zm/replaced/zm_highrise_sq.gsc @@ -187,6 +187,8 @@ sq_give_all_perks() sq_give_player_perks( perks, v_fireball_start_loc, n_fireball_exploder ) { + self endon("disconnect"); + exploder( n_fireball_exploder ); m_fireball = spawn( "script_model", v_fireball_start_loc ); m_fireball setmodel( "tag_origin" ); @@ -208,15 +210,8 @@ sq_give_player_perks( perks, v_fireball_start_loc, n_fireball_exploder ) m_fireball delete(); level notify( "sq_fireball_hit_player" ); - foreach ( perk in perks ) + if ( is_player_valid( self ) ) { - if ( isdefined( self.perk_purchased ) && self.perk_purchased == perk ) - continue; - - if ( self hasperk( perk ) || self maps\mp\zombies\_zm_perks::has_perk_paused( perk ) ) - continue; - - self maps\mp\zombies\_zm_perks::give_perk( perk, 0 ); - wait 0.25; + self thread scripts\zm\replaced\_zm_sq::sq_give_player_all_perks(); } } \ No newline at end of file diff --git a/scripts/zm/replaced/zm_prison_sq_final.gsc b/scripts/zm/replaced/zm_prison_sq_final.gsc index 3c3b2aa5..22375b21 100644 --- a/scripts/zm/replaced/zm_prison_sq_final.gsc +++ b/scripts/zm/replaced/zm_prison_sq_final.gsc @@ -75,6 +75,16 @@ stage_two() t_plane_fly_afterlife = getent( "plane_fly_afterlife_trigger", "script_noteworthy" ); t_plane_fly_afterlife playsound( "zmb_easteregg_laugh" ); t_plane_fly_afterlife trigger_on(); + + players = get_players(); + + foreach ( player in players ) + { + if ( is_player_valid( player ) ) + { + player thread scripts\zm\replaced\_zm_sq::sq_give_player_all_perks(); + } + } } final_flight_trigger() diff --git a/scripts/zm/replaced/zm_tomb_ee_main_step_8.gsc b/scripts/zm/replaced/zm_tomb_ee_main_step_8.gsc index 5e1c5726..2c943bd4 100644 --- a/scripts/zm/replaced/zm_tomb_ee_main_step_8.gsc +++ b/scripts/zm/replaced/zm_tomb_ee_main_step_8.gsc @@ -52,6 +52,15 @@ stage_logic() wait 1; level thread ee_samantha_say( "vox_sam_all_staff_freedom_0" ); + players = get_players(); + foreach ( player in players ) + { + if ( is_player_valid( player ) ) + { + player thread scripts\zm\replaced\_zm_sq::sq_give_player_all_perks(); + } + } + t_portal = tomb_spawn_trigger_radius( s_pos.origin, 100, 1 ); t_portal.hint_string = &"ZM_TOMB_TELE"; t_portal thread waittill_player_activates(); diff --git a/scripts/zm/replaced/zm_transit_sq.gsc b/scripts/zm/replaced/zm_transit_sq.gsc index f48d2065..2f7da3ef 100644 --- a/scripts/zm/replaced/zm_transit_sq.gsc +++ b/scripts/zm/replaced/zm_transit_sq.gsc @@ -277,23 +277,14 @@ set_screecher_zone_origin_and_notify( script_noteworthy, notify_str ) droppowerup( story ) { - vending_triggers = getentarray( "zombie_vending", "targetname" ); - perks = []; + players = get_players(); - for ( i = 0; i < vending_triggers.size; i++ ) + foreach ( player in players ) { - perk = vending_triggers[i].script_noteworthy; - - if ( perk == "specialty_weapupgrade" ) - continue; - - perks[perks.size] = perk; - } - - players = get_players(); - foreach ( player in players ) - { - player thread sq_give_player_perks( perks ); + if ( is_player_valid( player ) ) + { + player thread scripts\zm\replaced\_zm_sq::sq_give_player_all_perks(); + } } center_struct = getstruct( "sq_common_tower_fx", "targetname" ); diff --git a/scripts/zm/zm_buried/zm_buried_reimagined.gsc b/scripts/zm/zm_buried/zm_buried_reimagined.gsc index 9d3c3548..376b58ba 100644 --- a/scripts/zm/zm_buried/zm_buried_reimagined.gsc +++ b/scripts/zm/zm_buried/zm_buried_reimagined.gsc @@ -34,6 +34,8 @@ main() replaceFunc(maps\mp\zm_buried_fountain::transport_player_to_start_zone, scripts\zm\replaced\zm_buried_fountain::transport_player_to_start_zone); replaceFunc(maps\mp\zm_buried_sq::sq_metagame, scripts\zm\replaced\zm_buried_sq::sq_metagame); replaceFunc(maps\mp\zm_buried_sq::make_richtofen_zombie, scripts\zm\replaced\zm_buried_sq::make_richtofen_zombie); + replaceFunc(maps\mp\zm_buried_sq::sq_give_player_rewards, scripts\zm\replaced\zm_buried_sq::sq_give_player_rewards); + replaceFunc(maps\mp\zm_buried_sq::mule_kick_allows_4_weapons, scripts\zm\replaced\zm_buried_sq::mule_kick_allows_4_weapons); replaceFunc(maps\mp\zm_buried_sq_bt::stage_vo_watch_gallows, scripts\zm\replaced\zm_buried_sq_bt::stage_vo_watch_gallows); replaceFunc(maps\mp\zm_buried_sq_bt::stage_vo_watch_guillotine, scripts\zm\replaced\zm_buried_sq_bt::stage_vo_watch_guillotine); replaceFunc(maps\mp\zm_buried_sq_ts::ts_sign_damage_watch, scripts\zm\replaced\zm_buried_sq_ts::ts_sign_damage_watch);