Now that I'm more awake, and well rested I can think better, the idea of my previous script is ok, but for what I was using it for, there was a simpler solution and that I could have more control over
The problem with sanity activated entities (when your sanity is low enough they spawn) is you have to be facing away from it before it will spawn
I wanted it to spawn in front of me
This script is activated on start by a simple timer that runs the reset function in the events, which loops back to the start, and starts my timed event
Timed Events: activate/fade entities & chaining multiple activate/fade events together and looping them back
What this script does in steps;
on start, create timer called
auto_start_scare to run the void script
initial_scare_delay after 5 seconds
// This runs when the map first starts
void OnStart()
{ //start "sanity scare" - comment out to disable!!!
AddTimer("auto_start_scare", 5, "initial_scare_delay");
}
This is the Intro to the script, it's where you will setup the initial start
(
NOT to be included into
void OnStart() )
void initial_scare_delay(string &in asTimer)
{
int init_loop_delay = RandFloat(2.0f, 5.0f); // Initial delay before looping starts
AddTimer("initial_scare_timer", init_loop_delay, "start_scare");
}
activate (fade in) first object, create random number for timer to run next script, This can be repeated several times making quiet an advanced scene, but simple is better
void start_scare(string &in asTimer)
{
SetPropActiveAndFade ("ghost_chair", true, 0.2f);//chair activation
int ghost_spawn_delay = RandFloat(15.0f, 45.0f);
AddTimer("ghost_spawn_timer", ghost_spawn_delay, "spawn_ghost");
}
this one fades out the entity and loops back to the start
void reset_scare(string &in asTimer)
{
//de-activate all and restart scare
SetPropActiveAndFade("ghost_man", false, 0.1f);
SetPropActiveAndFade("ghost_chair", false, 0.2f);
int loop_delay = RandFloat(2.0f, 5.0f);
AddTimer("reset_scare_timer", loop_delay, "start_scare");
}