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

Half Damage Help

broken avatar :(
Created 11 years ago
by jbird
0 Members and 1 Guest are viewing this topic.
2,404 views
broken avatar :(
×
broken avatar :(
Location: usUnited States
Date Registered: 13 May 2014
Last active: 5 days ago
Posts
167
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
×
jbird's Groups
I'm trying to make it so certain players at times do half damage to zombies.

Code Snippet
Plaintext
zombie_damage( mod, hit_location, hit_origin, player, amount )
{
if( is_magic_bullet_shield_enabled( self ) )
{
return;
}

player.use_weapon_type = mod;
if(isDefined(self.marked_for_death))
{
return;
}
if( !IsDefined( player ) )
{
return;
}
if ( self check_zombie_damage_callbacks( mod, hit_location, hit_origin, player, amount ) )
{
return;
}
else if( self zombie_flame_damage( mod, player ) )
{
if( self zombie_give_flame_damage_points() )
{
player maps\_zombiemode_score::player_add_points( "damage", mod, hit_location, self.isdog );
}
}
else if( self maps\_zombiemode_weap_tesla::is_tesla_damage( mod ) )
{
self maps\_zombiemode_weap_tesla::tesla_damage_init( hit_location, hit_origin, player );
return;
}
else
{
if ( self maps\_zombiemode_weap_freezegun::is_freezegun_damage( self.damagemod ) )
{
self thread maps\_zombiemode_weap_freezegun::freezegun_damage_response( player, amount );
}

if ( !self maps\_zombiemode_weap_freezegun::is_freezegun_shatter_damage( self.damagemod ) )
{
if( player_using_hi_score_weapon( player ) )
{
damage_type = "damage";
}
else
{
damage_type = "damage_light";
}
if ( !is_true( self.no_damage_points ) )
{
player maps\_zombiemode_score::player_add_points( damage_type, mod, hit_location, self.isdog );
}
}
}
if ( IsDefined( self.zombie_damage_fx_func ) )
{
self [[ self.zombie_damage_fx_func ]]( mod, hit_location, hit_origin, player );
}
modName = remove_mod_from_methodofdeath( mod );
if ( self maps\_zombiemode_weap_freezegun::is_freezegun_damage( self.damagemod ) )
{
;
}
else if( is_placeable_mine( self.damageweapon ) )
{
if ( IsDefined( self.zombie_damage_claymore_func ) )
{
self [[ self.zombie_damage_claymore_func ]]( mod, hit_location, hit_origin, player );
}
else if ( isdefined( player ) && isalive( player ) )
{
self DoDamage( level.round_number * randomintrange( 100, 200 ), self.origin, player);
}
else
{
self DoDamage( level.round_number * randomintrange( 100, 200 ), self.origin, undefined );
}
}
else if ( mod == "MOD_GRENADE" || mod == "MOD_GRENADE_SPLASH" )
{
if ( isdefined( player ) && isalive( player ) )
{
self DoDamage( level.round_number + randomintrange( 100, 200 ), self.origin, player, 0, modName, hit_location);
}
else
{
self DoDamage( level.round_number + randomintrange( 100, 200 ), self.origin, undefined, 0, modName, hit_location );
}
}
else if( mod == "MOD_PROJECTILE" || mod == "MOD_EXPLOSIVE" || mod == "MOD_PROJECTILE_SPLASH" )
{
if ( isdefined( player ) && isalive( player ) )
{
self DoDamage( level.round_number * randomintrange( 0, 100 ), self.origin, player, 0, modName, hit_location);
}
else
{
self DoDamage( level.round_number * randomintrange( 0, 100 ), self.origin, undefined, 0, modName, hit_location );
}
}


if( IsDefined( self.a.gib_ref ) && (self.a.gib_ref == "no_legs") && isalive( self ) )
{
if ( isdefined( player ) )
{
rand = randomintrange(0, 100);
if(rand < 10)
{
player create_and_play_dialog( "general", "crawl_spawn" );
}
}
}
else if( IsDefined( self.a.gib_ref ) && ( (self.a.gib_ref == "right_arm") || (self.a.gib_ref == "left_arm") ) )
{
if( self.has_legs && isalive( self ) )
{
if ( isdefined( player ) )
{
rand = randomintrange(0, 100);
if(rand < 7)
{
player create_and_play_dialog( "general", "shoot_arm" );
}
}
}
}
if(player HasPerk("specialty_deadshot"))
{
self thread deadshot_damage(amount, hit_origin, player, hit_location);
}
if(player.half_damage == true)
{
amount = int(amount / 2);
self.health += amount;
//iprintln(self.health);
}
}

The half damage part is at the very bottom. What I have does work, unless the damage that was initially done to the zombie was enough to kill it. How do I fix that problem?
This topic contains a post which is marked as the Best Answer. Click here to view it.
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 6 years ago
Posts
6,875
Respect
Forum Rank
Immortal
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
Signature
If you want scripts / features made for you, then contact me by PM or email / skype etc
it will cost you tho so if you have no intention of reciprocating don't even waste my time ;)
×
Harry Bo21's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Harry Bo21's Contact & Social LinksHarryBo000[email protected]HarryBo21
this function is called "after" the damage is dealt
broken avatar :(
×
broken avatar :(
Location: usUnited States
Date Registered: 13 May 2014
Last active: 5 days ago
Posts
167
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
jbird's Groups
this function is called "after" the damage is dealt
Is there a function I can use that is called before the damage is dealt?
Marked as best answer by jbird 11 years ago
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 6 years ago
Posts
6,875
Respect
Forum Rank
Immortal
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
Harry Bo21's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Harry Bo21's Contact & Social LinksHarryBo000[email protected]HarryBo21
Is there a function I can use that is called before the damage is dealt?
not that im aware of, maybe theres a damage multiplier DVAR or something, but otherwise, damage is already dealt before any point you can intervene that i know of, all my scripts was "adding" to said damage
broken avatar :(
×
broken avatar :(
Location: usUnited States
Date Registered: 13 May 2014
Last active: 5 days ago
Posts
167
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
jbird's Groups
not that im aware of, maybe theres a damage multiplier DVAR or something, but otherwise, damage is already dealt before any point you can intervene that i know of, all my scripts was "adding" to said damage
Okay, I guess this will have to do
broken avatar :(
×
broken avatar :(
Location: gbMilton Keynes
Date Registered: 17 January 2014
Last active: 6 years ago
Posts
6,875
Respect
Forum Rank
Immortal
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
Harry Bo21's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Harry Bo21's Contact & Social LinksHarryBo000[email protected]HarryBo21
you could possibly wrangle up some ugly ass method to give them health "back"

odds are this will go wrong if the initial shot kills and shouldnt tho

and would be very messy



^^ Saw this, no function because its already a easily accessible variable

zombie.health = x

player.health = x

theres also

entity.maxHealth
Last Edit: September 29, 2015, 07:51:07 am by Harry Bo21

 
Loading ...