Frictional Games Forum (read-only)
SCRIPT HELP - 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 HELP (/thread-9604.html)



SCRIPT HELP - ZyLogicX - 08-05-2011

Something is wrong with this?

Quote:void OnStart();

void CreditsA(string &in asTimer)
{
SetMessage("Opening_Credits", "1", 5.0f);
}
void CreditsB(string &in asTimer)
{
SetMessage("Opening_Credits", "2", 5.0f);
}
void CreditsC(string &in asTimer)
{
SetMessage("Opening_Credits", "3", 7.0f);
}



RE: SCRIPT HELP - Khyrpa - 08-05-2011

void OnStart()
{
StartCredits();
}

void StartCredits()
{SetMessage("Opening_Credits", "1", 5.0f);
AddTimer("adjustthistimer", 5.5f, "CreditsB");
}

void CreditsB(string &in asTimer)
{SetMessage("Opening_Credits", "2", 5.0f);..... and so on


RE: SCRIPT HELP - ZyLogicX - 08-05-2011

So I need to have it like this?
void OnStart()
{
StartCredits()
}

void StartCredits()
{SetMessage("Opening_Credits", "1", 5.0f);
AddTimer("5", 5.5f, "CreditsB");
}

void CreditsB(string &in asTimer)
{SetMessage("Opening_Credits", "2", 5.0f);
}

void CreditsC(string &in asTimer)
{SetMessage("Opening_Credits", "3", 7.0f);
}


RE: SCRIPT HELP - Khyrpa - 08-05-2011

You seem to have trouble with the basics, so I try to make things clear quickly.

void OnStart() <-- dsnt have ;
so everything that starts with void dsnt have thes at end -> ;

The StartCredits(); should have -> ; behind it cos its a function to call void StartCredits()

That StartCredits(); is just there to separate the thing from void OnStart() to make things clear, but like that its exactly the same as this:

void OnStart()
{
SetMessage("Opening_Credits", "1", 5.0f);
AddTimer("5", 5.5f, "CreditsB");
}


Now when you look at your script (adding ; after StartCredits()):

void OnStart()
{
StartCredits();
}

void StartCredits()
{SetMessage("Opening_Credits", "1", 5.0f);
AddTimer("5", 5.5f, "CreditsB");
}

void CreditsB(string &in asTimer)
{SetMessage("Opening_Credits", "2", 5.0f);
}

void CreditsC(string &in asTimer)
{SetMessage("Opening_Credits", "3", 7.0f);
}

The game automatically runs void OnStart(), void OnLeave() and void OnEnter(). Every other void thingie you have to call yourself!
For example in your script nothing triggers the void CreditsC (I hope the color coding makes things simpler).

So what happens is: The void OnStart() happens when your player spawns inside the map the script file is for (OnEnter happens right when the loading starts). And from OnStart(), void StartCredits() is at the same time called to happen making the message pop up and timer you happened to name "5" starts running causing "CreditsB" function to be called after 5,5 seconds.

You have to include the (string &in asTimer) behind functions that are called by timers.
Then Opening_Credits 2 text should pop up and thats it.

To continue the event into CreditsC, you would only have to create another timer inside the CreditsB void function.
//copyfromscriptfunctionspage//
AddTimer(string& asName, float afTime, string& asFunction);
asName - the name of the timer
afTime - time in seconds
asFunction - the function to call (in this case "CreditsC")
(check the awesome color coding again!)

sorry for the long post, I hope it straightns things out