Quote:
Originally Posted by Bugsy
To fix the undead explosion bug I will need to know the exact type of damage and any other info about the damage (entity issuing damage or w\e).
|
Here is the code from the plugin of war3ft, this code is about the damage of undead explosion. hope to be helpful.
Code:
// Draw the explosions
public _UD_SuicideExplode( parm[5] )
{
new id = parm[0];
if ( get_pcvar_num( CVAR_wc3_psychostats ) )
{
new WEAPON = CSW_SUICIDE - CSW_WAR3_MIN;
iStatsShots[id][WEAPON]++;
}
new vOrigin[3], vPosition[3];
vOrigin[0] = parm[2];
vOrigin[1] = parm[3];
vOrigin[2] = parm[4];
vPosition[0] = vOrigin[0] + random_num( -100, 100 );
vPosition[1] = vOrigin[1] + random_num( -100, 100 );
vPosition[2] = vOrigin[2] + random_num( -50, 50 );
Create_TE_EXPLOSION( vOrigin, vPosition, g_iSprites[SPR_FIREBALL], (random_num(0,20) + 20), 12, TE_EXPLFLAG_NONE );
// This doesn't look correct in Day of Defeat, so lets only do it for CS/CZ
if ( g_MOD == GAME_CSTRIKE || g_MOD == GAME_CZERO )
{
Create_TE_Smoke( vOrigin, vPosition, g_iSprites[SPR_SMOKE], 60, 10 );
}
new players[32], numberofplayers;
get_players( players, numberofplayers, "a" );
new i, iTargetID, vTargetOrigin[3], iDamage, iDistance;
new iMultiplier = ( EXPLOSION_MAX_DAMAGE * EXPLOSION_MAX_DAMAGE ) / EXPLOSION_RANGE;
new iTeam = get_user_team( id );
// Check all players and see if they should be damaged
for ( i = 0; i < numberofplayers; i++ )
{
iTargetID = players[i];
// Get origin of target
get_user_origin( iTargetID, vTargetOrigin );
// Get distance in b/t target and caster
iDistance = get_distance( vOrigin, vTargetOrigin );
// Make sure this user is close enough to do damage + isn't immune + isn't on the same team + isn't already immune to all damage
if ( iDistance < EXPLOSION_RANGE && iTeam != get_user_team( iTargetID ) && !bIgnoreDmg[iTargetID] )
{
if ( ULT_CanUserBlockUlt( iTargetID ) )
{
ULT_RemoveCharge( iTargetID, 5 );
ULT_Blocked( id );
bIgnoreDmg[iTargetID] = true;
}
// The user isn't immune!
else
{
// Calculate the damage to be done
iDamage = ( EXPLOSION_RANGE - iDistance) * iMultiplier;
iDamage = sqroot( iDamage );
// Damage them!!!!
WC3_Damage( iTargetID, id, iDamage, CSW_SUICIDE, -1 );
// Lets shake up their screen a bit
Create_ScreenShake( iTargetID, (1<<14), (1<<13), (1<<14) );
}
}
// Reset the "don't damage" rule
if ( parm[1] - 1 <= 0 )
{
bIgnoreDmg[iTargetID] = false;
}
}
--parm[1];
// Lets keep going if we have some left!
if ( parm[1] > 0 )
{
set_task( 0.1, "_UD_SuicideExplode", TASK_EXPLOSION + id, parm, 5 );
}
}
and the code of
WC3_Damage is here:
Code:
public WC3_Damage( iVictim, iAttacker, iDamage, iWeapon, iBodyPart )
{
// We have an invalid attacker/victim, that sucks...
if ( iAttacker == 0 || iVictim == 0 )
{
return;
}
// User is not alive, why damage them more?
if ( !is_user_alive( iVictim ) )
{
return;
}
// Don't damage if we shouldn't!
if ( p_data_b[iVictim][PB_NO_DAMAGE] )
{
return;
}
// Warden's Hardened Skin
iDamage = WA_HardenedSkin( iVictim, iDamage );
if ( iBodyPart == -1 )
{
iBodyPart = random_num( 1, 7 );
}
// Modify the amount of damage done based on the user's armor
if ( g_MOD == GAME_CSTRIKE || g_MOD == GAME_CZERO )
{
new Float:fNewDamage = float( iDamage ) * ARMOR_RATIO;
new Float:fArmorLost = ( float( iDamage ) - fNewDamage ) * ARMOR_BONUS;
new Float:fCurrentArmor = float( get_user_armor( iVictim ) );
// Does this use more armor than we have?
if ( fArmorLost > fCurrentArmor )
{
fArmorLost = fCurrentArmor;
fArmorLost *= ( 1 / ARMOR_BONUS );
fNewDamage = float( iDamage ) - fArmorLost;
set_user_armor( iVictim, 0 );
}
else
{
new iNewArmor = floatround( fCurrentArmor - ( 3.0 * fArmorLost ) );
set_user_armor( iVictim, iNewArmor );
}
iDamage = floatround( fNewDamage );
}
new iHeadshot = 0;
if ( g_MOD == GAME_CSTRIKE || g_MOD == GAME_CZERO )
{
if ( iBodyPart == 1 )
{
iHeadshot = 1;
}
}
// Psychostats Statistics is turned on!
if ( get_pcvar_num( CVAR_wc3_psychostats ) )
{
if ( CSW_WAR3_MIN <= iWeapon <= CSW_WAR3_MAX )
{
new iSkillWeapon = iWeapon - CSW_WAR3_MIN;
// Make the "generic" the stomach
if ( iBodyPart == -1 )
{
iBodyPart = HIT_STOMACH;
}
if ( iBodyPart == HIT_HEAD )
{
iStatsHead[iAttacker][iSkillWeapon]++;
}
else if ( iBodyPart == HIT_CHEST )
{
iStatsChest[iAttacker][iSkillWeapon]++;
}
else if ( iBodyPart == HIT_STOMACH )
{
iStatsStomach[iAttacker][iSkillWeapon]++;
}
else if ( iBodyPart == HIT_LEFTARM )
{
iStatsLeftArm[iAttacker][iSkillWeapon]++;
}
else if ( iBodyPart == HIT_RIGHTARM )
{
iStatsRightArm[iAttacker][iSkillWeapon]++;
}
else if ( iBodyPart == HIT_LEFTLEG )
{
iStatsLeftLeg[iAttacker][iSkillWeapon]++;
}
else if ( iBodyPart == HIT_RIGHTLEG )
{
iStatsRightLeg[iAttacker][iSkillWeapon]++;
}
iStatsHits[iAttacker][iSkillWeapon]++;
iStatsShots[iAttacker][iSkillWeapon]++;
iStatsDamage[iAttacker][iSkillWeapon] += iDamage;
}
}
// Magical damage should go toward kill assist
g_iDamageDealt[iAttacker][iVictim] += iDamage;
new iHealth = get_user_health( iVictim );
// User has been killed
if ( iHealth - iDamage <= 0 )
{
WC3_Kill( iVictim, iAttacker, iWeapon, iHeadshot );
}
// Just do the damage
else
{
set_user_health( iVictim, iHealth - iDamage );
}
return;
}
When the undead explosion killed the bot, there is three lines of kill message shows in the upper right corner, looks like :
"epic kill xyz##"
"epic kill xyz##"
"epic kill xyz##"
(kill is a picture)
I think it`s not important, I just want to tell you how the undead explosion kill the bot
__________________