OnPlayerRest
The script attached to this event fires when a player attempts to rest, cancels resting, or resting is finished. It can be used to spawn some creatures around the PC to constantly badger him or her and prevent a successful rest in some areas or prevent natural healing altogether from a curse bestowed upon the player.
Trigger
When the player presses the "Rest" button (starting or cancelling a rest) or when the rest is finished.
Function(s)
GetLastPCRested()
returns the PC of the player who just clicked the "Rest" button.
GetLastRestEventType()
returns one of the REST_EVENTTYPE_REST_* constants to determine what caused this event to fire.
Remarks
If you want to control when a PC can rest, capture this event when GetLastRestEventType() returns REST_EVENTTYPE_REST_STARTED; then use AssignCommand() on the PC to ClearAllActions(). This prevents the attempted rest from completing.
Example
// prevents a PC from resting // period void main { object oPC = GetLastPCRested(); // capture begin rest attempts if (GetLastRestEventType() == REST_EVENTTYPE_REST_STARTED) { // fun, fun, fun! AssignCommand(oPC, ClearAllActions()); } }
See Also
Objects with Events | Module | |
functions: | GetLastPCRested | GetLastRestEventType |
Send comments on this topic.