FANDOM


To require an item to rest the following script can be used as the module's OnPlayerRest event handler. This script identifies the item by its tag ("FOOD", in this case).


// The tag of the item that is required for resting:
const string TAG_REST_ITEM = "FOOD";
 
 
void main()
{
    object oPC = GetLastPCRested();
 
    switch ( GetLastRestEventType() )
    {
        case REST_EVENTTYPE_REST_STARTED:
        {
            // The PC is starting to rest. Make sure this is allowed.
            object oFood = GetItemPossessedBy(oPC, TAG_REST_ITEM);
            if ( oFood == OBJECT_INVALID ) {
                // Prevent the PC from resting.
                AssignCommand(oPC,ClearAllActions());
                return;
            }
            // Consume the food.
            DestroyObject(oFood);
            break;
        }
    }
}

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.