UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

[TUT] Special Ammo Power-up Drops

broken avatar :(
Created 10 years ago
by BluntStuffy
0 Members and 1 Guest are viewing this topic.
3,604 views
broken avatar :(
×
broken avatar :(
Location: nlApeldoorn
Date Registered: 17 December 2013
Last active: 1 year ago
Posts
1,187
Respect
1,404Add +1
Forum Rank
Zombie Colossus
Primary Group
Community Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
It aint much, if it aint Dutch
Signature
×
BluntStuffy's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
Oil Rig Beta Access
Oil Rig Beta Access
BluntStuffy's Contact & Social LinksBluntstuffy@BluntZombieBluntStuffyStuffyZombie
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   ;D

http://www.youtube.com/watch?v=tdl8opbDEMk&feature=youtu.be


The scripting part:

================================
In zombiemode_powerups.gsc:

Under:
Code Snippet
Plaintext
	PrecacheShader( "specialty_instakill_zombies" );
Add the shaders you are using for the ammo-type's, like this:
Code Snippet
Plaintext
	PrecacheShader( "MATERIAL_NAME" );
   



Under:
Code Snippet
Plaintext
	set_zombie_var( "zombie_powerup_drop_max_per_round", 4 );
Add:

Code Snippet
Plaintext
 
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:
Code Snippet
Plaintext
	add_zombie_powerup( "carpenter",  	"zombie_carpenter",	&"ZOMBIE_POWERUP_MAX_AMMO");

   
add:
Code Snippet
Plaintext
	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:
Code Snippet
Plaintext
xmodel,zombie_ammocan
      
   

In the function get_next_powerup(), under these line's:

Code Snippet
Plaintext
		if( powerup != "carpenter" )
return powerup;


wait(0.05);
}
Add these:

Code Snippet
Plaintext
	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:
Code Snippet
Plaintext
	if( IsDefined( level.zombie_powerup_grab_func ) )
{
level thread [[level.zombie_powerup_grab_func]]();
}
Add these:
Code Snippet
Plaintext
	if( self.powerup_name == "special_ammo" && isdefined( players[i].ammo_powerup_hud[ "drop" ] ) )		// Cannot pick up 2 ammo-drops
{
continue;
}
   



And under these:
Code Snippet
Plaintext
					case "carpenter":
level thread start_carpenter( self.origin );
players[i] thread powerup_vo("carpenter");
break;

Add these:
Code Snippet
Plaintext
					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:


Code Snippet
Plaintext
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:
Code Snippet
Plaintext
	include_powerup( "carpenter" );
Add:
Code Snippet
Plaintext
	include_powerup( "special_ammo" );
   





In your _zombiemode_spawner.gsc, at the top of the file under this line:

Code Snippet
Plaintext
	#include maps\_zombiemode_utility;

add these 2 line's:

Code Snippet
Plaintext
	#include maps\_zombiemode_net;

#using_animtree( "generic_human" );



Still in _zombiemode_spawner and look for this function:
Code Snippet
Plaintext
	zombie_damage( mod, hit_location, hit_origin, player )
{
And in there look for these line's:
Code Snippet
Plaintext
	if( !IsDefined( player ) )
{
return;
}

Under those line's add:

Code Snippet
Plaintext
		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:
Code Snippet
Plaintext
	zombie_damage_ads( mod, hit_location, hit_origin, player )
{

And again, in there look for these line's:
Code Snippet
Plaintext
	if( !IsDefined( player ) )
{
return;
}

Under those line's add:

Code Snippet
Plaintext
		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:
Code Snippet
Plaintext
		if( !IsDefined( self ) )
{
return;
}
   
Under those, place these:

Code Snippet
Plaintext
 
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:
Code Snippet
Plaintext
	self flamethrower_stop_shoot(); 

Add this:

Code Snippet
Plaintext
	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:

Code Snippet
Plaintext
	maps\_zombiemode::main();

   
Right ABOVE that line, add this one:

Code Snippet
Plaintext
	maps\_blst_custom_ammo_drop::custom_ammo_precache();
   




In your root\zone_source\mapname.csv add:
Code Snippet
Plaintext
// 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:

Code Snippet
Plaintext
 
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!)

Code Snippet
Plaintext
 
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:

Code Snippet
Plaintext
 
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:

Code Snippet
Plaintext
 
Shock-ammo:
level._effect["blst_shock_ammo"] = loadfx( "maps/zombie/fx_tesla_impact_default");
   

Code Snippet
Plaintext
 
Flame-ammo:
level._effect["character_fire_pain_sm"] = loadfx( "env/fire/fx_fire_player_sm_1sec" );
   

Code Snippet
Plaintext
 
Expl-ammo:
level._effect["blst_expl_ammo"] = loadfx( "explosions/fx_grenade_flash");
   




broken avatar :(
×
broken avatar :(
The King of Zombies
Location: usLouisiana
Date Registered: 24 June 2013
Last active: 4 years ago
Posts
2,148
Respect
Forum Rank
King of the Zombies
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Signature
Donate to me if you enjoy my work. https://www.paypal.me/thezombiekilla6
×
Dust's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Dust's Contact & Social LinksMrZ0mbiesFanaticdust103194MrZ0mbiesFanatic
Wow nice work Stuffy!
broken avatar :(
×
broken avatar :(
Location: usNUKETOWN
Date Registered: 19 February 2014
Last active: 7 years ago
Posts
177
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Donator ♥
My Groups
More
My Contact & Social Links
More
Personal Quote
Zombie Specialist
Signature
×
thezombieproject's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Oil Rig Beta Access
Oil Rig Beta Access
your a beast. is there still regular ammo drops on your map JW
broken avatar :(
×
broken avatar :(
UM Member, Mapper and 3d Modeler
Location: ca
Date Registered: 8 February 2014
Last active: 3 years ago
Posts
835
Respect
Forum Rank
The Decider
Primary Group
Community Mapper
My Groups
More
My Contact & Social Links
More
Personal Quote
Port Arthur
Signature
×
pashan's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
this is want i wanted, thanks  8)

 
Loading ...