NE Evasion tweak / Bug #117

Want to talk about war3ft or make suggestions? Post them here

Moderator: Forum Moderator

Post Reply
Dr_Vrach
Peon
Posts: 2
Joined: Wed Aug 06, 2008 8:14 pm

NE Evasion tweak / Bug #117

Post by Dr_Vrach » Wed Aug 06, 2008 8:49 pm

Hello!

My friends and I found night elves evasion working in not appropriate way...
First shot is always not evaded, so do shots from pistols.

So now it works for every shot and only glowing/messaging now depends on last shot time.
We tested it on home server only, but tommorow we are testing this on professional one so ill post here results.
You can do same.
Here is code which we change to make evasion work better:

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 );
        //Some random mechanism a bit changed when experimenting;
        //This doesnt matter values are like always
	if (!p_data_b[id][PB_HEXED] && iSkillLevel > 0 && random_num( 1, 100 ) <= p_evasion[iSkillLevel-1] * 100 )
	{
                // HERE
		         // I dont know where def for this proc stored so 
                // i made global var in constants.inl
                // Ofcource its much better to take this (NE_lastshot) as parameter of proc;
                // look events.inl code below 
		if (NE_lastshot[id] < 0.1 && NE_lastshot[id] > 0.0) 
		{
			
			//Message player about evasion
                        //This came from events.inl
			WC3_StatusText( id, TXT_SKILL, "You have evaded a shot!" );
			
			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;
constants.inl:

Code: Select all

//This var is new and must go away when proc param tweaked
new Float: NE_lastshot[33]; 
events.inl:
in TRIGGER_TraceLine proc:

Code: Select all

			// Check to see if this user has night elf's evasion
			if ( SM_GetSkillLevel( iVictim, SKILL_EVASION ) > 0 )
			{
				// Do the check to see if we should "evade" this shot
				new Float:fTime = halflife_time();
				new Float:fDifference = fTime - fLastShotFired[iAttacker];
                               
                               //Here we save this value into var; but better would be to give it to NE_Evasion later
				NE_lastshot[iVictim] = fDifference;

				//Here we make to check every time now
                                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!
                                        // Here to modify param
					if ( NE_Evasion( iVictim, iHitZone ) )
					{
						set_tr( TR_flFraction, 1.0 );
						
						//WC3_StatusText( iVictim, TXT_SKILL, "You have evaded a shot!");
                                                //This gone to race_elf.inl
                                                
						return FMRES_SUPERCEDE;
					}
				}
			}
			
I made some comments from forum message editing, so sorry for spacing and maybe some [/color] left lol.
Regards.

UPD:
I found that as a partially solving problem of bug #117
As i understand, evasion must depend on aiming cause after shot done its too late.
So knives shots can be done without aiming on enemy thats a problem.
And HE damage is more harder to do with...

And we increased evasion values a bit, yes :D. To { 0.15, 0.21, 0.33}. :D

whosyourdaddy
Spell Breaker
Posts: 398
Joined: Sun Apr 27, 2008 10:11 pm

Re: NE Evasion tweak / Bug #117

Post by whosyourdaddy » Mon May 11, 2009 10:55 am

or u can just put it in event damage and u dont need to do last shot or when the first shot was just f they get damaged should they evade
Image

Post Reply