Author Topic: Issues while trying to import rest system from HCR  (Read 406 times)

Legacy_KMdS!

  • Sr. Member
  • ****
  • Posts: 364
  • Karma: +0/-0
Issues while trying to import rest system from HCR
« Reply #15 on: June 12, 2016, 06:24:01 pm »


               

hehe, I see, yes, w/o a rest timer to restrict rest times, the HCR rest recovery alone would not accomplish your goal.


 


If your goal is to remove all rest healing, this is what you'll want



void main()
{
    object oPC = GetLastPCRested();

    if (GetLastRestEventType() == REST_EVENTTYPE_REST_STARTED)
    {
        SetLocalInt(oPC, "HPStartRest", GetCurrentHitPoints(oPC));
    }

    if (GetLastRestEventType() == REST_EVENTTYPE_REST_FINISHED || GetLastRestEventType() == REST_EVENTTYPE_REST_CANCELLED)
    {
        int iBeforeRestHP = GetLocalInt(oPC, "HPStartRest");
        int iCurrentHp = GetCurrentHitPoints(oPC);
        if(iCurrentHp > iBeforeRestHP)
        {
            int iDamage = iCurrentHp-iBeforeRestHP;
            //iDamage -= GetHitDice(oPC);
            //int iConBonus = GetAbilityModifier(ABILITY_CONSTITUTION, oPC);
            //if(iConBonus > 0)
                //iDamage -=iConBonus;
            if(iDamage >0)
            {
                effect eDamage = EffectDamage(iDamage, DAMAGE_TYPE_MAGICAL, DAMAGE_POWER_NORMAL);
                ApplyEffectToObject( DURATION_TYPE_INSTANT, eDamage, oPC);
            }
        }
        SetLocalInt(oPC, "HPStartRest", 0);
    }
}

This should strip them to pre-rest levels no mater what. I didn't remove the undesired code, only commented out the code,  so that you could implement it at some other date if so desired.