Changing damage according to the object i hit

Hi There !

Ok i've got those 3 objects : Tree, Metal Ore and Advanced axe with basic scripts and abilities

I would like to change the damage coming from my axe according to which object i'm hitting. (Example 15 on Ore and 30 on Tree). Where and how sould i do that ?

If Someone can take a look and tell me it would be awesome !
Thanks

It's hard to say without seeing your weapon scripts, but if you are using the Advanced Axe weapon from the Core Game Components list, then you should have a script called EquipmentMeleeAttacksServer. In this script there is a function MeleeAttack(target, abilityInfo, hitResult). You can see some checks on the target and the construction of the damage structure. Initially the damage is set as abilityInfo.damage (from the damage parameter of the Attack Ability on the weapon). You can check what the target object is here and scale it accordingly. Be aware that if you change this script you change it for everything that uses it.

If you are using your own or someone else's weapon server script, you will need to post a copy of the script here (use </> code tags please).

Ok I'm gonna try that and come back with the result :wink:

Hard time to do all this with referencing and adding new custom properties but did it !

Thanks !

Glad you got it working.