well heres a fix to evasion, since evasion is run by shooting time atm it wont register with scouts or pistols or even if u shoot one by one with a machine gun
for EVENT_TakeDamage and traceline i have this (also added gernade check)
Code: Select all
// HamSandwich implementation
// HamSandwich implementation
public EVENT_TakeDamage( iVictim, inflictor, iAttacker, Float:f_Damage, damagetype )
{
if ( !WC3_Check() )
{
return HAM_IGNORED;
}
// Make sure we have a valid victim
if ( SHARED_ValidPlayer( iVictim ) && p_data_b[iVictim][PB_ISCONNECTED] )
{
// We need to have a valid player!
if ( SHARED_ValidPlayer( iAttacker ) && p_data_b[iAttacker][PB_ISCONNECTED] )
{
if(iAttacker == iVictim)
return HAM_IGNORED;
if ( get_user_team( iAttacker ) == get_user_team( iVictim ) && !get_pcvar_num( CVAR_mp_friendlyfire ))
return HAM_IGNORED;
new iWeapon = get_user_weapon(iAttacker)
if(IsGrenade ( inflictor ))
iWeapon = CSW_HEGRENADE;
// This is a nice check for Helm of Excellence
if ( ITEM_Has( iVictim, ITEM_HELM ) > ITEM_NONE && iWeapon != CSW_HEGRENADE)
{
// If its a headshot then we want to block it
if ( UserHit[iVictim] )
{
Create_ScreenFade( iVictim, (1<<10), (1<<10), (1<<12), 0, 0, 255, 150 );
// Lets remove a charge from the helm!
ITEM_RemoveCharge( iVictim, ITEM_HELM );
return HAM_SUPERCEDE;
}
}
// Check for Big Bad Voodoo's ultimate!
if ( p_data_b[iVictim][PB_GODMODE] && !p_data_b[iAttacker][PB_BIGBAD_ATTACKER])
{
if ( ULT_CanUserBlockUlt( iAttacker ) )
{
// Remove charge and display message to attacker
ULT_RemoveCharge( iAttacker, 1 );
// Display message about user's ultimate being blocked!
ULT_Blocked( iVictim );
// This user can attack someone with big bad voodoo!
p_data_b[iAttacker][PB_BIGBAD_ATTACKER] = true;
// Reset the attacker dmg
set_task( get_pcvar_float( CVAR_wc3_ult_cooldown ), "_SH_ResetBigBadAttacker", TASK_BIGBADATTACKER + iAttacker );
}
else
return HAM_SUPERCEDE;
}
// Mole protectant
if ( p_data_b[iAttacker][PB_MOLE] && ITEM_Has( iVictim, ITEM_PROTECTANT ) > ITEM_NONE )
{
client_print( iVictim, print_chat, "%s %L", g_MODclient, iVictim, "SHOT_DEFLECTED" );
return HAM_SUPERCEDE;
}
static iSkillLevel;
new iDamage = floatround(f_Damage);
// Check to see if this user has night elf's evasion
if ( SM_GetSkillLevel( iVictim, SKILL_EVASION ) > 0 )
{
iSkillLevel = SM_GetSkillLevel( iVictim, SKILL_EVASION );
// Friendly fire is off! - This means we shouldn't evade since no damage will be done!
if ( !get_pcvar_num( CVAR_mp_friendlyfire ) )
if ( g_iPlayerTeam[iAttacker] == g_iPlayerTeam[iVictim] )
return HAM_SUPERCEDE;
// Then we should evade this shot!
if ( !p_data_b[iVictim][PB_HEXED] && random_float( 0.0, 1.0 ) <= p_evasion[iSkillLevel-1] )
{
new iGlowIntensity = random_num( 20, 50 );
if ( iDamage > 50 )
iGlowIntensity += 250;
else
iGlowIntensity += 75;
// Make the user glow!
SHARED_Glow( iVictim, 0, 0, 250, 0 );
Create_ScreenFade( iVictim, (1<<10), (1<<10), (1<<12), 0, 0, 255, g_GlowLevel[iVictim][2] );
WC3_StatusText( iVictim, TXT_SKILL, "You have evaded a shot!" );
return HAM_SUPERCEDE;
}
}
}
}
return HAM_IGNORED;
}
// Called when a user looks somewhere
public TRIGGER_TraceLine( Float:v1[3], Float:v2[3], noMonsters, pentToSkip )
{
if ( !WC3_Check() )
{
return FMRES_IGNORED;
}
new iAttacker = pentToSkip;
new iVictim = get_tr(TR_pHit);
new iHitZone = (1 << get_tr(TR_iHitgroup));
// Make sure we have a valid victim
if ( SHARED_ValidPlayer( iVictim ) && p_data_b[iVictim][PB_ISCONNECTED] )
{
// We need to have a valid player!
if ( SHARED_ValidPlayer( iAttacker ) )
{
if ( iHitZone & (1 << 1) )
UserHit[iVictim] = 1
else
UserHit[iVictim] = 0
// This is a check for ultimates that need to "search" for a target
if ( p_data_b[iAttacker][PB_ISSEARCHING] )
{
// Now lets make sure the person he's looking at is in view and isn't on the same team
if ( get_user_team( iAttacker ) != get_user_team( iVictim ) ) //&& UTIL_EntInView( iAttacker, iVictim ) )
{
// Check to see if the user should block this ultimate!
if ( !g_EndRound && ULT_CanUserBlockUlt( iVictim ) )
{
ULT_RemoveCharge( iVictim, 0 );
ULT_Blocked( iAttacker );
}
// Then the user's ult should work!
else
{
// Well we do have a target so lets execute the user's ultimate!!
if ( SM_GetSkillLevel( iAttacker, ULTIMATE_CHAINLIGHTNING ) > 0 )
{
OR_ULT_ChainLightning( iAttacker, iVictim, iHitZone );
}
else if ( SM_GetSkillLevel( iAttacker, ULTIMATE_ENTANGLE ) > 0 )
{
NE_ULT_Entangle( iAttacker, iVictim );
}
else if ( SM_GetSkillLevel( iAttacker, ULTIMATE_IMMOLATE ) > 0 )
{
BM_ULT_Immolate( iAttacker, iVictim );
}
}
// No longer searching since we found a target
p_data_b[iAttacker][PB_ISSEARCHING] = false;
// Set up the user's ultimate delay
ULT_ResetCooldown( iAttacker, get_pcvar_num( CVAR_wc3_ult_cooldown ) );
}
}
}
}
return FMRES_IGNORED;
}
bool:IsGrenade ( i_Inflictor ) {
static s_Classname[ 8 ];
pev ( i_Inflictor, pev_classname, s_Classname, charsmax ( s_Classname ) );
return equal ( s_Classname, "grenade" ) ? true : false;
}
also remove this from on_curweapon
Code: Select all
// Record the last time a shot was fired
fLastShotFired[id] = halflife_time();
then i removed from race_elf.inl
Code: Select all
NE_Evasion( id, iHitZone )
{
static iSkillLevel;
// Check to see if they should evade this shot?
iSkillLevel = SM_GetSkillLevel( id, SKILL_EVASION );
if ( !p_data_b[id][PB_HEXED] && iSkillLevel > 0 && random_float( 0.0, 1.0 ) <= p_evasion[iSkillLevel-1] )
{
new iGlowIntensity = random_num( 20, 50 );
// Head shot
if ( iHitZone & (1 << HITGROUP_HEAD) )
{
iGlowIntensity += 250;
}
// Chest
else if ( iHitZone & (1 << HITGROUP_CHEST) )
{
iGlowIntensity += 75;
}
// Make the user glow!
SHARED_Glow( id, 0, 0, iGlowIntensity, 0 );
Create_ScreenFade( id, (1<<10), (1<<10), (1<<12), 0, 0, 255, g_GlowLevel[id][2] );
return 1;
}
return 0;
}
remove from constants.inl
Code: Select all
// Used with helm
new Float:fLastShotFired[33];
and add
Code: Select all
//where user is aiming
new UserHit[33]