Home » Renegade Discussions » Mod Forum » Script request
( ) 1 Vote
Re: Script request [message #336256 is a reply to message #336237] |
Fri, 20 June 2008 15:58 ![Go to previous message Go to previous message](/theme/Renegade_Forums/images/up.png) ![Go to next message Go to previous message](/theme/Renegade_Forums/images/down.png) |
![](http://renegadeforums.com/images/custom_avatars/3415.gif) |
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma:
|
General (3 Stars) |
|
|
I have not tested this at all, I have no IDE where I am atm so I cannot tell if it will even compile.
But this script (that can be added to the client solution and compiled into the client scripts.dll should allow you to choose four script names. It should create an invisible object at 0,0,0 and attach one of the four scripts you filled in in level edit to play. It will only do it once per map, and it will choose the time to play it randomly based on the length of time you set the map to.
You would also have to make sure that the names of the scripts you are filling in in level edit exist in SSGM, and you will also have to make sure you add this script to SSGM aswell as the client scripts.dll.
You would not need to distribute the new client scripts.dll, this is only needed because you want to add the script in level edit, and the SSGM scripts.dll version will not load in level edit.
You would have to attach this script to any object on the map. However you could create the same effect not using the client scipts.dll but using SSGM only with only a few tweaks.
Enough babling, here's the code. And remember, I have NOT tested this.
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");
class reb_random_script_player : public ScriptImpClass {
void Created(GameObject *obj);
void Timer_Expired(GameObject *obj,int number);
const char *scriptname1;
const char *scriptname2;
const char *scriptname3;
const char *scriptname4;
};
I probably should of created an array instead, but this should work just the same. Hope it helps.
[Updated on: Fri, 20 June 2008 16:29] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sat Feb 08 15:39:34 MST 2025
Total time taken to generate the page: 0.00968 seconds
|