Frictional Games Forum (read-only)
[SCRIPT] Can someone help me with a sequence - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] Can someone help me with a sequence (/thread-23470.html)



Can someone help me with a sequence - Hauken - 10-01-2013

So I followed a tutorial for doing a intro with logo and everything, after finishing it i trapped myself in a script of format im not used to do.

Here is the finished intro script, the goal is to add wakeup script which I already have.

PHP Code:
////////////////////////////
// Run first time starting map
void OnStart()
{
    
AddUseItemCallback("""Key_1""door1""FUNCTION"true);
    
SetEntityPlayerInteractCallback("Key_1""PickedUpKey"true);
    
SetEntityPlayerInteractCallback("phonograph_2""phono1"true);
    
//PlayMusic("/music/06_amb", true, 1, 0, 0, true);
    
AddEntityCollideCallback("Player""script_wellwhine""func_whine"true1);
    
AddEntityCollideCallback("Player""script_prision_slammer""prisiondoorslammer"true1);
    
AddEntityCollideCallback("Player""memorial_windwhirl""func_memorialwhine"true1);
    
/////INTRO////
    
TeleportPlayer("Intro_0");
    
FadeOut(0);
    
SetPlayerActive(false);
    
SetSanityDrainDisabled(true);
    
ShowPlayerCrossHairIcons(false);
    
AddTimer("fadein"5"TimerIntroOutro");
    
PlayMusic("silent_intro"false101true);
}

//////////////////////////////
//Intro//////////////////////
////////////////////////////

void TimerIntroOutro(string &in asTimer)
{
    if(
GetLocalVarInt("Intro") < 1) {

        if(
asTimer == "fadein") {
            
TeleportPlayer("intro_" GetLocalVarInt("Intro"));
            
FadeIn(3);
            
AddTimer("fadeout"5"TimerIntroOutro");
        }

        if(
asTimer == "fadeout") {
            
FadeOut(3);
            
AddTimer("fadein"5"TimerIntroOutro");
            
AddLocalVarInt("Intro"1);
        }
    }
    else
    {
        
TeleportPlayer("PlayerStartArea_1");
        
FadeIn(2);
        
SetPlayerActive(true);
        
SetSanityDrainDisabled(false);
        
ShowPlayerCrossHairIcons(true);

        
PlayMusic("silent_intro"false0.212true);
    }

    if(
asTimer == "outro") {
        
StartCredits("in_motion.ogg"false"Credits""Ending"3);
    }


This script here works, when you start the CS this plays with a music showing team logo.

Now I need to add the wakeup script, for where we stand now you just spawn in the map with no wakeup obvioussly, I find it hard to wrap it up with the wake up script because im a noob and use the noob friendly timers usually but this tutorial did it like this.

Now i need to make this code below to work right after this script above. How can I do this, I am a noob with this - everything has been going smooth until this else if and if timing came up.

Wake up script:

PHP Code:
void wakeUp () {
    
FadeOut(0);     // Instantly fades the screen out. (Good for starting the game)
    
FadeIn(20);      // Amount of seconds the fade in takes
    
FadeImageTrailTo(22);
    
FadeSepiaColorTo(1004);
    
SetPlayerActive(false);    
    
FadePlayerRollTo(50220220);                 // "Tilts" the players head
    
FadeRadialBlurTo(0.152);
    
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(03333);        // Change all settings to defaults
    
FadeRadialBlurTo(0.01);
    
FadeSepiaColorTo(04);
    
SetPlayerCrouching(false);
    
FadeImageTrailTo(0,1);




RE: Can someone help me with a sequence - Romulator - 10-02-2013

Probably the simplest way is to add another timer to the above code, with the float number that determines when it happens after you have added the TimerIntroOutro timer in that first bit of code.

Try putting this one line below the TimerIntroOutro timer:
PHP Code:
AddTimer("wakesequence"6"wakeUp"); 

And then make void wakeUp() into:
PHP Code:
void wakeUp(string &in asTimer

If you need to adjust when the timer occurs, change the 6 in the first code there. If this does not work fully, I apologise. Haven't scripted for quite a while :p


RE: Can someone help me with a sequence - PutraenusAlivius - 10-02-2013

Scripting time.

Spoiler below!
PHP Code:
////////////////////////////
// Run first time starting map
void OnStart()
{
    
AddUseItemCallback("""Key_1""door1""FUNCTION"true);
    
SetEntityPlayerInteractCallback("Key_1""PickedUpKey"true);
    
SetEntityPlayerInteractCallback("phonograph_2""phono1"true);
    
//PlayMusic("/music/06_amb", true, 1, 0, 0, true);
    
AddEntityCollideCallback("Player""script_wellwhine""func_whine"true1);
    
AddEntityCollideCallback("Player""script_prision_slammer""prisiondoorslammer"true1);
    
AddEntityCollideCallback("Player""memorial_windwhirl""func_memorialwhine"true1);
    
/////INTRO////
    
TeleportPlayer("Intro_0");
    
FadeOut(0);
    
SetPlayerActive(false);
    
SetSanityDrainDisabled(true);
    
ShowPlayerCrossHairIcons(false);
    
AddTimer("fadein"5"TimerIntroOutro");
    
PlayMusic("silent_intro"false101true);
       
////WAKEUP////
      
wakeUp();
}

//////////////////////////////
//Intro//////////////////////
////////////////////////////

void TimerIntroOutro(string &in asTimer)
{
    if(
GetLocalVarInt("Intro") < 1) {

        if(
asTimer == "fadein") {
            
TeleportPlayer("intro_" GetLocalVarInt("Intro"));
            
FadeIn(3);
            
AddTimer("fadeout"5"TimerIntroOutro");
        }

        if(
asTimer == "fadeout") {
            
FadeOut(3);
            
AddTimer("fadein"5"TimerIntroOutro");
            
AddLocalVarInt("Intro"1);
        }
    }
    else
    {
        
TeleportPlayer("PlayerStartArea_1");
        
FadeIn(2);
        
SetPlayerActive(true);
        
SetSanityDrainDisabled(false);
        
ShowPlayerCrossHairIcons(true);

        
PlayMusic("silent_intro"false0.212true);
    }

    if(
asTimer == "outro") {
        
StartCredits("in_motion.ogg"false"Credits""Ending"3);
    }
}

void wakeUp () {
    
FadeOut(0);     // Instantly fades the screen out. (Good for starting the game)
    
FadeIn(20);      // Amount of seconds the fade in takes
    
FadeImageTrailTo(22);
    
FadeSepiaColorTo(1004);
    
SetPlayerActive(false);    
    
FadePlayerRollTo(50220220);                 // "Tilts" the players head
    
FadeRadialBlurTo(0.152);
    
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(03333);        // Change all settings to defaults
    
FadeRadialBlurTo(0.01);
    
FadeSepiaColorTo(04);
    
SetPlayerCrouching(false);
    
FadeImageTrailTo(0,1);



EDIT:
Use R0mul8r's script if you wanted it to happen in a designated time.


RE: Can someone help me with a sequence - Hauken - 10-02-2013

Hey, justanotherplayer - you ended up with the same result as i did. The wake up sequence is in motion when the intro is being played so it looks like this now.


Edit: yeap will try what rom said!


RE: Can someone help me with a sequence - Hauken - 10-02-2013

I combined what you two said and its working now, now the fading and all that is a issue but I can already adjust that so I'll tweak it and see what happens.

Thanks guys!