ForceRest

From NWN Lexicon
Revision as of 19:28, 24 August 2020 by Jasperre (talk | contribs) (→‎Remarks)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search



ForceRest(object)

Fully restores a creature

void ForceRest(
    object oCreature
);

Parameters

oCreature

Creature to rest


Description

Gives this creature the benefits of a rest (restored hit points, spells, feats, etc..)

It can be called if oCreature is in combat (Unlike ActionRest which will automatically fail) and so unless it is a wanted behavior, mind to make sure oCreature is not in combat first.



Remarks

The effects of this function occur instantly. The creature doesn't actually go into resting mode. Use ActionRest if that is what you want. No events fire for resting either (on NPC or PC).

Useful for replenishing a PC's abilities and things for custom resting systems, dreams, or cutscenes (in which they rest). For NPC's, it is a good way to make sure they will replenish all their feats and spells after a battle.

Only objects (creatures) who can rest can gain the benefits of this. Calling this on a placeable or door (another object with hit points), will, sadly, fail (you can replenish their hitpoints in other ways however).

Version

1.64

Example

void main()
{
    // Get Entering Object
    object oEnterer = GetEnteringObject();

    // Make sure it is a PC
    if(GetIsPC(oEnterer))
    {
        // Rest them
        ForceRest(oEnterer);

        // Floaty text - a wizard did it.
        FloatingTextStringOnCreature("A wizard decided to replenish your health and spells", oEnterer, FALSE);
    }
}

See Also

functions: 

ActionRest



 author: Lilac Soul, editor: Jasperre, additional contributor(s): Jasperre