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]Change to specific random map
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#8
RE: [SCRIPT]Change to specific random map

Ok! Thank you for all who came up with ideas!
I think i've got it now. Please tell me if there is an error.

Here is the script:
Spoiler below!


void Collide(string &in asParent, string &in asChild, int alState)
{

//BEGIN FOR THE 3RD MAP//

if(GetGlobalVarInt("PlayedPath_1") == 1 && GetGlobalVarInt("PlayedPath_2") == 1)
{
ChangeMap("Path_3", "PlayerStartArea_1", "", "");
SetGlobalVarInt("FinalLevel", 1);
return;
}

if(GetGlobalVarInt("PlayedPath_2") == 1 && GetGlobalVarInt("PlayedPath_3") == 1)
{
ChangeMap("Path_1", "PlayerStartArea_1", "", "");
SetGlobalVarInt("FinalLevel", 1);
return;
}

if(GetGlobalVarInt("PlayedPath_1") == 1 && GetGlobalVarInt("PlayedPath_3") == 1)
{
ChangeMap("Path_2", "PlayerStartArea_1", "", "");
SetGlobalVarInt("FinalLevel", 1);
return;
}

//END FOR THE 3RD MAP//

//BEGIN FOR THE 2ND MAP//

if(GetGlobalVarInt("PlayedFirstPath_1") == 1)
{
AddTimer("ChangeMap_Second_"+RandInt(2, 3), 0, "ChangeMap_Second");
return;
}

if(GetGlobalVarInt("PlayedFirstPath_2") == 1)
{
AddTimer("ChangeMap_Second_"+RandInt(1, 2), 0, "ChangeMap_Second_1_3");
//IF THE PLAYER PLAYED 1 AND 3, CALL SEPARATE TIMER THAT CHOOSES BETWEEN 1 AND 3//
return;
}

if(GetGlobalVarInt("PlayedFirstPath_3") == 1)
{
AddTimer("ChangeMap_Second_"+RandInt(1, 2), 0, "ChangeMap_Second");
return;
}

//END FOR THE 2ND MAP//

//BEGIN FOR THE 1ST MAP. CHOOSE RANDOM LEVEL//

AddTimer("ChangeMap_First_"+RandInt(1, 3), 0, "ChangeMap_First");

//END FOR THE 1ST MAP//
}

//BGEIN FIRST MAP CHOOSE//

void ChangeMap_First(string &in asTimer)
{
if(asTimer == "ChangeMap_First_1")
{
SetGlobalVarInt("PlayedFirstPath_1", 1);
SetGlobalVarInt("PlayedPath_1", 1);
ChangeMap("Path_1", "PlayerStartArea_1", "", "");
return;
}

if(asTimer == "ChangeMap_First_2")
{
SetGlobalVarInt("PlayedFirstPath_2", 1);
SetGlobalVarInt("PlayedPath_2", 1);
ChangeMap("Path_2", "PlayerStartArea_1", "", "");
return;
}

if(asTimer == "ChangeMap_First_3")
{
SetGlobalVarInt("PlayedFirstPath_3", 1);
SetGlobalVarInt("PlayedPath_3", 1);
ChangeMap("Path_3", "PlayerStartArea_1", "", "");
return;
}
}

//END FIRST MAP CHOOSE//

//BEGIN SECOND MAP CHOOSE//

void ChangeMap_Second(string &in asTimer)
{
if(asTimer == "ChangeMap_Second_1")
{
SetGlobalVarInt("PlayedSecondPath_1", 1);
SetGlobalVarInt("PlayedPath_1", 1);
ChangeMap("Path_1", "PlayerStartArea_1", "", "");
return;
}

if(asTimer == "ChangeMap_Second_2")
{
SetGlobalVarInt("PlayedSecondPath_2", 1);
SetGlobalVarInt("PlayedPath_2", 1);
ChangeMap("Path_2", "PlayerStartArea_1", "", "");
return;
}

if(asTimer == "ChangeMap_Second_3")
{
SetGlobalVarInt("PlayedSecondPath_3", 1);
SetGlobalVarInt("PlayedPath_3", 1);
ChangeMap("Path_3", "PlayerStartArea_1", "", "");
return;
}
}

void ChangeMap_Second_1_3(string &in asTimer)
{
if(asTimer == "ChangeMap_Second_1")
{
AddTimer("ChangeMap_Second_1", 0, "ChangeMap_Second");
return;
}

if(asTimer == "ChangeMap_Second_2")
{
AddTimer("ChangeMap_Second_3", 0, "ChangeMap_Second");
return;
}
}

//END SECOND MAP CHOOSE//



EDIT: Is it ok to use a lot of timers calling in 0 seconds?

Trying is the first step to success.
(This post was last modified: 11-19-2012, 07:11 PM by FlawlessHappiness.)
11-19-2012, 07:04 PM
Find


Messages In This Thread
RE: [SCRIPT]Change to specific random map - by FlawlessHappiness - 11-19-2012, 07:04 PM



Users browsing this thread: 1 Guest(s)