|
|
|
Re: Script request [message #336246 is a reply to message #336241] |
Fri, 20 June 2008 14:56 |
_SSnipe_
Messages: 4121 Registered: May 2007 Location: Riverside Southern Califo...
Karma: 0
|
General (4 Stars) |
|
|
Gen_Blacky wrote on Fri, 20 June 2008 14:37 |
3)how far apart should the scripts be?
what do you mean , should only pick 2 scripts out of like 10 for the whole duration of the map.
|
what i mean is how far apart should the timer pick a script?
once every 2 5 or 10 minutes?
|
|
|
|
|
Re: Script request [message #336256 is a reply to message #336237] |
Fri, 20 June 2008 15:58 |
|
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma: 0
|
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
|
|
|
Re: Script request [message #336258 is a reply to message #336256] |
Fri, 20 June 2008 16:21 |
HeavyX101- Left
Messages: 633 Registered: April 2008 Location: WindowsJail=ZipFolder
Karma: 0
|
Colonel |
|
|
Nice job reborn.
And here is the weather one i made!
//.cpp - Made by Heavyx101, Do not delete the Credits becausr it might cause the script to not work!
void HeavyX101_Weather_tRain::Created(GameObject *obj) {
Commands->Start_Timer(obj, this, 900.0, 1);
Commands->Set_Rain(50.0f,3.5f,true);
};
void HeavyX101_Weather_tRain::Timer_Expired(GameObject *obj, int number) {
Commands->Set_Rain(0.0f,0.0f,true);
Commands->Attach_Script(obj, "HeavyX101_Weather_tSnow", "");
};
void HeavyX101_Weather_tSnow::Created(GameObject *obj) {
Commands->Start_Timer(obj, this, 900.0, 1);
Commands->Set_Snow(2.0f,1.5f,true);
};
void HeavyX101_Weather_tSnow::Timer_Expired(GameObject *obj, int number) {
Commands->Set_Snow(0.0f,0.0f,true);
Commands->Attach_Script(obj, "HeavyX101_Weather_tFog", "");
};
void HeavyX101_Weather_tFog::Created(GameObject *obj) {
Commands->Start_Timer(obj, this, 900.0, 1);
Commands->Set_Fog_Enable(1);
Commands->Set_Fog_Range (0.5,55,3.5f);
};
void HeavyX101_Weather_tFog::Timer_Expired(GameObject *obj, int number) {
Commands->Set_Fog_Enable(0);
Commands->Attach_Script(obj, "HeavyX101_Weather_tRain", "");
};
ScriptRegistrant<HeavyX101_Weather_tFog> HeavyX101_Weather_tFog_Registrant("HeavyX101_Weather_tFog","");
ScriptRegistrant<HeavyX101_Weather_tSnow> HeavyX101_Weather_tSnow_Registrant("HeavyX101_Weather_tSnow","");
ScriptRegistrant<HeavyX101_Weather_tRain> HeavyX101_Weather_tRain_Registrant("HeavyX101_Weather_tRain","");
// .h - Made by Heavyx101, Do not delete the Credits becausr it might cause the script to not work!
class HeavyX101_Weather_tRain : public ScriptImpClass {
void Created(GameObject *obj);
void Timer_Expired(GameObject *obj, int number);
};
class HeavyX101_Weather_tSnow : public ScriptImpClass {
void Created(GameObject *obj);
void Timer_Expired(GameObject *obj, int number);
};
class HeavyX101_Weather_tFog : public ScriptImpClass {
void Created(GameObject *obj);
void Timer_Expired(GameObject *obj, int number);
Just put the HeavyX101_Weather_tRain into a daves arrow. It has been tested and every thing works fine. Have fun
And: If you thing i made the scripts wrong or stupid or something else, then here is the answer: i'm just a bigginer!
This account is no longer being active.
[Updated on: Fri, 20 June 2008 16:21] Report message to a moderator
|
|
|
|
|
|
Re: Script request [message #336264 is a reply to message #336262] |
Fri, 20 June 2008 16:58 |
HeavyX101- Left
Messages: 633 Registered: April 2008 Location: WindowsJail=ZipFolder
Karma: 0
|
Colonel |
|
|
cnc95fan wrote on Fri, 20 June 2008 19:47 | You can delete the credits becausr it will still work.
|
SHH! O_O
This account is no longer being active.
|
|
|
Re: Script request [message #336362 is a reply to message #336237] |
Sat, 21 June 2008 08:15 |
|
Gen_Blacky
Messages: 3250 Registered: September 2006
Karma: 1
|
General (3 Stars) |
|
|
I got these errors compiling it in client script compiled fine in ssgm.
both errors in the Script Registrant
1>.\reb.cpp(39) : error C2143: syntax error : missing ';' before '<'
1>.\reb.cpp(39) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
[Updated on: Sat, 21 June 2008 08:17] Report message to a moderator
|
|
|
|
|
|
|
Re: Script request [message #336705 is a reply to message #336237] |
Sun, 22 June 2008 09:32 |
|
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma: 0
|
General (3 Stars) |
|
|
Chaneg the registrant, I wrote it incorrectly.
ScriptRegistrant<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");
|
|
|