shaders are not included.
Updated HUD for danke display effect. Looks similar to BO2/3, gussssttttaaaaaaa.
Copy _zombiemode_powerups.gsc to your mods folder (or edit it from raw, don't really care, that's your call).
Find this and remove it:
level thread powerup_hud_overlay();
Find the function called "init_powerups()" and replace it with this:
init_powerups() { if( !IsDefined( level.zombie_powerup_array ) ) { level.zombie_powerup_array = []; } if ( !IsDefined( level.zombie_special_drop_array ) ) { level.zombie_special_drop_array = []; } // Random Drops add_zombie_powerup( "nuke", "zombie_bomb", &"ZOMBIE_POWERUP_NUKE", "misc/fx_zombie_mini_nuke" ); add_zombie_powerup( "insta_kill", "zombie_skull", &"ZOMBIE_POWERUP_INSTA_KILL", undefined, "specialty_instakill_zombies", "zombie_powerup_insta_kill_time"); add_zombie_powerup( "double_points","zombie_x2_icon", &"ZOMBIE_POWERUP_DOUBLE_POINTS" , undefined, "specialty_doublepoints_zombies", "zombie_powerup_point_doubler_time" ); add_zombie_powerup( "full_ammo", "zombie_ammocan", &"ZOMBIE_POWERUP_MAX_AMMO"); add_zombie_powerup( "carpenter", "zombie_carpenter", &"ZOMBIE_POWERUP_MAX_AMMO"); // add_zombie_special_powerup( "monkey" ); // additional special "drops" // add_zombie_special_drop( "nothing" ); add_zombie_special_drop( "dog" ); // Randomize the order randomize_powerups(); level.zombie_powerup_index = 0; randomize_powerups(); }
We have 2 new psh at the end:
add_zombie_powerup( powerup_name, model_name, hint, fx, shader, timer_var )
We shall define our shader and timer variable here for danka obtaining effect.
Now find the function "add_zombie_powerup()" and replace it with this:
add_zombie_powerup( powerup_name, model_name, hint, fx, shader, timer_var ) { if( IsDefined( level.zombie_include_powerups ) && !IsDefined( level.zombie_include_powerups[powerup_name] ) ) { return; } PrecacheModel( model_name ); PrecacheString( hint ); struct = SpawnStruct(); if( !IsDefined( level.zombie_powerups ) ) { level.zombie_powerups = []; } struct.powerup_name = powerup_name; struct.model_name = model_name; struct.weapon_classname = "script_model"; struct.hint = hint; if(IsDefined(shader)) struct.shader = shader; if(IsDefined(timer_var)) struct.timer = timer_var; if( IsDefined( fx ) ) { struct.fx = LoadFx( fx ); } level.zombie_powerups[powerup_name] = struct; level.zombie_powerup_array[level.zombie_powerup_array.size] = powerup_name; add_zombie_special_drop( powerup_name ); }
Now find the function "powerup_hud_overlay()" and replace the entire function with this set of functions:
RemovePowerUpHud( powerup_name ) { for(i = 0; i < self.powerup_hud.size ; i++) { if(IsDefined(self.powerup_hud[i].powerup_name) && self.powerup_hud[i].powerup_name == powerup_name) { self.hud_is_being_deleted = true; self.powerup_hud[i] notify("hud_gone"); // IPrintLnBold(self.powerup_hud[i].powerup_name ); // Debug Purposes self.powerup_hud[i].alpha = 1; wait 0.1; self.powerup_hud[i] FadeOverTime(0.5); self.powerup_hud[i].alpha = 0; wait 0.6; self.powerup_hud[i] destroy_hud(); self.powerup_hud[i] Delete(); self.powerup_hud = array_remove(self.powerup_hud, self.powerup_hud[i]); self.current_powerups = array_remove(self.current_powerups, self.current_powerups[powerup_name]); self.hud_is_being_deleted = false; } } for(i = 0; i < self.powerup_hud.size ; i++) self.powerup_hud[i] thread MoveThyHUD(i, self.powerup_hud.size); } CreatePowerUpHud( powerup ) { if(IsDefined(self.current_powerups)) self.current_powerups = []; if(!IsDefined( self.powerup_hud)) self.powerup_hud = []; while(IsDefined(self.current_powerups[powerup])) // Check because from testing if the player is fast enough (Though very rare for it to happen), 2 elements can spawn for same HUD. wait 0.05; self.current_powerups[powerup] = create_simple_hud( self ); // Made Client HUD so we modify per player for things like Minigun, etc. self.current_powerups[powerup].powerup_name = powerup; self.current_powerups[powerup].foreground = true; self.current_powerups[powerup].sort = 2; self.current_powerups[powerup].hidewheninmenu = false; self.current_powerups[powerup].alignX = "center"; self.current_powerups[powerup].alignY = "bottom"; self.current_powerups[powerup].horzAlign = "center"; self.current_powerups[powerup].vertAlign = "bottom"; self.current_powerups[powerup].x = self.current_powerups[powerup].x; self.current_powerups[powerup].y = self.current_powerups[powerup].y - 35; self.current_powerups[powerup].alpha = 0; self.current_powerups[powerup] setshader(level.zombie_powerups[powerup].shader, 48, 48); self.current_powerups[powerup] scaleOverTime( .3, 32, 32 ); self.current_powerups[powerup] FadeOverTime(0.3); self.current_powerups[powerup].alpha = 1; self.current_powerups[powerup] thread LowTimeFade(); self.powerup_hud[self.powerup_hud.size] = self.current_powerups[powerup]; for(i = 0; i < self.powerup_hud.size ; i++) self.powerup_hud[i] thread MoveThyHUD(i, self.powerup_hud.size); } LowTimeFade() { self endon("hud_gone"); while(IsDefined(self)) { self.timer = level.zombie_vars[level.zombie_powerups[self.powerup_name].timer]; if(self.timer < 5) { fade_time = 0.2; } else if(self.timer < 10) { fade_time = 0.6; } else { wait 0.1; continue; } self FadeOverTime(fade_time); self.alpha = 0.1; wait fade_time; self FadeOverTime(fade_time); self.alpha = 1; wait fade_time; } } MoveThyHUD(i, array_size) // Mjáá { self MoveOverTime(0.5); self.x = (24 + (-24 * array_size + (i * 48))); // Jáám self.y = self.y; }
The 2 functions "CreatePowerUpHud()" and "RemovePowerUpHud()" will allow us to create and remove our shaders, more info below.
F
Now we need to edit the Double Points and Insta Kill to use this so find the function called "insta_kill_powerup()" and replace it with this:
insta_kill_powerup( drop_item ) { power_up_name = drop_item.powerup_name; level notify( "powerup instakill" ); level endon( "powerup instakill" ); // array_thread (players, ::insta_kill_on_hud, drop_item); level thread insta_kill_on_hud( drop_item, power_up_name ); level.zombie_vars["zombie_insta_kill"] = 1; wait( 30 ); level.zombie_vars["zombie_insta_kill"] = 0; players = get_players(); for(i = 0; i < players.size; i++) { players[i] notify("insta_kill_over"); } }
Now find "insta_kill_on_hud()" and replace with this:
insta_kill_on_hud( drop_item, power_up_name ) { self endon ("disconnect"); // check to see if this is on or not if ( level.zombie_vars["zombie_powerup_insta_kill_on"] ) { // reset the time and keep going level.zombie_vars["zombie_powerup_insta_kill_time"] = 30; return; } for( i = 0; i < GetPlayers().size; i ++ ) GetPlayers()[i] thread CreatePowerUpHud( power_up_name ); level.zombie_vars["zombie_powerup_insta_kill_on"] = true; // set up the hudelem //hudelem = maps\_hud_util::createFontString( "objective", 2 ); //hudelem maps\_hud_util::setPoint( "TOP", undefined, 0, level.zombie_vars["zombie_timer_offset"] + level.zombie_vars["zombie_timer_offset_interval"]); //hudelem.sort = 0.5; //hudelem.alpha = 0; //hudelem fadeovertime(0.5); //hudelem.alpha = 1; //hudelem.label = drop_item.hint; // set time remaining for insta kill level thread time_remaning_on_insta_kill_powerup( drop_item, power_up_name ); // offset in case we get another powerup //level.zombie_timer_offset -= level.zombie_timer_offset_interval; }
You can see here were are calling it on ALL players, as you may have guessed the 2 functions above and all the stuff is player specific allowing use to have different shaders like Death Machine, etc. while other players don't, and allowing it to scale depending on what player has what for example a player has Insta, Death, and x2 but other will only have the 2 global ones it will show up fine specific to player and move specific to player, this has been tested in co-op and works.
Now find the function "time_remaning_on_insta_kill_powerup()" and replace with this:
time_remaning_on_insta_kill_powerup( drop_item, power_up_name ) // Must pass on power_up_name from above for some reason or it won't work. { //self setvalue( level.zombie_vars["zombie_powerup_insta_kill_time"] ); level thread play_devil_dialog("insta_vox"); temp_enta = spawn("script_origin", (0,0,0)); temp_enta playloopsound("insta_kill_loop"); /* players = get_players(); for (i = 0; i < players.size; i++) { players[i] playloopsound ("insta_kill_loop"); } */ // time it down! while ( level.zombie_vars["zombie_powerup_insta_kill_time"] >= 0) { wait 0.1; level.zombie_vars["zombie_powerup_insta_kill_time"] = level.zombie_vars["zombie_powerup_insta_kill_time"] - 0.1; // self setvalue( level.zombie_vars["zombie_powerup_insta_kill_time"] ); } players = get_players(); for (i = 0; i < players.size; i++) { //players[i] stoploopsound (2); players[i] playsound("insta_kill"); } temp_enta stoploopsound(2); for( i = 0; i < GetPlayers().size; i ++ ) GetPlayers()[i] thread RemovePowerUpHud( power_up_name ); // turn off the timer level.zombie_vars["zombie_powerup_insta_kill_on"] = false; // remove the offset to make room for new powerups, reset timer for next time level.zombie_vars["zombie_powerup_insta_kill_time"] = 30; //level.zombie_timer_offset += level.zombie_timer_offset_interval; //self destroy(); temp_enta delete(); }
As you see from some reason we must pass on the power up name from the main function for the power up so make sure to do that.
Now for the Double Points replace the "point_double_on_hud()" and 2 functions under it with this:
point_doubler_on_hud( drop_item, power_up_name ) { self endon ("disconnect"); // check to see if this is on or not if ( level.zombie_vars["zombie_powerup_point_doubler_on"] ) { // reset the time and keep going level.zombie_vars["zombie_powerup_point_doubler_time"] = 30; return; } for( i = 0; i < GetPlayers().size; i ++ ) GetPlayers()[i] thread CreatePowerUpHud( power_up_name ); level.zombie_vars["zombie_powerup_point_doubler_on"] = true; //power_hud_array[0] = true; // set up the hudelem //hudelem = maps\_hud_util::createFontString( "objective", 2 ); //hudelem maps\_hud_util::setPoint( "TOP", undefined, 0, level.zombie_vars["zombie_timer_offset"] ); //hudelem.sort = 0.5; //hudelem.alpha = 0; //hudelem fadeovertime( 0.5 ); //hudelem.alpha = 1; //hudelem.label = drop_item.hint; // set time remaining for point doubler level thread time_remaining_on_point_doubler_powerup( drop_item, power_up_name ); // offset in case we get another powerup //level.zombie_timer_offset -= level.zombie_timer_offset_interval; } play_devil_dialog(sound_to_play) { if(!IsDefined(level.devil_is_speaking)) { level.devil_is_speaking = 0; } if(level.devil_is_speaking == 0) { level.devil_is_speaking = 1; play_sound_2D( sound_to_play ); wait 2.0; level.devil_is_speaking =0; } } time_remaining_on_point_doubler_powerup(drop_item, power_up_name) { //self setvalue( level.zombie_vars["zombie_powerup_point_doubler_time"] ); temp_ent = spawn("script_origin", (0,0,0)); temp_ent playloopsound ("double_point_loop"); level thread play_devil_dialog("dp_vox"); // time it down! while ( level.zombie_vars["zombie_powerup_point_doubler_time"] >= 0) { wait 0.1; level.zombie_vars["zombie_powerup_point_doubler_time"] = level.zombie_vars["zombie_powerup_point_doubler_time"] - 0.1; //self setvalue( level.zombie_vars["zombie_powerup_point_doubler_time"] ); } for( i = 0; i < GetPlayers().size; i ++ ) GetPlayers()[i] thread RemovePowerUpHud( power_up_name ); // turn off the timer level.zombie_vars["zombie_powerup_point_doubler_on"] = false; players = get_players(); for (i = 0; i < players.size; i++) { //players[i] stoploopsound("double_point_loop", 2); players[i] playsound("points_loop_off"); } temp_ent stoploopsound(2); // remove the offset to make room for new powerups, reset timer for next time level.zombie_vars["zombie_powerup_point_doubler_time"] = 30; //level.zombie_timer_offset += level.zombie_timer_offset_interval; //self destroy(); temp_ent delete(); }
And replace the main function for it called
double_points_powerup( drop_item ) { power_up_name = drop_item.powerup_name; level notify ("powerup points scaled"); level endon ("powerup points scaled"); // players = get_players(); // array_thread(level,::point_doubler_on_hud, drop_item); level thread point_doubler_on_hud( drop_item, power_up_name ); level.zombie_vars["zombie_point_scalar"] = 2; wait 30; level.zombie_vars["zombie_point_scalar"] = 1; }
And that should be it, now for some explaining of the 2 functions.
Like I said these are player spefic, for general power ups like Double Points we simply call it like this on all players:
for( i = 0; i < GetPlayers().size; i ++ )
GetPlayers()
thread CreatePowerUpHud( power_up_name ); And remove it like so: for( i = 0; i < GetPlayers().size; i ++ ) GetPlayers()[i] thread RemovePowerUpHud( power_up_name );
You can also pass on the player from the switch statement and call it on them specifically and it will add and move only their HUD:
player thread CreatePowerUpHud( power_up_name );
With the nature of pulling stuff out of GSCs there might be something I missed, let me know if there are any errors or bugs.
FAQ:
Q: dis is my mums.
A: z__
__z
Q: u stole this from me mum.
A: \_
_/
Q: u stole this from my iwd
A: You script? \_________________
_/
Q: I don't know how to use this with my custom power ups.
A: Contact me.
Enjoy!