Page 1 of 1
possible elf evasion fix
Posted: Sat Oct 11, 2008 5:38 pm
by whosyourdaddy
alright well i know people comaplined about the elf evasion not working on scoutz maps and i think i found out why
Code: Select all
// Do the check to see if we should "evade" this shot
new Float:fTime = halflife_time();
new Float:fDifference = fTime - fLastShotFired[iAttacker];
if ( SHARED_ValidPlayer( iAttacker ) && fDifference < 0.1 && fDifference > 0.0 )
{
// 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 FMRES_IGNORED;
}
}
// Then we should evade this shot!
if ( NE_Evasion( iVictim, iHitZone ) )
{
set_tr( TR_flFraction, 1.0 );
WC3_StatusText( iVictim, TXT_SKILL, "You have evaded a shot!" );
return FMRES_SUPERCEDE;
}
}
notice this part of it
Code: Select all
new Float:fTime = halflife_time();
new Float:fDifference = fTime - fLastShotFired[iAttacker];
if ( SHARED_ValidPlayer( iAttacker ) && fDifference < 0.1 && fDifference > 0.0)
doesnt that mean that the shots prety much have to be shot like .09 seconds before the last for it to qualify meaning it has to be an auto machine gun... or i might be wrong but that might be the reason why
Re: possible elf evasion fix
Posted: Mon Oct 13, 2008 10:11 pm
by Geesu
Nice catch

