Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Script request  () 1 Vote
icon1.gif  Script request [message #336237] Fri, 20 June 2008 14:25 Go to next message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma: 1
General (3 Stars)

I was wondering if some one could make a simple timer that would randomly pick a script like reborns ion storm , or airstrike through a duration of a map once per map.


http://s18.postimage.org/jc6qbn4k9/bricks3.png
Re: Script request [message #336238 is a reply to message #336237] Fri, 20 June 2008 14:29 Go to previous messageGo to next message
_SSnipe_ is currently offline  _SSnipe_
Messages: 4121
Registered: May 2007
Location: Riverside Southern Califo...
Karma: 0
General (4 Stars)
i cant make it but maybe some more details can make it better?

1)does timer run till end of map? or amount of time?
2)do u want it to RANDOMLY choose a script u type in?
3)how far apart should the scripts be?


you should add weather 2 Smile rain fog ask or snow and wind war blitz and lightning i use them on mine via commands Smile
Re: Script request [message #336241 is a reply to message #336238] Fri, 20 June 2008 14:37 Go to previous messageGo to next message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma: 1
General (3 Stars)
yes i want to add many whether commands , instead of just adding them to crate i want them randomly to come on during a map

1)does timer run till end of map? or amount of time?

runs to the end of map it will pick a script once or twice till the end of the map.

2)do u want it to RANDOMLY choose a script u type in?

i want it randomly pick a script that is in the script list

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.


http://s18.postimage.org/jc6qbn4k9/bricks3.png
Re: Script request [message #336246 is a reply to message #336241] Fri, 20 June 2008 14:56 Go to previous messageGo to next message
_SSnipe_ is currently offline  _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 #336249 is a reply to message #336246] Fri, 20 June 2008 15:04 Go to previous messageGo to next message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma: 1
General (3 Stars)
every 15

http://s18.postimage.org/jc6qbn4k9/bricks3.png
Re: Script request [message #336251 is a reply to message #336237] Fri, 20 June 2008 15:20 Go to previous messageGo to next message
mrãçķz is currently offline  mrãçķz
Messages: 3069
Registered: August 2007
Karma: 0
General (3 Stars)
Permabanned for trying and failing DDoS
Its a easy Script that can be done with Timers, you need to create a daves Arrow and Attach the Script to the Arrow.
Re: Script request [message #336256 is a reply to message #336237] Fri, 20 June 2008 15:58 Go to previous messageGo to next message
reborn is currently offline  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 Go to previous messageGo to next message
HeavyX101- Left is currently offline  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 Smile
And: If you thing i made the scripts wrong or stupid or something else, then here is the answer: i'm just a bigginer! Smile


This account is no longer being active.

[Updated on: Fri, 20 June 2008 16:21]

Report message to a moderator

Re: Script request [message #336260 is a reply to message #336237] Fri, 20 June 2008 16:31 Go to previous messageGo to next message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma: 1
General (3 Stars)
Thanks Reborn ill give it a try

http://s18.postimage.org/jc6qbn4k9/bricks3.png
Re: Script request [message #336261 is a reply to message #336260] Fri, 20 June 2008 16:32 Go to previous messageGo to next message
HeavyX101- Left is currently offline  HeavyX101- Left
Messages: 633
Registered: April 2008
Location: WindowsJail=ZipFolder
Karma: 0
Colonel
Edit: nvm Razz

This account is no longer being active.

[Updated on: Fri, 20 June 2008 16:33]

Report message to a moderator

Re: Script request [message #336262 is a reply to message #336237] Fri, 20 June 2008 16:47 Go to previous messageGo to next message
cnc95fan is currently offline  cnc95fan
Messages: 1261
Registered: July 2007
Karma: 0
General (1 Star)
You can delete the credits becausr it will still work.
Re: Script request [message #336264 is a reply to message #336262] Fri, 20 June 2008 16:58 Go to previous messageGo to next message
HeavyX101- Left is currently offline  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 Go to previous messageGo to next message
Gen_Blacky is currently offline  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


http://s18.postimage.org/jc6qbn4k9/bricks3.png

[Updated on: Sat, 21 June 2008 08:17]

Report message to a moderator

Re: Script request [message #336468 is a reply to message #336237] Sat, 21 June 2008 15:08 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
What line is that? Pretty sure it isn't from mine but other dudes :-S


Re: Script request [message #336527 is a reply to message #336468] Sat, 21 June 2008 17:36 Go to previous messageGo to next message
HeavyX101- Left is currently offline  HeavyX101- Left
Messages: 633
Registered: April 2008
Location: WindowsJail=ZipFolder
Karma: 0
Colonel
reborn wrote on Sat, 21 June 2008 18:08

What line is that? Pretty sure it isn't from mine but other dudes :-S

Might be mine because it was my first timer by the way Razz
Thank you reborn for releasing a code too. Now i found out how to make multiple timers using one script Razz Thanks mate!


This account is no longer being active.
Re: Script request [message #336661 is a reply to message #336237] Sun, 22 June 2008 03:41 Go to previous messageGo to next message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
I only used one timer :-/


Re: Script request [message #336680 is a reply to message #336237] Sun, 22 June 2008 05:47 Go to previous messageGo to next message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma: 1
General (3 Stars)
i put this script by itself and it gives me those 2 errors Huh

  • Attachment: reb.cpp
    (Size: 1.25KB, Downloaded 87 times)
  • Attachment: reb.h
    (Size: 0.25KB, Downloaded 94 times)


http://s18.postimage.org/jc6qbn4k9/bricks3.png
Re: Script request [message #336705 is a reply to message #336237] Sun, 22 June 2008 09:32 Go to previous message
reborn is currently offline  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");



Previous Topic: SSGM Plugin error :/
Next Topic: C++ script ERROr can anyone help me
Goto Forum:
  


Current Time: Mon Nov 18 05:51:50 MST 2024

Total time taken to generate the page: 0.01128 seconds