Help with an item script that applies bonus dmg to weapons
Atrophiederic
Member, Mobile Tester Posts: 147
Greetings, all!
I have been working on figuring out this script for a few weeks now. The concept is having an item that gives a 1d10 sonic damage bonus to a weapon targeted by the item's unique power.
I don't have a very firm grasp of scripting, so I have been using Lilac Soul's Script Generator heavily. I also open up modules to see how others have accomplished their scripting. But so far, resolution has eluded me.
Thank you, and Happy Hollidays!
I have been working on figuring out this script for a few weeks now. The concept is having an item that gives a 1d10 sonic damage bonus to a weapon targeted by the item's unique power.
I don't have a very firm grasp of scripting, so I have been using Lilac Soul's Script Generator heavily. I also open up modules to see how others have accomplished their scripting. But so far, resolution has eluded me.
#include "x2_inc_itemprop" void main() { effect eEffect; object oEventItem = GetItemActivated(); object oActTarget = GetItemActivatedTarget(); location lActTarget = GetItemActivatedTargetLocation(); object oActivator = GetItemActivator(); object oPC = oActivator; // Apply an effect. itemproperty ipAdd = ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_SONIC, IP_CONST_DAMAGEBONUS_1d10); eEffect = SupernaturalEffect(EffectDamageIncrease(DAMAGE_BONUS_1d10, DAMAGE_TYPE_SONIC)); ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oActTarget); // Float message over PC. FloatingTextStringOnCreature("Sonic Damage 1d10 added.", oPC); }Any help that can be offered is really appreciated!
Thank you, and Happy Hollidays!
0
Comments
The issue you're facing is caused by the use of an Effect on an item. Effects can only be applied to Creatures. Item Properties on the other hand can be applied to items so you're almost there:
Give that a shot and let me know if the problem is fixed.
Thank you so much for the speedy reply and help!
As soon as my NwN finishes updating, I will give it a spin!
The script works beautifully!
Only issue I'm seeing is it is applying the 1d10 property twice.
I don't see anything in the script that would prompt that.
Try:
I'm not sure why it would be adding twice unless another event is firing to add the IP. However IPSafeAdd.. will remove any existing versions of the IP.
An interesting tick, though ... The "FloatingTextStringOnCreature" still gives a double message.
Odd.
I may just remove that part completely, to alleviate the issue.
Regardless, friend @Aschent , I thank you so much for your help!