#include "scripts.h"
#include "engine.h"
#include "reb.h"

void reb_random_script_player::Created(GameObject *obj){
scriptname1 = Get_Parameter("Script_Name_One");
scriptname2 = Get_Parameter("Script_Name_Two");
scriptname3 = Get_Parameter("Script_Name_Three");
scriptname4 = Get_Parameter("Script_Name_Four");
int MaxTimeLimit = The_Game()->TimeLimit_Minutes;
MaxTimeLimit = MaxTimeLimit * 60;
int randomtime = Commands->Get_Random_Int(1,MaxTimeLimit);
Commands->Start_Timer(obj,this,1,randomtime);
}


void reb_random_script_player::Timer_Expired(GameObject *obj,int number){
	if(number == 1){
GameObject *Temp = Commands->Create_Object("Invisible_Object",Vector3(0.0f,0.0f,0.0f));
int rand = Commands->Get_Random_Int(1,5);
if(rand == 1){
Commands->Attach_Script(Temp,scriptname1,"");
}
else if(rand == 2){
Commands->Attach_Script(Temp,scriptname2,"");
}
else if(rand == 3){
Commands->Attach_Script(Temp,scriptname3,"");
}
else if(rand == 4){
Commands->Attach_Script(Temp,scriptname4,"");
}

	}
}



ScriptRegistrantScriptRegistrant<reb_random_script_player> reb_random_script_player_Registrant("reb_random_script_player","Script_Name_One:const char,Script_Name_Two:const char,Script_Name_Three:const char,Script_Name_Four:const char");