Linus Ågren
Senior Member
Posts: 309
Threads: 58
Joined: Jan 2011
Reputation:
5
|
RE: How do i make the end of the storie when player enter area
Here's a rough example. I added comments that you can check in the code.
Quote:void OnStart()
{
AddEntityCollideCallback("Player", "Area_End", "End", true, 1); //Defines the collidebox
}
void End(string &in asParent, string &in asChild, int alState)
{
SetPlayerActive(false); //Makes the player unable to move
StartPlayerLookAt("Area_Left", 5.0f, 5.0f, ""); //Forces the player to look at Area_Left
AddTimer("LookRight", 2.0f, "LookTimer"); //After 2 seconds, the player will look at the Area_Right box
AddTimer("PlayerFall", 5.0f, "LookTimer"); //After 5 seconds, the player will fall down
AddTimer("RollCredits", 8.0f, "LookTimer"); //After 8 seconds, the credits will roll
}
void LookTimer(string &in asTimer)
{
if(asTimer == "LookRight") //If the time is "LookRight", this will happen etc
{
StartPlayerLookAt("Area_Right", 5.0f, 5.0f, "");
}
if(asTimer == "PlayerFall")
{
SetEntityActive("block_box_1", false); //Disables the block-box that is preventing the player from falling down
}
if(asTimer == "RollCredits")
{
StartCredits("musicfile.ogg", true, "Credits", "EntryCredits", 2); /*Start credits. Replace musicfile.ogg with your music, "Credits" with the credits category in your lang file,
"EntryCredits" with the entry of your credits in the lang file*/
}
}
void OnEnter()
{
}
void OnLeave()
{
}
Creator of The Dark Treasure.
|
|
01-02-2012, 05:04 AM |
|