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 Can someone help me with a sequence
Hauken Offline
Member

Posts: 62
Threads: 19
Joined: Jul 2012
Reputation: 1
#1
Can someone help me with a sequence

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: (Select All)
////////////////////////////
// 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: (Select All)
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);

10-01-2013, 11:52 PM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#2
RE: Can someone help me with a sequence

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: (Select All)
AddTimer("wakesequence"6"wakeUp"); 

And then make void wakeUp() into:
PHP Code: (Select All)
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

Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 10-02-2013, 02:56 AM by Romulator.)
10-02-2013, 02:55 AM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#3
RE: Can someone help me with a sequence

Scripting time.

Spoiler below!
PHP Code: (Select All)
////////////////////////////
// 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.

"Veni, vidi, vici."
"I came, I saw, I conquered."
(This post was last modified: 10-02-2013, 08:25 AM by PutraenusAlivius.)
10-02-2013, 08:20 AM
Find
Hauken Offline
Member

Posts: 62
Threads: 19
Joined: Jul 2012
Reputation: 1
#4
RE: Can someone help me with a sequence

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!


Attached Files
.jpg   2013-10-02_00001.jpg (Size: 76.54 KB / Downloads: 128)
(This post was last modified: 10-02-2013, 05:51 PM by Hauken.)
10-02-2013, 05:49 PM
Find
Hauken Offline
Member

Posts: 62
Threads: 19
Joined: Jul 2012
Reputation: 1
#5
RE: Can someone help me with a sequence

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!
10-02-2013, 10:31 PM
Find




Users browsing this thread: 1 Guest(s)