But I know there was a purpose to the fLastShotFired and fDifference code - anyone (yes I know that should be me - but I created it like a year ago + didn't comment it well) have any ideas as to why?
Re: possible elf evasion fix
Posted: Tue Oct 14, 2008 9:31 pm
by whosyourdaddy
naw im not sure why
Re: possible elf evasion fix
Posted: Wed Jan 14, 2009 12:36 pm
by whosyourdaddy
no this is not the fix this is the reason why its not working, the main purpose of the last shot check was to make sure it doesnt just activate the skill or item (helm) or what ever, since they are looking at u the last shot is a check to see if there shooting and if they are then it puts these skills in effect, the only problem is that it wont work on first attacks and it needs to be a machine gun or fast attacks (switching weapons while aiming at some1 also activates this and u will get random evade shot if elf and no1 is shooting). best fix is to put it in ham_event damage and if u get the call to evade or block damage u can return ham_supercede. i also believe yama is working on an event damage himself which might come out in the update soon
Re: possible elf evasion fix
Posted: Thu Jan 15, 2009 11:50 pm
by whosyourdaddy
i just edited my own files and put the elf evasion in my event_damage part and it works great for me, they have a chance to dodge % of the time no matter what the weapon or gun is
Re: possible elf evasion fix
Posted: Fri Jan 16, 2009 1:18 pm
by whosyourdaddy
this is what i have in war3ft.sma add this with the other register things
Code: Select all
RegisterHam(Ham_TakeDamage, "player", "EVENT_TakeDamage");
in events i did this
Code: Select all
new UserHit[33];
// 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));
new Float:gametime = get_gametime()
// 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 ) );
}
}
// Check for Big Bad Voodoo's ultimate!
if ( p_data_b[iVictim][PB_GODMODE] )
{
new bool:bBlockDamage = true;
// Do we allow this person to be attacked by this player?
if ( p_data_b[iAttacker][PB_BIGBAD_ATTACKER] )
{
bBlockDamage = false;
}
// Check to see if immunity is available for the attacker
else 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 );
}
// Block the damage!
if ( bBlockDamage )
{
set_tr( TR_flFraction, 1.0 );
return FMRES_SUPERCEDE;
}
}
}
}
return FMRES_IGNORED;
}
public EVENT_TakeDamage( iVictim, inflictor, iAttacker, Float:iDamagee, 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_SUPERCEDE;
new iHitPlace
new icrap
new iWeapon = weapon(iAttacker)
if(IsGrenade ( inflictor ))
iWeapon = CSW_HEGRENADE;
//Check where the watched player has shot the bot
get_user_attacker( iVictim , icrap , iHitPlace )
// 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;
}
}
// 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(iDamagee);
// 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 );
// Head shot
if ( iHitPlace & HIT_HEAD )
iGlowIntensity += 250;
else
iGlowIntensity += 75;
// Make the user glow!
SHARED_Glow( iVictim, 0, 0, iGlowIntensity, 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;
}
}
g_iDamageDealt[iAttacker][iVictim] += iDamage;
// Bot should "auto" cast his/her ultimate on random
if ( SHARED_ValidPlayer( iAttacker ) && is_user_bot( iAttacker ) && random_num( 0, 100 ) <= ( BOT_CAST_ULT_CHANCE * 100 ) )
{
// Check for an actual ultimate is done in this function, why do it twice?
cmd_Ultimate( iAttacker );
}
// We need to make sure that we have a valid attacker and the user isn't hexed
if ( SHARED_ValidPlayer( iAttacker ) && !p_data_b[iAttacker][PB_HEXED] )
{
// Run the offensive spells
UD_SkillsOffensive( iAttacker, iDamage );
HU_SkillsOffensive( iAttacker, iVictim );
OR_SkillsOffensive( iAttacker, iVictim, iWeapon, iDamage, iHitPlace );
NE_SkillsOffensive( iAttacker, iVictim, iWeapon, iDamage, iHitPlace );
BM_SkillsOffensive( iAttacker, iVictim, iDamage );
SH_SkillsOffensive( iAttacker, iVictim );
WA_SkillsOffensive( iAttacker, iVictim, iHitPlace );
CL_SkillsOffensive( iAttacker, iVictim, iHitPlace );
}
// Make sure we can run the defensive skills
if ( SHARED_ValidPlayer( iAttacker ) && !p_data_b[iVictim][PB_HEXED] )
{
//UD_SkillsDefensive( iAttacker, iVictim, iWeapon, iDamage, iHitPlace );
//HU_SkillsDefensive( iAttacker, iVictim, iWeapon, iDamage, iHitPlace );
//OR_SkillsDefensive( iAttacker, iVictim, iWeapon, iDamage, iHitPlace );
NE_SkillsDefensive( iAttacker, iVictim, iDamage, iHitPlace );
BM_SkillsDefensive( iVictim, iDamage );
SH_SkillsDefensive( iAttacker, iVictim );
//WA_SkillsDefensive( iAttacker, iVictim, iWeapon, iDamage, iHitPlace );
CL_SkillsDefensive( iAttacker, iVictim, iDamage, iHitPlace );
}
// Item abilities
if ( SHARED_ValidPlayer( iAttacker ) )
ITEM_Offensive( iAttacker, iVictim, iWeapon, iDamage, iHitPlace );
}
}
return HAM_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;
}
weapon(iTarget)
{
new crap,iWpnNum;
iWpnNum = get_user_weapon(iTarget, crap, crap);
return iWpnNum;
}
and i deleted client_damage function
Re: possible elf evasion fix
Posted: Fri Jan 16, 2009 6:55 pm
by whosyourdaddy
ya forgot i made some additions to my plugin and changed some things around there, can u post ur event.inl and race_blood.inl and race_elf.inl
Re: possible elf evasion fix
Posted: Mon Jan 19, 2009 2:29 am
by whosyourdaddy
try these, i did nothing to blood mage so no worries on that
Re: possible elf evasion fix
Posted: Mon Jan 19, 2009 2:21 pm
by whosyourdaddy
well no im my blood mage i removed some things and added it into the event since i got an item that blocks banish and all so i just needed to see how urs was let me fix the event.inl for u
edit: try this event and i put all ur custom things but changed the events only this time
Re: possible elf evasion fix
Posted: Tue Jan 20, 2009 3:11 pm
by whosyourdaddy
hmm really ill look into it
Re: possible elf evasion fix
Posted: Tue Jan 20, 2009 5:41 pm
by whosyourdaddy
try this
Re: possible elf evasion fix
Posted: Wed Jan 21, 2009 1:03 pm
by whosyourdaddy
so everything working fine now?
Re: possible elf evasion fix
Posted: Wed Jan 21, 2009 1:19 pm
by whosyourdaddy
umm kinda u need to change some codes around to use the newer modules instead of the older models that usually helps. also depends if u added things of ur own and how u have those running
Re: possible elf evasion fix
Posted: Wed Jan 21, 2009 2:18 pm
by whosyourdaddy
kk answer these questions have u ever made any custom skills of ur own or have u modified anything that has to do with the server engine changing things
Re: possible elf evasion fix
Posted: Wed Jan 21, 2009 5:14 pm
by whosyourdaddy
hmm which constants did u modify?
Re: possible elf evasion fix
Posted: Wed Jan 21, 2009 10:42 pm
by whosyourdaddy
hmm im not sure then
Re: possible elf evasion fix
Posted: Thu Jan 22, 2009 8:19 pm
by whosyourdaddy
nwa svc_bad is sometimes a steam thing or bad error used too many times just keep ur version updated with yami's and over time he should hopefully convert everything using the newest versions for things to prevent this from happening
Re: possible elf evasion fix
Posted: Fri Jan 30, 2009 3:36 pm
by Nextra
The following is only brainstorming, somehow

