Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Delay sound from playing
LDOriginal Offline
Junior Member

Posts: 35
Threads: 7
Joined: Oct 2014
Reputation: 0
#6
RE: Delay sound from playing

A new timer related problem i'm trying to solve. I have a script area placed and when collided with, a screen effect takes place. I want this to stop after 10 seconds but i'm not getting the scripting done. The effect just goes on. Been trying several things from advices and explanations. But it's not going so well. Am i close to getting it to work?
void OnStart()

{
AddEntityCollideCallback("Player", "Snurrig", "CollideFadeImageTrailTo", true, 1);
wakeUp();
AddTimer("timername", 11.5f, "TimerFunction");
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(20);      // Amount of seconds the fade in takes
    FadeImageTrailTo(6, 2);
    FadeSepiaColorTo(0, 0);
    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);
}

void TimerFunction(string &in asTimer)
{
     PlaySoundAtEntity("TimerFunction", "insanity_imageflash01.snt", "Player", 1, false);
}

void CollideFadeImageTrailTo(string &in asParent, string &in asChild, int alState)
{
FadeImageTrailTo(6, 2);
AddTimer("this_is_just_a_timer_name", 10.0f, "CollideFadeImageTrailTo");  
}

void MyFunc(string &in asTimer)
{
FadeImageTrailTo(0,1);
}
(This post was last modified: 02-04-2015, 11:52 PM by LDOriginal.)
02-04-2015, 11:50 PM
Find


Messages In This Thread
Delay sound from playing - by LDOriginal - 02-03-2015, 03:55 PM
RE: Delay sound from playing - by Mudbill - 02-03-2015, 04:06 PM
RE: Delay sound from playing - by LDOriginal - 02-03-2015, 04:46 PM
RE: Delay sound from playing - by Mudbill - 02-03-2015, 06:20 PM
RE: Delay sound from playing - by LDOriginal - 02-03-2015, 07:14 PM
RE: Delay sound from playing - by LDOriginal - 02-04-2015, 11:50 PM



Users browsing this thread: 1 Guest(s)