NOTE: This is
not made to work side-by-side with the Custom-ammo Tutorial i posted a while ago..!
This is a variation on the custom ammo script, making it into a power-up drop that give's one of the Special ammo's to the players for 30 seconds.
It works for bullet weapons, and i also added tracers and impact-fx when not hitting zombie's. So it's a real carnival now
Check out the new vid for the effects:
Note: this is not tested for lag on 4 player coop
http://www.youtube.com/watch?v=tdl8opbDEMk&feature=youtu.be The scripting part:
================================
In zombiemode_powerups.gsc:
Under:
PrecacheShader( "specialty_instakill_zombies" );
Add the shaders you are using for the ammo-type's, like this:
PrecacheShader( "MATERIAL_NAME" );
Under:
set_zombie_var( "zombie_powerup_drop_max_per_round", 4 );
Add:
level.special_ammo_drop[ "shock" ] = false; level.special_ammo_drop[ "flame" ] = false; level.special_ammo_drop[ "expl" ] = false; level.shock_ammo_multiplier = 0.6; // The ammount of damage to ADD to the normal damage ( so putting 1 here, double's the damage ) level.flame_ammo_multiplier = 0.3; level.expl_ammo_multiplier = 0.8; level.special_ammo_drop_time = 30; // Lenght of the special ammo drop
Under:
add_zombie_powerup( "carpenter", "zombie_carpenter", &"ZOMBIE_POWERUP_MAX_AMMO");
add:
add_zombie_powerup( "special_ammo", "zombie_ammocan", "Special Ammo");
NOTE: Change the "zombie_ammocan" in the line above to the model you want to use for the drop.
If you are using a new model for the drop, then add the model your using to your zone_source\mapname.csv like this:
xmodel,zombie_ammocan
In the function get_next_powerup(), under these line's:
if( powerup != "carpenter" ) return powerup; wait(0.05); }
Add these:
if( level.special_ammo_drop[ "shock" ] || level.special_ammo_drop[ "flame" ] || level.special_ammo_drop[ "expl" ]) { if( powerup == "special_ammo" ) { while(1) { if( level.zombie_powerup_index >= level.zombie_powerup_array.size ) { level.zombie_powerup_index = 0; randomize_powerups(); } powerup = level.zombie_powerup_array[level.zombie_powerup_index]; level.zombie_powerup_index++; if( powerup != "special_ammo" ) return powerup; wait(0.05); } } }
In the function powerup_grab(), under these line's:
if( IsDefined( level.zombie_powerup_grab_func ) ) { level thread [[level.zombie_powerup_grab_func]](); }
Add these:
if( self.powerup_name == "special_ammo" && isdefined( players[i].ammo_powerup_hud[ "drop" ] ) ) // Cannot pick up 2 ammo-drops { continue; }
And under these:
case "carpenter": level thread start_carpenter( self.origin ); players[i] thread powerup_vo("carpenter"); break;
Add these:
case "special_ammo": players[i] thread powerup_vo("full_ammo"); level thread special_ammo_drop(); break;
Now to the bottom of the file add these new function's:
special_ammo_drop() { rnd = randomintrange(1, 4); ammo = undefined; switch( rnd ) { case 1: iprintlnbold( "Shock Ammo!" ); ammo = "shock"; break; case 2: iprintlnbold( "Incendiary Ammo!" ); ammo = "flame"; break; case 3: iprintlnbold( "Explosive Ammo!" ); ammo = "expl"; break; default: break; } players = get_players(); for(i=0;i<players.size;i++) { players[i] thread create_special_ammo_hud( ammo ); players[i] thread special_ammo_tracer( ammo ); } level.special_ammo_drop[ ammo ] = true; wait level.special_ammo_drop_time; level.special_ammo_drop[ ammo ] = false; for(i=0;i<players.size;i++) { players[i] notify( "special_ammo_drop_done" ); players[i].ammo_powerup_hud[ "drop" ] destroy_hud(); players[i].ammo_powerup_hud[ "drop" ] = undefined; } } create_special_ammo_hud( ammo ) { self endon( "death" ); self endon( "disconect" ); self endon( "special_ammo_drop_done" ); shader = undefined; switch( ammo ) { case "shock": shader = "specialty_juggernaut_zombies"; break; case "flame": shader = "specialty_fastreload_zombies"; break; case "expl": shader = "specialty_fastreload_zombies"; break; default: break; } ammo_powerup_hud = create_simple_hud(); ammo_powerup_hud.foreground = true; ammo_powerup_hud.sort = 2; ammo_powerup_hud.hidewheninmenu = false; ammo_powerup_hud.alignX = "center"; ammo_powerup_hud.alignY = "bottom"; ammo_powerup_hud.horzAlign = "center"; ammo_powerup_hud.vertAlign = "bottom"; ammo_powerup_hud.y = ammo_powerup_hud.y - 35; ammo_powerup_hud.alpha = 1; ammo_powerup_hud setshader(shader, 32, 32); self.ammo_powerup_hud[ "drop" ] = ammo_powerup_hud; shader_moved = false; time = level.special_ammo_drop_time; while( time > 0 ) { if(level.zombie_vars["zombie_powerup_point_doubler_on"] == true && !shader_moved || level.zombie_vars["zombie_powerup_insta_kill_on"] == true && !shader_moved ) { ammo_powerup_hud.y = ammo_powerup_hud.y - 35; shader_moved = true; } if( level.zombie_vars["zombie_powerup_point_doubler_on"] == false && level.zombie_vars["zombie_powerup_insta_kill_on"] == false && shader_moved ) { ammo_powerup_hud.y = ammo_powerup_hud.y + 35; shader_moved = false; } if( time < 2 ) { ammo_powerup_hud.alpha = 0; time -= 0.1; wait 0.1; ammo_powerup_hud.alpha = 1; time -= 0.1; wait 0.1; } if( time < 8 && time >= 2 ) { ammo_powerup_hud.alpha = 0; time -= 0.2; wait 0.2; ammo_powerup_hud.alpha = 1; time -= 0.2; wait 0.2; } if( time >= 8 ) { time -= 0.5; wait 0.5; } } } special_ammo_tracer( ammo ) { self endon( "disconnect" ); self endon( "death" ); self endon( "special_ammo_drop_done" ); self.tracers_drawn = 0; fx = undefined; impact_fx = undefined; switch( ammo ) { case "shock": fx = level._effect["tracer_shock_ammo"]; impact_fx = level._effect["blst_shock_ammo"]; break; case "flame": fx = level._effect["tracer_flame_ammo"]; impact_fx = level._effect["character_fire_pain_sm"]; break; case "expl": fx = level._effect["tracer_expl_ammo"]; impact_fx = level._effect["blst_expl_ammo"]; break; default: break; } for( ;; ) { self waittill( "weapon_fired" ); currentweapon = self GetCurrentWeapon(); if( WeaponType( currentweapon ) == "bullet" && self.tracers_drawn < 10 ) { self thread special_ammo_shot( fx, impact_fx ); } } } special_ammo_shot( fx, impact_fx ) { self.tracers_drawn++; fire_angles = self getPlayerAngles(); fire_angles_forward = anglesToForward( fire_angles ); fire_init = self GetTagOrigin( "j_wristtwist_ri" ) + (0,0,6) ; fire_pos = fire_init + vectorScale( fire_angles_forward, 100 ); if( self AdsButtonPressed() ) { fire_init = self GetTagOrigin( "j_wristtwist_ri" ) + ( 0,0,5 ); fire_pos = fire_init + vectorScale( fire_angles_forward, 100 ); } impact = fire_pos + vectorScale( fire_angles_forward, 10000 ); trace = BulletTrace( fire_pos, impact, false, undefined ); tag_bullet = spawn("script_model", fire_pos); tag_bullet setmodel("tag_origin"); tag_bullet.angles = fire_angles; PlayFxOnTag( fx, tag_bullet, "tag_origin" ); tag_bullet moveto( trace["position"], 0.15); playfx( impact_fx, trace["position"] ); wait 0.15; tag_bullet delete(); self.tracers_drawn--; }
Open dlc3_code.gsc and under this line:
include_powerup( "carpenter" );
Add:
include_powerup( "special_ammo" );
In your _zombiemode_spawner.gsc, at the top of the file under this line:
#include maps\_zombiemode_utility;
add these 2 line's:
#include maps\_zombiemode_net; #using_animtree( "generic_human" );
Still in _zombiemode_spawner and look for this function:
zombie_damage( mod, hit_location, hit_origin, player ) {
And in there look for these line's:
if( !IsDefined( player ) ) { return; }
Under those line's add:
if( level.special_ammo_drop[ "shock" ] && mod == "MOD_PISTOL_BULLET" || level.special_ammo_drop[ "shock" ] && mod == "MOD_RIFLE_BULLET" ) { shock_tag = maps\_blst_custom_ammo_drop::hit_tag( hit_location ); if( isdefined( shock_tag ) ) { network_safe_play_fx_on_tag( "shock_impact_fx", 3, level._effect["blst_shock_ammo"], self, shock_tag ); self playsound( "imp_tesla" ); } } if( level.special_ammo_drop[ "flame" ] && mod == "MOD_PISTOL_BULLET" || level.special_ammo_drop[ "flame" ] && mod == "MOD_RIFLE_BULLET" ) { if( !isdefined( self.flame_ammo_on_fire ) || isdefined( self.flame_ammo_on_fire ) && !self.flame_ammo_on_fire ) { flame_tag = maps\_blst_custom_ammo_drop::hit_tag( hit_location ); if( isdefined(flame_tag)) { network_safe_play_fx_on_tag( "flame_impact_fx", 3, level._effect["character_fire_pain_sm"], self, flame_tag ); } self thread maps\_blst_custom_ammo_drop::blst_flame_ammo( player ); } } if( level.special_ammo_drop[ "expl" ] && mod == "MOD_PISTOL_BULLET" || level.special_ammo_drop[ "expl" ] && mod == "MOD_RIFLE_BULLET" ) { expl_tag = maps\_blst_custom_ammo_drop::hit_tag( hit_location ); if( isdefined( expl_tag)) { network_safe_play_fx_on_tag( "expl_impact_fx", 3, level._effect["blst_expl_ammo"], self, expl_tag ); } self maps\_blst_custom_ammo_drop::blst_expl_ammo( hit_location ); }
Now we're gonna do the same thing again, but this time in this function:
zombie_damage_ads( mod, hit_location, hit_origin, player ) {
And again, in there look for these line's:
if( !IsDefined( player ) ) { return; }
Under those line's add:
if( level.special_ammo_drop[ "shock" ] && mod == "MOD_PISTOL_BULLET" || level.special_ammo_drop[ "shock" ] && mod == "MOD_RIFLE_BULLET" ) { shock_tag = maps\_blst_custom_ammo_drop::hit_tag( hit_location ); if( isdefined( shock_tag ) ) { network_safe_play_fx_on_tag( "shock_impact_fx", 3, level._effect["blst_shock_ammo"], self, shock_tag ); self playsound( "imp_tesla" ); } } if( level.special_ammo_drop[ "flame" ] && mod == "MOD_PISTOL_BULLET" || level.special_ammo_drop[ "flame" ] && mod == "MOD_RIFLE_BULLET" ) { if( !isdefined( self.flame_ammo_on_fire ) || isdefined( self.flame_ammo_on_fire ) && !self.flame_ammo_on_fire ) { flame_tag = maps\_blst_custom_ammo_drop::hit_tag( hit_location ); if( isdefined(flame_tag)) { network_safe_play_fx_on_tag( "flame_impact_fx", 3, level._effect["character_fire_pain_sm"], self, flame_tag ); } self thread maps\_blst_custom_ammo_drop::blst_flame_ammo( player ); } } if( level.special_ammo_drop[ "expl" ] && mod == "MOD_PISTOL_BULLET" || level.special_ammo_drop[ "expl" ] && mod == "MOD_RIFLE_BULLET" ) { expl_tag = maps\_blst_custom_ammo_drop::hit_tag( hit_location ); if( isdefined( expl_tag)) { network_safe_play_fx_on_tag( "expl_impact_fx", 3, level._effect["blst_expl_ammo"], self, expl_tag ); } self maps\_blst_custom_ammo_drop::blst_expl_ammo( hit_location ); }
Still in _spawner, now look for this function: zombie_gib_on_damage() and in there look for these line's:
if( !IsDefined( self ) ) { return; }
Under those, place these:
if( level.special_ammo_drop[ "shock" ] && type == "MOD_PISTOL_BULLET" || level.special_ammo_drop[ "shock" ] && type == "MOD_RIFLE_BULLET" ) { added = level.shock_ammo_multiplier * amount; added_damage = round_up_to_ten( int( added ) ); self_new_health = self.health - added_damage; if( self_new_health > 0 ) { self.health = self_new_health; } } if( level.special_ammo_drop[ "flame" ] && type == "MOD_PISTOL_BULLET" || level.special_ammo_drop[ "flame" ] && type == "MOD_RIFLE_BULLET" ) { added = level.flame_ammo_multiplier * amount; added_damage = round_up_to_ten( int( added ) ); self_new_health = self.health - added_damage; if( self_new_health > 0 ) { self.health = self_new_health; } } if( level.special_ammo_drop[ "expl" ] && type == "MOD_PISTOL_BULLET" || level.special_ammo_drop[ "expl" ] && type == "MOD_RIFLE_BULLET" ) { added = level.expl_ammo_multiplier * amount; added_damage = round_up_to_ten( int( added ) ); self_new_health = self.health - added_damage; if( self_new_health > 0 ) { self.health = self_new_health; } }
Next open up animscripts\death.gsc, at the top of the first function, under this line:
self flamethrower_stop_shoot();
Add this:
if( level.special_ammo_drop[ "shock" ] && self.damagemod == "MOD_PISTOL_BULLET" || level.special_ammo_drop[ "shock" ] && self.damagemod == "MOD_RIFLE_BULLET" ) { self.deathanim = random( level._zombie_tesla_death[self.animname] ); // Shock Ammo Playfxontag (level._effect["tesla_shock_eyes"], self, "J_Eyeball_LE" ); Playfxontag (level._effect["tesla_shock"], self, "J_SpineUpper" ); } if( level.special_ammo_drop[ "flame" ] && self.damagemod == "MOD_PISTOL_BULLET" || level.special_ammo_drop[ "flame" ] && self.damagemod == "MOD_RIFLE_BULLET" ) { if( !isdefined( self.is_on_fire ) || isdefined( self.is_on_fire ) && !self.is_on_fire ) // Flame Ammo { self thread flame_death_fx(); } } if( level.special_ammo_drop[ "expl" ] && self.damagemod == "MOD_PISTOL_BULLET" || level.special_ammo_drop[ "expl" ] && self.damagemod == "MOD_RIFLE_BULLET" ) { expl_anim = maps\_blst_custom_ammo_drop::death_anim_yaw( self.damageyaw ); // Explosive Ammo self.deathanim = expl_anim; }
Allmost there, in your mapname.gsc:
Look for this line:
maps\_zombiemode::main();
Right ABOVE that line, add this one:
maps\_blst_custom_ammo_drop::custom_ammo_precache();
In your root\zone_source\mapname.csv add:
// BluntStuffy's Special-Ammo drop // Shock Ammo - Flame Ammo - Explosive Ammo rawfile,maps/_blst_custom_ammo_drop.gsc fx,maps/zombie/fx_tesla_impact_default fx,maps/zombie/fx_zombie_tesla_shock fx,maps/zombie/fx_zombie_tesla_shock_eyes fx,env/fire/fx_fire_player_sm_1sec fx,explosions/fx_grenade_flash fx,weapon/tracer/fx_tracer_pby_30cal_view fx,blst_custom/tracer_flame_ammo fx,blst_custom/tracer_shock_ammo
Download the script and put it in your mods\mapname\maps\ folder.
Once you did all this, compile everything and test. Once you sure it's up and running you can change some stuff if you would like.
Open _zombiemode_powerups.gsc, and in here you can change this:
level.shock_ammo_multiplier = 0.6; // The ammount of damage to ADD to the normal damage ( so putting 1 here, double's the damage ) level.flame_ammo_multiplier = 0.3; level.expl_ammo_multiplier = 0.8; level.special_ammo_drop_time = 30; // Lenght of the special ammo drop
To change the shaders used for the ammo-drops, again in _zombiemode_powerups.gsc, look for: (and make surew you precached them at the top of the file!)
create_special_ammo_hud( ammo ) { self endon( "death" ); self endon( "disconect" ); self endon( "special_ammo_drop_done" ); shader = undefined; switch( ammo ) { case "shock": shader = "specialty_juggernaut_zombies"; <=== CHANGE SHADER-NAME HERE break; case "flame": shader = "specialty_fastreload_zombies"; <=== CHANGE SHADER-NAME HERE break; case "expl": shader = "specialty_fastreload_zombies"; <=== CHANGE SHADER-NAME HERE break; default: break; }
To change the tracer-fx used for the special ammo, open _blst_custom_ammo_drop.gsc, and at the top look for:
level._effect["tracer_expl_ammo"] = loadfx("weapon/tracer/fx_tracer_pby_30cal_view"); level._effect["tracer_flame_ammo"] = loadfx("blst_custom/tracer_flame_ammo"); level._effect["tracer_shock_ammo"] = loadfx("blst_custom/tracer_shock_ammo");
The impact fx's are:
Shock-ammo: level._effect["blst_shock_ammo"] = loadfx( "maps/zombie/fx_tesla_impact_default");
Flame-ammo: level._effect["character_fire_pain_sm"] = loadfx( "env/fire/fx_fire_player_sm_1sec" );
Expl-ammo: level._effect["blst_expl_ammo"] = loadfx( "explosions/fx_grenade_flash");