• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[source editing] some help with FORMULA_SKILL

hallux

New Member
Joined
Feb 14, 2009
Messages
26
Reaction score
3
Location
United Kingdom
hey, i hope this is right section!! i am currently trying to make my spells relying on this "case" in combat.cpp a bit more accurate! ill show you my attempt then i will explain what i really want!

old code:
Code:
			case FORMULA_SKILL:
			{
				min = (int32_t)minb;
				Item* tool = player->getWeapon();
				if(const Weapon* weapon = g_weapons->getWeapon(tool))
				{
					max = (int32_t)(weapon->getWeaponDamage(player, target, tool, true) * maxa + maxb);
					if(params.useCharges && tool->hasCharges() && g_config.getBool(ConfigManager::REMOVE_WEAPON_CHARGES))
						g_game.transformItem(tool, tool->getID(), std::max((int32_t)0, ((int32_t)tool->getCharges()) - 1));
				}
				else
					max = (int32_t)maxb;

my attempt:
Code:
case FORMULA_SKILL:
			{
				Item* tool = player->getWeapon();
				if(const Weapon* weapon = g_weapons->getWeapon(tool))
				{
                         min = (int32_t)(weapon->getWeaponDamage(player, target, tool, true) * mina + minb);
                    
                    max = (int32_t)(weapon->getWeaponDamage(player, target, tool, true) * maxa + maxb);
					if(params.useCharges && tool->hasCharges() && g_config.getBool(ConfigManager::REMOVE_WEAPON_CHARGES))
						g_game.transformItem(tool, tool->getID(), std::max((int32_t)0, ((int32_t)tool->getCharges()) - 1));
                }

				else
					max = (int32_t)maxb;

this as you can see makes the min and max be able to be configured. However the problem is when you use "weapon->getWeaponDamage" you get the final damage so your damage is made random and can often hit 0 (a miss).

what i would like to do is perhaps get the pre-existing maxweapondamage from weapons.cpp and use that value to then be multiplied by mina or maxa..

i have a little experiance with c++ but go easy on me please :p

thanks!!

im using tfs 3.4pl2
 
Back
Top