// This script was designed to make a unique item that when worn, will
// check its bearer's health and if below 25% of their max hps it will heal them 33% of their
// max hps. (Example - max hps = 60. When wearer gets down to 15 hps or less, the belt
// will attempt to heal them for 20 hps.
//
// It will also give the bearer feedback via a text message and a spell effect.
// The item in this case is a belt with the tag "fellwaterslifegiver".
// This can be created in the item wizard, and no properties are needed on it. Just
// put a nice description so the owner knows what it does.
// Put this script on the module's onHeartbeat, and make a belt item with
// the appropriate tag. *Note* You can easily change the equipped slot location
// and item tag name to suit your needs, or the % when the heal happens or
// amount of healing.
//
// Please keep in mind, only one of this item should be in the module. Multiple
// copies will not work (1 should, but others won't). Anyway, an item like this
// should be unique to limit its power.
//
// Created by: Hotcarl
void main()
{
// Get who has the magic belt. Put your item's tag here.
object oTag = GetObjectByTag("fellwaterslifegiver");
object oPC = GetItemPossessor(oTag);
// Slot location. Can easily be changed.
object oItem = GetItemInSlot(INVENTORY_SLOT_BELT, oPC);
// Get the current, max, and calculated %'s of hps.
int iCurrentHPS = GetCurrentHitPoints(oPC);
int iMaxHPS = GetMaxHitPoints(oPC);
// When to heal.
int iDying = iMaxHPS / 4;
// Amount to heal.
int iHealAMT = iMaxHPS / 3;
// If the belt exists, and the owner is injured, heal them. Don't heal if they
// are dead.
if(oItem != OBJECT_INVALID)
if(iCurrentHPS <= iDying && iCurrentHPS > 0) {
SendMessageToPC(oPC, "Fellwater's Belt has activated its healing powers.");
ApplyEffectToObject(DURATION_TYPE_INSTANT,
EffectVisualEffect(VFX_IMP_HEALING_L),
oPC,3.5);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(iHealAMT), oPC);
} // end if
} // end main
|