Page 1 of 1

How do increase damage done by spawns?

Posted: Thu Nov 19, 2009 4:34 pm
by Astal
Searched the forum but really couldnt find anything.. Anyone know off hand. I tried increasing strength and agi and it doesnt seem to do anything.

Is damage based on their level?

BTW i dont have any gear on my npcs, that probably also has to do with it but is there any way to increase their base damage without gear?

Re: How do increase damage done by spawns?

Posted: Sat Nov 21, 2009 6:36 am
by bolly
I'm not sure if this is the correct function to be looking at but i'm sure someone will clarify this later on. It does look like some things may not apply to NPCs or again this is just for players so hopefully someone can post more

Combat::MeleeAttack in combat.cpp

It checks if it's the primary or secondary being used then gets the damage type of the weapon involved and then queries the weapon damage for that weapon. Then it checks the resists on the victim and also adds some additional damage for monks and bruisers. Then it tries to add a crit chance. The crit chance seems to be determined on the attackers level / 3 + 5.

If its not a bruiser or monk then it goes to Combat::DamageSpawn which generally uses this
damage = (rand()%((int)(high_damage/2-low_damage/2) + low_damage/2)) + (rand()%((int)(high_damage/2-low_damage/2) + low_damage/2)); //this can be simplified by taking out the / 2, but I wanted the damage to be more consistent

so overall the low and high is based around the weapon rather than the attacker - if you take a look into the function NPC_AI::ProcessMelee which is in NPC_AI.cpp you can see it triggers Combat::MeleeAttack in combat.cpp

If the NPC is not wearing a weapon as would probably be likely in most cases then it determines the weapon min and weapon damage like this (seen in Entity::ChangePrimaryWeapon())

melee_combat_data.primary_weapon_damage_low = (int32)(1 + GetLevel() * .2);
melee_combat_data.primary_weapon_damage_high = (int32)(5 + GetLevel() * (GetLevel()/5));

then add this on top
melee_combat_data.primary_weapon_damage_high += (int32)(GetInfoStruct()->str / 10);

Hope that helps, i'm sure there's alot more involved but someone should be able to clarify for you, but as far as i can see Level and the strength of the NPC are the most important factors when the NPC is not wearing a weapon

Re: How do increase damage done by spawns?

Posted: Sat Nov 21, 2009 7:37 pm
by Astal
ok, its based on weapons then

Re: How do increase damage done by spawns?

Posted: Sat Nov 21, 2009 8:46 pm
by LethalEncounter
It is also based on the attacker's skill with the weapon. Originally I had strength being a factor in the damage calculation but it seems to have been removed. Guess I'll have to add it back :P