Author: Mr. Teabags
Author Website: n/a
Script Name: Useable Bedroll
Description: When used, the PC is put to sleep for a definable time (default 20 seconds) and regains health.
Instructions on Use: ...

Script 1:

void main()

{

    object oPlayer = GetLastUsedBy();

    object oBedBeddingRolls;

    if (GetIsPC(oPlayer))

    {

        oBedBeddingRolls = GetNearestObjectByTag ("BedBeddingRolls", oPlayer, 1);

        if (GetIsObjectValid(oBedBeddingRolls))

        {

            //The PC will be knocked unconscious for 20 seconds before awakening.

            ActionDoCommand( ApplyEffectToObject( DURATION_TYPE_TEMPORARY, EffectSleep(), oPlayer, 20.0) );

            int MaxHP = GetMaxHitPoints(oPlayer);

            //The PC will be fully healed.

            ActionDoCommand( ApplyEffectToObject( DURATION_TYPE_INSTANT, EffectHeal(MaxHP), oPlayer ));

            //The bed can give a message such as, "ZZZZZZZZzzzzzzzzzzzzz.....<PlayerName> is sleeping"

            SpeakOneLinerConversation();

        }

    }

}