ActionRest()

Causes the creature to rest.

void ActionRest();

Description

The calling creature will enter the rest modal mode.

This function is only applicable for creature type objects.

Note that ActionRest cannot be used in combat (GetIsInCombat()) and automatically fails. It also, as noted below, cancles actions, therefore it is not wise to assign it during combat.

It is useful for a conversation (which cannot be done in combat) which asks if you want to rest in an inn (or suchlike) and using AssignCommand, you can make the player rest when you want him to.



Remarks

ActionRest is added to the front of the action queue. If you want to add it as a normal action, you can call ActionDoCommand(ActionRest());

There is no default behavior for resting non-PC creatures (the OnRested default script is empty). So if you wish anything to happen, you have to code it yourself. Of course, the HP replenishment and spell and feat replenishment is automatic for any creature object.


Version

1.22

Example

// Action's Taken event. Jump the PC to a waypoint named "INN"
// Then, make them rest, after 5 seconds.
// Waypoint Should be in the same area as inn keeper.
void main()
{
    // Get the PC speaker and waypoint
    object oPC = GetPCSpeaker();
    object oWP = GetWaypointByTag("INN");

    // Jump the PC to the waypoint
    AssignCommand(oPC, JumpToObject(oWP));

    // Wait, and do resting.
    DelayCommand(5.0, AssignCommand(oPC, JumpToObject(oWP)));
}

See Also

functions: ForceRest | GetLastRestEventType
categories: Action on Object Functions


 author: Troels Therkelsen, editor: Jasperre, additional contributor(s): Lilac Soul
 Send comments on this topic.