The code below assumes that your door is called "mansion_1" (without the quotes), and your monster is called "servant_brute_1" (without the quotes).
//The Waking Up Feature that starts as soon as map loads.
void wakeUp () {
FadeOut(0); // Instantly fades the screen out. (Good for starting the game)
FadeIn(20); // Amount of seconds the fade in takes
FadeImageTrailTo(2, 2);
FadeSepiaColorTo(100, 4);
SetPlayerActive(false);
FadePlayerRollTo(50, 220, 220); // "Tilts" the players head
FadeRadialBlurTo(0.15, 2);
SetPlayerCrouching(true); // Simulates being on the ground
AddTimer("trig1", 11.0f, "beginStory"); // Change '11.0f' to however long you want the 'unconciousness' to last
}
void beginStory(string &in asTimer){
ChangePlayerStateToNormal();
SetPlayerActive(true);
FadePlayerRollTo(0, 33, 33); // Change all settings to defaults
FadeRadialBlurTo(0.0, 1);
FadeSepiaColorTo(0, 4);
SetPlayerCrouching(false);
FadeImageTrailTo(0,1);
}
////////////////////////////
// Run first time starting map
void OnStart()
{
//Allows you to wake up
wakeUp();
//Add the Lantern and 10 Tinderboxes when in Debug mode, always good to have light!
if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");
for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
}
SetEntityPlayerInteractCallback("mansion_1", "InteractedWithDoor", true);
}
void InteractedWithDoor(string &in entity)
{
PlaySoundAtEntity("", "insanity_monster_roar02.ogg", "mansion_1", 0, false);
SetEntityActive("servant_brute_1", true); //Spawn monster
GiveSanityDamage(15.0f, true);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}