I've placed the sound "insanity_imageflash01.snt" (as shown in the script) to start playing when i open the map, but i want it to play a few seconds later than it does. Not right away. I need to use a timer for this right? However the scripting is beyond me. Do i place the:
"void AddTimer(string& asName, float afTime, string& asFunction);" in void OnStart()? If so, how do i connect it to "insanity_imageflash01.snt"? Thanks
void OnStart()
{
wakeUp();
PlaySoundAtEntity("", "insanity_imageflash01.snt", "Player", 1, false);
AddEntityCollideCallback("Player", "Musik", "CollideStartMusic", true, 1);
AddEntityCollideCallback("Player", "Flaska", "PlaySound", true, 1);
AddEntityCollideCallback("Player", "Ljud", "start", true, 1);
AddUseItemCallback("", "Key", "Door", "UseKeyOnDoor", true);
AddUseItemCallback("", "Nyckel", "Rumpa", "UseKeyOnDoor", true);
AddUseItemCallback("", "Tillskap", "Skap", "UseKeyOnDoor", true);
}
void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "Unlock_door.snt", asEntity, 10, false);
RemoveItem(asItem);
}
void start(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "general_piano01.snt", "Player", 1, false);
}
void PlaySound(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "21_intro_scream.snt", "Player", 1, false);
}
void CollideStartMusic(string &in asParent, string &in asChild, int alState)
{
PlayMusic("02_amb_safe.ogg", false, 1.0f, 0, 0, true);
}
void wakeUp () {
FadeOut(0); // Instantly fades the screen out. (Good for starting the game)
FadeIn(30); // Amount of seconds the fade in takes
FadeImageTrailTo(8, 2);
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,200);
SetPlayerCrouching(false);
FadeImageTrailTo(0,1);
}