Author: Hotcarl44
Author Website: n/a
Script Name: Fellwater's Lifegiver
Description: Heals the wearer of this belt 33% of their max hps whenever they go down to 25% of their hps or less. Example - You have 60 hps and have this belt on. When you get down to 15 hps or less, you will be healed for 20 hps.
Instructions on Use: Put this script in your module's OnHeartbeat, then create a belt item with the tag "fellwaterslifegiver". You don't have to assign any properties to the belt, but a nice description is always handy for the players.
Author Notes: This is a very cool item that will continually try to heal the person wearing it. When it does, a message will be sent to the player and a heal effect will appear. Because of its nature, you should only make 1 available in your module at any time. Multiple copies will not work. Also, many of the parameters can easily be changed to alter the effects. Look at the script comments to see how/where. Example- You could make the item an overly-powerful weapon (change the tag line and the equipped slot checker), and have it hurt the user if they get to 25% health (change the spell happening on them and the visual effect) to balance out the power. In essence, this item would do great damage for the user, but then to the user if they aren't careful. Cool stuff.

Script 1 (Module OnHeartbeat):

// 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