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
ZyLogicX Offline
Member

Posts: 245
Threads: 24
Joined: May 2011
Reputation: 6
#1
SCRIPT HELP

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);
}

Beyond the Mountains of Madness [15%]
This forum is dying.
08-05-2011, 01:48 PM
Find
Khyrpa Offline
Senior Member

Posts: 638
Threads: 10
Joined: Apr 2011
Reputation: 24
#2
RE: SCRIPT HELP

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

08-05-2011, 01:55 PM
Find
ZyLogicX Offline
Member

Posts: 245
Threads: 24
Joined: May 2011
Reputation: 6
#3
RE: SCRIPT HELP

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);
}

Beyond the Mountains of Madness [15%]
This forum is dying.
08-05-2011, 02:04 PM
Find
Khyrpa Offline
Senior Member

Posts: 638
Threads: 10
Joined: Apr 2011
Reputation: 24
#4
RE: SCRIPT HELP

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

(This post was last modified: 08-05-2011, 03:28 PM by Khyrpa.)
08-05-2011, 03:26 PM
Find




Users browsing this thread: 1 Guest(s)