According to this tutorial by VEN of Alliedmodders.com
http://forums.alliedmods.net/showthread.php?t=49395 you can distinguish tracelines for shot particles from tracelines for the player aiming.
Let's review the script that will show how to:
* filter out fired particle trace
I assume this is what the fLastShotFired is all about and using this method by VEN you could possibly eliminate this imprecise check. This may be a solution to this
http://wc3mods.net/bugs/?do=details&task_id=117.
First tests did not produce any false positives under normal circumstances. Evasion set to 100% evaded 100% as desired without any shot goin through. Not saying that this fixes any of the problems but it is worth a try

I made a demo if someone cares ^^ I'm using this method on our regular server now and see how it goes on.
Would be glad if someone could confirm this, and sorry for posting in this old thread
I believe that this would also render these (
http://wc3mods.net/bugs/?do=details&task_id=128 ) modification unnecessary, as a viewing trace will never go through a wall
Code: Select all
new g_normalTrace[33];
in client_disconnect( id )
{
g_normalTrace[id] = 0;
}
Re: possible elf evasion fix
Posted: Fri Feb 06, 2009 1:52 pm
by Nextra
Bump, you should really take a look at this. It's used on my servers for one week now and no problems yet (afaik).
Re: possible elf evasion fix
Posted: Wed Feb 11, 2009 7:52 am
by Nextra
Only using the TraceLine function is not enough. You need to add the global Array and the reset on disconnect as well. However, I had absolutely no issues with my version up to this day, so I have no idea where your problem resides.
Re: possible elf evasion fix
Posted: Thu Feb 12, 2009 10:55 am
by Nextra
Sorry but I do not see any relation to the topic. Please start a new thread as this has nothing to do with elf evasion.
Re: possible elf evasion fix
Posted: Fri Feb 13, 2009 7:07 pm
by whosyourdaddy
Owyn wrote:also some errors =\
02/10/2009 - 06:25:48: Start of error session.
L 02/10/2009 - 06:25:48: Info (map "de_ftac3") (file "addons/amxmodx/logs/error_20090210.log")
L 02/10/2009 - 06:25:48: [CSTRIKE] Invalid player 3
L 02/10/2009 - 06:25:48: [AMXX] Displaying debug trace (plugin "war3ft.amxx")
L 02/10/2009 - 06:25:48: [AMXX] Run time error 10: native error (native "log_amx")
L 02/10/2009 - 06:25:48: [AMXX] [0] events.inl::on_Death (line 102)
L 02/10/2009 - 06:25:48: [AMXX] [1] events.inl::client_death (line 75)
Code: Select all
// All we want to check is if the user was killed by the bomb
public client_death( iAttacker, iVictim, iWeapon, hitplace, TK )
{
// Counter-Strike and Condition Zero Checks
if ( g_MOD == GAME_CSTRIKE || g_MOD == GAME_CZERO )
{
// Check out who the inflictor was
new iInflictor = entity_get_edict( iVictim, EV_ENT_dmg_inflictor );
// Check to see if the death was from the bomb
if ( !SHARED_ValidPlayer( iInflictor ) && iWeapon != CSW_HEGRENADE && iInflictor )
{
if ( is_valid_ent ( iInflictor ) )
{
new szClassName[64];
entity_get_string( iInflictor, EV_SZ_classname, szClassName, 63 );
// Check the classname of our inflictor
if ( equali( szClassName, "grenade" ) || equali( szClassName, "env_explosion" ) )
{
iWeapon = CSW_C4;
iAttacker = 0;
// Well if this isn't set, shouldn't it be?
if ( !p_data_b[iVictim][PB_DIEDLASTROUND] )
{
on_Death( iVictim, iAttacker, iWeapon, 0 );
}
//client_print( iVictim, print_chat, "[DEBUG] You were just killed by the bomb (%s) Alive? %d", szClassName, is_user_alive( iVictim ) );
}
}
}
}
}
public on_Death( iVictim, iAttacker, iWeaponID, iHeadshot )
{
if ( !WC3_Check() )
{
return;
}
// Counter-Strike and Condition Zero Checks
if ( g_MOD == GAME_CSTRIKE || g_MOD == GAME_CZERO )
{
// For some reason the damage passed by explosions is not actually correct (perhaps armor adjustments weren't done yet), so lets check
if ( is_user_alive( iVictim ) && iWeaponID == CSW_C4 )
{
return;
}
// Check for NightVision
p_data_b[iVictim][PB_NIGHTVISION] = (cs_get_user_nvg( iVictim )) ? true : false;
// Check if a user had a shield on death
p_data_b[iVictim][PB_SHIELD] = (cs_get_user_shield( iVictim )) ? true : false;
// See if the user has a defuse kit
p_data_b[iVictim][PB_DEFUSE] = (cs_get_user_defuse( iVictim )) ? true : false;
// Save the number of flash grenades the user has
p_data[iVictim][P_FLASHCOUNT] = cs_get_user_bpammo( iVictim, CSW_FLASHBANG );
// Check to see if weapons were silenced on death
new iWeaponUSPEnt = find_ent_by_owner( -1, "weapon_usp", iVictim );
new iWeaponM4A1Ent = find_ent_by_owner( -1, "weapon_m4a1", iVictim );
if ( is_valid_ent( iWeaponUSPEnt ) )
{
p_data_b[iVictim][PB_USP_SILENCED] = cs_get_weapon_silen( iWeaponUSPEnt ) ? true : false;
}
if ( is_valid_ent( iWeaponM4A1Ent ) )
{
p_data_b[iVictim][PB_M4A1_SILENCED] = cs_get_weapon_silen( iWeaponM4A1Ent ) ? true : false;
}
// Check to see if weapons were in burst mode on death
new iWeaponGlock18Ent = find_ent_by_owner( -1, "weapon_glock18", iVictim );
new iWeaponFamasEnt = find_ent_by_owner( -1, "weapon_famas", iVictim );
if ( is_valid_ent( iWeaponGlock18Ent ) )
{
p_data_b[iVictim][PB_GLOCK_BURST] = cs_get_weapon_burst( iWeaponGlock18Ent ) ? true : false;
}
if ( is_valid_ent( iWeaponFamasEnt ) )
{
p_data_b[iVictim][PB_FAMAS_BURST] = cs_get_weapon_burst( iWeaponFamasEnt ) ? true : false;
}
}
// Day of Defeat Checks
else if ( g_MOD == GAME_DOD )
{
// Save the user's origin for reincarnation
get_user_origin( iVictim, iReincarnation[iVictim] );
}
WC3_Death( iVictim, iAttacker, iWeaponID, iHeadshot );
return;
}
ill need the whole file
Re: possible elf evasion fix
Posted: Tue Feb 24, 2009 12:52 pm
by whosyourdaddy
are u using rc13 or the1 i posted?
Re: possible elf evasion fix
Posted: Tue Feb 24, 2009 2:49 pm
by whosyourdaddy
try these
Re: possible elf evasion fix
Posted: Tue Feb 24, 2009 4:20 pm
by whosyourdaddy
im not too good in making it show the color but i attacked the shadow because i was speaking to some1 else over pm's and i kinda upgraded the code i think im not too sure and he said it works fine not sure what i really did to it i think it was a log error he kept on getting but ill look into the resistant skill
edted: here try this
Re: possible elf evasion fix
Posted: Tue Feb 24, 2009 5:32 pm
by whosyourdaddy
you dont really need to rename it to skill2 and all but what ever floats ur boat
Re: possible elf evasion fix
Posted: Sun Feb 21, 2010 5:35 am
by whosyourdaddy
what are ur compiling errors
Re: possible elf evasion fix
Posted: Mon Feb 22, 2010 5:22 pm
by whosyourdaddy
i dont think ur using what i posted cause i got no idea where icearrowlist is coming from
Re: possible elf evasion fix
Posted: Tue Feb 23, 2010 10:31 am
by YamiKaitou
Okay, I'm probably being stupid here, but what code needs to be implemented? If someone can let me know, I will gladly add it to the SVN if it hasn't already been done
Re: possible elf evasion fix
Posted: Tue Feb 23, 2010 5:46 pm
by whosyourdaddy
ill post new files 2morrow
Re: possible elf evasion fix
Posted: Mon Mar 01, 2010 3:22 pm
by whosyourdaddy
kk use these events.inl and race_elf.inl and then open constants.inl and at the end add
at the end