View Single Post
  #1  
Old 04-26-2020, 11:46 AM
Elysius
Sarnak
 
Join Date: Dec 2005
Posts: 43
Default Adding +crit chance to items

I'd like to change the advanced item effect of Accuracy to a % increase to melee Critical Hit. Here's my code edit on attack.cpp (my addition in bold):

Code:
//2: Try Melee Critical

	//Base critical rate for all classes is dervived from DEX stat, this rate is then augmented
	//by item,spell and AA bonuses allowing you a chance to critical hit. If the following rules
	//are defined you will have an innate chance to hit at Level 1 regardless of bonuses.
	//Warning: Do not define these rules if you want live like critical hits.
	critChance += RuleI(Combat, MeleeBaseCritChance);

	if(IsClient())
		critChance += RuleI(Combat, ClientBaseCritChance);
		
		int ItemCritChance = itembonuses.HitChance;	
	
		critChance += ItemCritChance;

	bool IsBerserk = false;
	if(((GetClass() == WARRIOR || GetClass() == BERSERKER) && GetLevel() >= 12 && IsClient()))
	{
		if(CastToClient()->berserk){
			critChance += RuleI(Combat, BerserkBaseCritChance);
			IsBerserk = true;
		}

		else
			critChance += RuleI(Combat, WarBerBaseCritChance);
	}

	if(skill == SkillArchery && GetClass() == RANGER && GetSkill(SkillArchery) >= 65)
		critChance += 25;

	if(skill == SkillThrowing && GetClass() == ROGUE && GetSkill(SkillThrowing) >= 65)
		critChance += 6;

	int CritChanceBonus = GetCriticalChanceBonus(skill);
It compiles no problem, but now zone.exe will crash upon loading. I can't zone in from character select. Here's the error it throws at me in the log file:

Code:
04.26. - 09:12:14] ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 77146A14) 
[04.26. - 09:12:14] 77146A14 (KERNEL32): (filename not available): BaseThreadInitThunk 
[04.26. - 09:12:14] ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 7751AB4F) 
[04.26. - 09:12:14] 7751AB4F (ntdll): (filename not available): RtlInitializeExceptionChain 
[04.26. - 09:12:14] ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 7751AB1A) 
[04.26. - 09:12:14] 7751AB1A (ntdll): (filename not available): RtlInitializeExceptionChain
Any ideas what I did wrong? Thanks
Reply With Quote