Hit Point Script Question
Zephirius
Member Posts: 419
I've got an OnActivateItem script here - I just want it to take into account the players current hit points and add d10(1) hit points from there???
When I test the script, a lot of the time I get a lower hit point number than I started out with, and I don't want that..
Anyway, any help is welcome.
Code so far:
When I test the script, a lot of the time I get a lower hit point number than I started out with, and I don't want that..
Anyway, any help is welcome.
Code so far:
// Poison Salve object oPC = GetItemActivator(); object oUsed1 = GetItemActivated(); if (GetTag(oUsed1) == "POISON_SALVE") { ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect (VFX_IMP_CHARM), oPC); int nCurHP = GetCurrentHitPoints(); SetCurrentHitPoints(oPC, nCurHP + d10()); RemoveSpecificEffect(EFFECT_TYPE_POISON, oPC); }
0
Comments
TR
Otherwise it will default to OBJECT_SELF, which, OnActivateItem, is the module, not the PC (because it's a module event script).
If the script is essentially about healing, you might not need to raise hit points above the maximum.
It can be done using EffectTemporaryHitpoints() but there are limitations, as that article explains.