Frictional Games Forum (read-only)
[SCRIPT] Stuck Again - Showing Messages - 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] Stuck Again - Showing Messages (/thread-22618.html)



Stuck Again - Showing Messages - summit - 08-27-2013

Hello guys, in my CS, at the beggining, I want to tell the custom story's story with messages.

I make the screen black with FadeOut. Now, I want to tell the story with 8 messages.

I want to do something like this:
When I used FadeOut, First message will appear for 10 seconds, after 10 seconds, it will dissappear. The second message will appear for 10 seconds again. I want to repeat this till the last message.

I tried but I'm stuck right now. Can you guys show me an example?


RE: Stuck Again - Showing Messages - ExpectedIdentifier - 08-27-2013

(08-27-2013, 06:56 PM)Arbies Wrote: Hello guys, in my CS, at the beggining, I want to tell the custom story's story with messages.

I make the screen black with FadeOut. Now, I want to tell the story with 8 messages.

I want to do something like this:
When I used FadeOut, First message will appear for 10 seconds, after 10 seconds, it will dissappear. The second message will appear for 10 seconds again. I want to repeat this till the last message.

I tried but I'm stuck right now. Can you guys show me an example?

Spoiler below!

void OnStart()
{
FadeOut(0);
AddTimer("IntroSequence",0,"IntroSequence");
}


void IntroSequence(string &in asTimer)
{
AddLocalVarInt("IntroVar", 1);
float CaseSpeed = 10.0f;

switch(GetLocalVarInt("IntroVar"))
{
case 1:
SetMessage("MessageCategory","MessageText1",10);
break;
case 2:
SetMessage("MessageCategory","MessageText2",10);
break;
case 3:
SetMessage("MessageCategory","MessageText3",10);
break;
}
if(GetLocalVarInt("IntroVar") < 4) AddTimer("IntroSequence", CaseSpeed, "IntroSequence");
}



This is how I'd do it - using a switch case to run through a set of cases, one for each message. This is good as you can easily add more cases and edit current ones.


RE: Stuck Again - Showing Messages - summit - 08-27-2013

(08-27-2013, 07:06 PM)sonataarctica Wrote:
(08-27-2013, 06:56 PM)Arbies Wrote: Hello guys, in my CS, at the beggining, I want to tell the custom story's story with messages.

I make the screen black with FadeOut. Now, I want to tell the story with 8 messages.

I want to do something like this:
When I used FadeOut, First message will appear for 10 seconds, after 10 seconds, it will dissappear. The second message will appear for 10 seconds again. I want to repeat this till the last message.

I tried but I'm stuck right now. Can you guys show me an example?

Spoiler below!

void OnStart()
{
FadeOut(0);
AddTimer("IntroSequence",0,"IntroSequence");
}


void IntroSequence(string &in asTimer)
{
AddLocalVarInt("IntroVar", 1);
float CaseSpeed = 10.0f;

switch(GetLocalVarInt("IntroVar"))
{
case 1:
SetMessage("MessageCategory","MessageText1",10);
break;
case 2:
SetMessage("MessageCategory","MessageText2",10);
break;
case 3:
SetMessage("MessageCategory","MessageText3",10);
break;
}
if(GetLocalVarInt("IntroVar") < 4) AddTimer("IntroSequence", CaseSpeed, "IntroSequence");
}



This is how I'd do it - using a switch case to run through a set of cases, one for each message. This is good as you can easily add more cases and edit current ones.
Ah, you again SonataArctica, you dude just made my day today. Thanks for your help. You are awesome. +1


RE: Stuck Again - Showing Messages - ExpectedIdentifier - 08-27-2013

(08-27-2013, 07:12 PM)Arbies Wrote:
(08-27-2013, 07:06 PM)sonataarctica Wrote:
(08-27-2013, 06:56 PM)Arbies Wrote: Hello guys, in my CS, at the beggining, I want to tell the custom story's story with messages.

I make the screen black with FadeOut. Now, I want to tell the story with 8 messages.

I want to do something like this:
When I used FadeOut, First message will appear for 10 seconds, after 10 seconds, it will dissappear. The second message will appear for 10 seconds again. I want to repeat this till the last message.

I tried but I'm stuck right now. Can you guys show me an example?

Spoiler below!

void OnStart()
{
FadeOut(0);
AddTimer("IntroSequence",0,"IntroSequence");
}


void IntroSequence(string &in asTimer)
{
AddLocalVarInt("IntroVar", 1);
float CaseSpeed = 10.0f;

switch(GetLocalVarInt("IntroVar"))
{
case 1:
SetMessage("MessageCategory","MessageText1",10);
break;
case 2:
SetMessage("MessageCategory","MessageText2",10);
break;
case 3:
SetMessage("MessageCategory","MessageText3",10);
break;
}
if(GetLocalVarInt("IntroVar") < 4) AddTimer("IntroSequence", CaseSpeed, "IntroSequence");
}



This is how I'd do it - using a switch case to run through a set of cases, one for each message. This is good as you can easily add more cases and edit current ones.
Ah, you again SonataArctica, you dude just made my day today. Thanks for your help. You are awesome. +1

What can I say, I'm in a helpful mood today! Big Grin Haha. You're welcome.