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 Intro script help and monster nodes [SOLVED]
lothabread Offline
Member

Posts: 106
Threads: 11
Joined: Apr 2012
Reputation: 2
#12
RE: Intro script help

(12-27-2013, 10:30 PM)daortir Wrote: Here's how the case script work : >. I learnt this yesterday because timers are a bit more messy and I needed to make the intro sequence for my mod.

First of all you need something that will call the Intro sequence at the beginning of the game.
Like :


void OnStart()
{
FadeOut(0);
AddTimer("StartGame", 1, "introSequence");
}

FadeOut(0); is there to make the screen black instantly at the beginning of the game.

Then there's the sequence, it will call cases one by one, and the time between every case will be the one you choose. More on that later.

void introSequence(string &in asTimer)
{
AddLocalVarInt("iIntroPart", 1);
float partSpeed = 1.5f;
switch (GetLocalVarInt("iIntroPart"))
{
case 1:
Between the case number and the break, put anything you want to happen ! This is where the events of the sequence should be. You set the time before the next case is called by putting the line between case 1 and break; .

partSpeed = 5.0f;

(- This makes the part 5 seconds before another "case" is called. You can make it as long as you want, if you don't set it it will use the default speed that we set just above : float partSpeed=1.5f.)
break;


case 2:


There you go, the next step in your intro sequence !

break;


Now it's time to finish the function.

}

if (GetLocalVarInt("iIntroPart") <2)
{
AddTimer("tmrIntro", partSpeed, "introSequence");
}
}

What happens during the sequence, exactly, is that the function introSequence is called. It starts by calling case 1, then if there are other cases to call it calls itself again, but this time it does case 2, etc.

The if (GetLocalVarInt("iIntroPart") <2) doesn't have to be 2, it has to be the number of parts/cases you have.

Oh, last thing : you might want to add this

void OnEnter()
{
SetLocalVarInt("iIntroPart", 0);
}

at the beginning of your .hps file. Not sure if it really matters, but well it doesn't hurt.

Hopefully this was clear enough, I had quite a bit of trouble understanding how cases work so I'm glad if I can help people out with that : D. Ask questions if I didn't explain well, and have a cookie while you're here.

hmm alrighty well i still cant get past the first case so i must be doing something wrong, dunno what though D:
PHP Code: (Select All)
////////////////////////////
// Run when starting game
void OnStart()
{
    if(
ScriptDebugOn())
          {
               
GiveItemFromFile("lantern""lantern.ent");
               
SetPlayerLampOil(100.0f);
 
               for(
int i 0;10;i++)
               {
                    
GiveItemFromFile("tinderbox""tinderbox.ent");
               }
          }
    
SetSanityDrainDisabled(true);
    
SetPlayerCrouching(true);
    
SetPlayerActive(false);
    
FadeOut(0);
    
AddTimer("StartGame"6.0f"IntroSequence");
}

void IntroSequence(string &in asTimer)
{
    
AddLocalVarInt("iIntroPart"1);
    
float partSpeed 0.5f;
    switch(
GetLocalVarInt("iIntroPart")) {
        case 
1:
            
PlayGuiSound(""1.0f);
            
FadeIn(6.0f);
            
StartPlayerLookAt("AreaIntroLook_2"1.0f1.0f"");
            
FadePlayerRollTo(-450.88);
            
partSpeed 1.0f;
        break;
        
        case 
2:
            
StartPlayerLookAt("AreaIntroLook_4"1.0f1.0f"");
            
partSpeed 1.0f;
        break;
        
        case 
3:
            
StartPlayerLookAt("AreaIntroLook_3"1.0f1.0f"");
            
PlayGuiSound(""0.7f);
            
FadeOut(3.0f);
            
partSpeed 1.0f;
        break;
        
        case 
4:
            
FadeIn(6.0f);
            
SetPlayerLookSpeedMul(0.06f);
            
StartPlayerLookAt("AreaIntroLook_1"1.0f1.0f"");
            
partSpeed 1.0f;
        break;
        
        case 
5:
            
StartPlayerLookAt("AreaIntroLook_2"1.0f1.0f"");
            
FadeOut(8.0f);
            
PlayGuiSound(""0.8f);
            
partSpeed 1.0f;
        break;
    }
    
    if(
GetLocalVarInt("iIntroPart") < 6)    AddTimer("tmrIntro"partSpeed"introSequence");     
}

void monster(string &in asParentstring &in asChildint alState)
{
    
SetEntityActive("engineer_1"true);
    
    
AddEnemyPatrolNode("engineer_1""PathNodeArea_1"0"");
    
AddEnemyPatrolNode("engineer_1""PathNodeArea_2"0.001"");
    
AddEnemyPatrolNode("engineer_1""PathNodeArea_3"0"");
}

////////////////////////////
// Run when entering map
void OnEnter()
{
    
SetLocalVarInt("iIntroPart"0);

12-28-2013, 02:04 AM
Find


Messages In This Thread
RE: Intro script help - by WALP - 12-21-2013, 05:38 PM
RE: Intro script help - by lothabread - 12-21-2013, 06:42 PM
RE: Intro script help - by lothabread - 12-23-2013, 09:34 PM
RE: Intro script help - by lothabread - 12-26-2013, 07:35 AM
RE: Intro script help - by Romulator - 12-26-2013, 08:17 AM
RE: Intro script help - by lothabread - 12-26-2013, 09:09 AM
RE: Intro script help - by lothabread - 12-27-2013, 05:40 AM
RE: Intro script help - by lothabread - 12-27-2013, 07:05 AM
RE: Intro script help - by Romulator - 12-27-2013, 09:24 AM
RE: Intro script help - by daortir - 12-27-2013, 10:30 PM
RE: Intro script help - by lothabread - 12-28-2013, 02:04 AM
RE: Intro script help - by Romulator - 12-28-2013, 02:30 AM
RE: Intro script help - by lothabread - 12-28-2013, 03:40 AM
RE: Intro script help - by Slanderous - 12-28-2013, 12:28 PM
RE: Intro script help - by lothabread - 12-28-2013, 05:05 PM
RE: Intro script help - by Damascus - 12-29-2013, 01:01 AM
RE: Intro script help - by lothabread - 12-29-2013, 03:12 AM
RE: Intro script help - by daortir - 12-29-2013, 03:28 AM



Users browsing this thread: 2 Guest(s)