cant find damage location

Read log files for errors! If this fails, come here for help

Moderator: Forum Moderator

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

cant find damage location

Post by whosyourdaddy » Fri Oct 10, 2008 10:22 pm

alright well im having an issue in trying to make skill reduce damage, i got these skills all set up but i have no idea in where to put it, i tried putting it in the wardens defence skill part but it doesnt seem to be working

Code: Select all

	iSkillLevel = SM_GetSkillLevel( iVictim, SKILL_MANASHIELD );
	if (iSkillLevel > 0)
		return ( floatround ( float( iDamage ) * ( 1 - p_manashield[iSkillLevel-1] ) ) );

	iSkillLevel = SM_GetSkillLevel( iVictim, SKILL_MITHIRLARMOR );
	if(iSkillLevel > 0) // Dwarf Mithril Armor
		if(iDamage >= p_mitharmor[iSkillLevel-1]+5)
			return ( floatround ( float( iDamage ) - ( p_mitharmor[iSkillLevel-1] ) ) );
		else
			return 0;

	iSkillLevel = SM_GetSkillLevel( iVictim, SKILL_FROSTARMOR );
	if(iSkillLevel > 0) // Lich Frost Armor
	{
		
		new Float:randomnumber = random_float(0.0,1.0)
		if (randomnumber <= p_frostarmor[iSkillLevel-1])
		{
			new armor = get_user_armor(iVictim); 
			if(armor >= iDamage) 
			{ 			
				set_user_armor(iVictim,armor-iDamage);
				return 0;
			}

		}

	}
Image

User avatar
Geesu
<b>King of the world!</b>
Posts: 3159
Joined: Tue Jul 05, 2005 9:24 pm
Contact:

Re: cant find damage location

Post by Geesu » Sat Oct 11, 2008 9:39 am

Warden's skill only reduces magic damage I believe...
No Support via PM

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

Re: cant find damage location

Post by whosyourdaddy » Sat Oct 11, 2008 12:57 pm

hmmmm so how do i reduce like gun damage?
Image

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

Re: cant find damage location

Post by whosyourdaddy » Sun Oct 12, 2008 2:26 am

geesu i found a way to make a damage reduce u can use hamsandwich to do this function... also mabye u can use this for the night elf evasion if the traceline isnt working correctly... never happened to me but i think ive heard some complaints on the forums where people said there screen went blue and it said they evaded a shot but really didnt, i made a new topic about it but mabye using this way would be better for making sure it doesnt do any damage at all

Code: Select all

RegisterHam(Ham_TakeDamage, "player", "EVENT_TakeDamage");

public EVENT_TakeDamage( iVictim, inflictor , iAttacker, Float:iDamage, damagetype )
{
//Inflictor is the entity that caused the damage (such as a gun).
// all ur if statements in here..... here are a couple of examples
	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 ) )
		{
			new iSkillLevel;

			// Check to see if this user has night elf's evasion
			if ( SM_GetSkillLevel( iVictim, SKILL_MANASHIELD ) > 0 )
			{
				iSkillLevel = SM_GetSkillLevel( iVictim, SKILL_MANASHIELD );
				if (iSkillLevel > 0 && !p_data_b[iVictim][PB_HEXED])
				{	
					new iHealth, Take,total;
					iHealth = get_user_health(iVictim);
					Take = floatround(iDamage * (1-p_manashield[iSkillLevel-1]));
					total = iHealth-Take;
					if(total <= 0)
						WC3_Kill( iVictim, iAttacker, inflictor, 0 );
					else
						set_user_health(iVictim, total);

					return HAM_SUPERCEDE

				}
			}
		}
	}

	return HAM_IGNORED
}
Image

User avatar
Geesu
<b>King of the world!</b>
Posts: 3159
Joined: Tue Jul 05, 2005 9:24 pm
Contact:

Re: cant find damage location

Post by Geesu » Mon Oct 13, 2008 10:13 pm

wait...wait...

does RegisterHam allow you to hook EVENT_TakeDamage BEFORE the damage is actually dealt? If so i'm changing this ASAP - I always HATED how i had to hack around it....

wish i wasn't on a mac right now (first time ever) so i could do some CS dev
No Support via PM

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

Re: cant find damage location

Post by whosyourdaddy » Tue Oct 14, 2008 9:32 pm

ya lets say u have the return suprecende or what ever it is, it stops all damage. it does the ham event before doing actual damage
Image

User avatar
Geesu
<b>King of the world!</b>
Posts: 3159
Joined: Tue Jul 05, 2005 9:24 pm
Contact:

Re: cant find damage location

Post by Geesu » Tue Oct 14, 2008 11:01 pm

Yea was tinkering w/it today while waiting for wow to update...

CZ bots were giving me trouble but got osme help on IRC - no ETA on release for this but i'm going to use it :P Once i can figure out how to determine what wpn did the damage hmmmm
No Support via PM

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

Re: cant find damage location

Post by whosyourdaddy » Tue Oct 14, 2008 11:31 pm

the inflictor = weapon
Image

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

Re: cant find damage location

Post by whosyourdaddy » Tue Oct 14, 2008 11:36 pm

i know this is off topic but by any chance if i make max_skills higher and add a new skill to every race, do i need to do anything special for cham other than change the for loops in the cham race skill section and add another g_chamskills in the skill manager?
Image

User avatar
Geesu
<b>King of the world!</b>
Posts: 3159
Joined: Tue Jul 05, 2005 9:24 pm
Contact:

Re: cant find damage location

Post by Geesu » Wed Oct 15, 2008 12:06 pm

whosyourdaddy wrote:the inflictor = weapon
Are you entirely sure? I thought that to at first but don't believe it's correct. If you get the classname of that ID (via pev) then it replies with "player". Also - sometimes the ID is too high to be a weapon ID. The weird part is - with grenades - it returns the class name of "grenade"

Can you shed some light? I've been away from this too long lol
No Support via PM

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

Re: cant find damage location

Post by whosyourdaddy » Wed Oct 15, 2008 3:43 pm

try doing a client print chat to the attacker saying ur using this weapon and see what it says

Code: Select all

client_print( iAttacker, print_chat, "Your Weapon id: %d", inflictor );
client_print( iAttacker, print_chat, "Your Weapon id: %s", inflictor );
not sure if it uses a name or weapon id number like 43 for a colt or something thats why theres one for number and one for weapon name depends how it says it itself %d uses number %s uses name.... i would test it out but im having issues with my cham skills
Image

Post Reply