No damage dealt if unarmed.

Hi everyone, I need a script that make any unarmed character deal 0 Damage to an enemy, like in the RPGXP, but, as my project have multiple Classes, I want to make only class x  be able to deal damage if unarmed, like a bare hand-fighter.

So, my request is:
1º Make characters with no weapon equipped deal 0 Damage.
2º Make only Class X be able to deal damage unarmed.

That's all. Any help will be appreciated.  🙂  
(Sorry for my bad English ;-; )
You can do this without a script.


In your attack skill, put this:

a.weapons.empty? && a.class_id != # ? 0 : a.atk * 4 - b.def * 2but where I put # in the formula, you put the class id (no leading zeros) of the class you want to be able to deal damage without a weapon equipped.
So that says, if the actor has no weapons and they are not in the "special" class, damage is 0, otherwise use the regular formula.


So if your class that can deal damage without having a weapon equipped is class 7, you'd put this:

Code:
a.weapons.empty? && a.class_id != 7 ? 0 : a.atk * 4 - b.def * 2
You can do this without a script.

In your attack skill, put this:

a.weapons.empty? && a.class_id != # ? 0 : a.atk * 4 - b.def * 2but where I put # in the formula, you put the class id (no leading zeros) of the class you want to be able to deal damage without a weapon equipped.So that says, if the actor has no weapons and they are not in the "special" class, damage is 0, otherwise use the regular formula.

So if your class that can deal damage without having a weapon equipped is class 7, you'd put this:

a.weapons.empty? && a.class_id != 7 ? 0 : a.atk * 4 - b.def * 2
Thanks for the reply, it really worked, but now, whenever an enemy attack, he deal 0 damage, even if I put 999 ATK points for them. X_X
ah, yeah - forgot enemies use the same skill

Code:
a.actor? && a.weapons.empty? && a.class_id != # ? 0 : a.atk * 4 - b.def * 2
hopefully that'll all fit in the available space
If you're lazy to do that to ALL of your skills, then this should do

class RPG::UsableItem:😀amage alias no_damage_eval eval def eval(a, b, v) return 0 if a.actor? && a.class_id != 7 && a.weapons.empty? return no_damage_eval(a,b,v) endendNote: Untested
I assumed it was only the attack skill, since the rest are actually skills, used from the Skill menu. Didn't even consider that it referred to all of them. If that's the case then, yeah, a script to do it would be better.
ah, yeah - forgot enemies use the same skill

a.actor? && a.weapons.empty? && a.class_id != # ? 0 : a.atk * 4 - b.def * 2hopefully that'll all fit in the available space
Thank you very much, it worked like I wanted 😀  

If you're lazy to do that to ALL of your skills, then this should do

class RPG::UsableItem:😀amage alias no_damage_eval eval def eval(a, b, v) return 0 if a.actor? && a.class_id != 7 && a.weapons.empty? return no_damage_eval(a,b,v) endendNote: Untested
It worked too like the formula provided by Shaz, but this script affect enemies too, they only deal 0 Damage x-x

But I think I will not need the formula to work on Skills, so, thanks for both of you  🙂  

EDIT: Sorry TheoAllen, the script worked to, I  configured wrong the Database, so, sorry and thanks again for both 😀

Original thread: https://forums.rpgmakerweb.com/threads/no-damage-dealt-if-unarmed.35998/