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]
daortir Offline
Senior Member

Posts: 422
Threads: 9
Joined: Sep 2013
Reputation: 18
#11
RE: Intro script help

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.

12-27-2013, 10:30 PM
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)