Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » [script]Code Release - Kamikaze Suit Crate
[script]Code Release - Kamikaze Suit Crate [message #302788] Wed, 12 December 2007 17:35 Go to next message
Genesis2001
Messages: 1397
Registered: August 2006
Karma: 0
General (1 Star)
I'm feeling generous so here you guys are! Very Happy

This is for people who like to mod their Server Scripts.dll and are running SSGM.

Main code:

			else if	((RandomIntCrate <=	(percent+=Settings->CrateKamikaze)) && (Settings->CrateKamikaze > 0)) {
				Change_Character(sender,"CnC_Nod_Flamethrower_0_Secret");
				Commands->Attach_Script(sender, "zbl_Kamikaze_Suit_Crate", "");
				Commands->Set_Health(sender,150);
				StrFormat2(message2,"%ls picked up the kamikaze suit crate",Get_Wide_Player_Name(sender));
				StrFormat2(message1,"ppage %d [Crate] You just picked up the kamikaze suit crate. You will explode when you die killing anything around you whether it be friendly or foe.",Get_Player_ID(sender));
				Console_Input(StrFormat("msg Crate: Some crazy ass %ls guy just got an experimental Ion Suit, watch yourself %ls!",Get_Wide_Team_Name(Team),Get_Wide_Team_Name(PTTEAM(Team))).c_str());				//Commands->Create_2D_WAV_Sound("m00evag_dsgn0027i1evag_snd.wav");
				if (Settings->Gamelog)  {
					Vector3 pos	= Commands->Get_Position(sender);
					StrFormat2(message3,"CRATE;KAMIKAZESUIT;;0;0;%f;%f;%f;%f;%f;%f;%d",pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender));
				}
			}


Add the above after this crate's code in gmcrate.cpp:

			else if	((RandomIntCrate <=	(percent+=Settings->CrateThief))	&& (Settings->CrateThief	> 0)) {
				Commands->Give_Money(sender,(Commands->Get_Money(sender) * -1),false);
				StrFormat2(message2,"%ls picked up a Thief Crate.",Get_Wide_Player_Name(sender));
				StrFormat2(message1,"ppage %d [NS] [Crate] You got the Thief Crate, you have lost all of your credits.",Get_Player_ID(sender));
								Create_2D_Sound_Player(sender,"m00evag_dsgn0028i1evag_snd.wav");
				if (Settings->Gamelog) {
					Vector3	pos	= Commands->Get_Position(sender);
					StrFormat2(message3,"CRATE;THIEF;;%d;%s;%f;%f;%f;%f;%f;%f;%d", Commands->Get_ID(sender), Commands->Get_Preset_Name(sender), pos.Y,pos.X,pos.Z, Commands->Get_Facing(sender), Commands->Get_Max_Health(sender),Commands->Get_Max_Shield_Strength(sender),Get_Object_Type(sender));
				}
			}


----------------------------------------------

Now, inside the definition of "void Crate_Defaults()" copy and paste the following: (change any values needed to make them all add up to 100...I won't have them add up to 100 because I have more crates ^,^)

void Crate_Defaults() {
	Settings->CrateWeapon = 13;
	Settings->CrateMoney = 11;
	Settings->CratePoints = 10;
	Settings->CrateVehicle = 8;
	Settings->CrateDeath = 7;
	Settings->CrateTiberium = 4;
	Settings->CrateAmmo = 5;
	Settings->CrateArmor = 5;
	Settings->CrateHealth = 5;
	Settings->CrateCharacter = 4;
	Settings->CrateButterFingers = 3;
	Settings->CrateSpy = 3;
	Settings->CrateStealth = 3;
	Settings->CrateRefill = 4;
	Settings->CrateBeacon = 4;
	Settings->CrateThief = 2;
	Settings->CrateKamikaze = 9;
}


You'll need to add some entries under the [Crate] header in ssgm.ini also...

Under [Crate] add

Kamikaze=9


Now, find the definition of "void Crate_Level_Loaded()" inside gmcrate.cpp and replace the initialization of "Total" with the following line of code:

int	Total = Settings->CrateDeath + Settings->CrateVehicle + Settings->CrateWeapon + Settings->CrateCharacter + Settings->CrateMoney + Settings->CratePoints + Settings->CrateTiberium + Settings->CrateAmmo + Settings->CrateHealth + Settings->CrateArmor + Settings->CrateRefill + Settings->CrateButterFingers + Settings->CrateSpy + Settings->CrateThief + Settings->CrateBeacon + Settings->CrateStealth + Settings->CrateKamikaze;



Open up gmcrate.h now and find "struct CrateSettings : public virtual SettingsLoader" and add this to the bottom of the definition:

int CrateKamikaze;



Now that we've set that up, you'll need to add the script "zbl_Kamikaze_Suit_Crate" to your SSGM.

void zbl_Kamikaze_Suit_Crate::Created(GameObject *obj)
{
	Attach_Script_Once(obj, "JFW_Blow_Up_On_Death", "Explosion_IonCannonBeacon");
	float rand = Commands->Get_Random(29,301);
	Team = Get_Object_Type(obj);
	Commands->Start_Timer(obj, this, rand,0);
}
void zbl_Kamikaze_Suit_Crate::Timer_Expired(GameObject *obj, int number)
{
	if (number == 0)
	{
		float rand = Commands->Get_Random(0,100);
		if (rand >= 50.0f)
		{
			// nothing happens
		}
		else {
			Commands->Apply_Damage(obj, 9999.0f, "BlamoKiller", 0);
			Console_Input(StrFormat("msg Crate: Oh no! I guess that experimental kamikaze suit didn't work too well. I hope that %ls guy didn't get hurt. :(", Get_Wide_Team_Name(PTTEAM(Team))).c_str());
		}
	}
}

ScriptRegistrant<zbl_Kamikaze_Suit_Crate> zbl_Kamikaze_Suit_Crate_Registrant("zbl_Kamikaze_Suit_Crate", "");




Hope you enjoy this. Smile

Thanks,
MathK1LL

[Updated on: Fri, 30 January 2009 14:24] by Moderator

Report message to a moderator

Re: Code Release - Kamikaze Suit Crate [message #302795 is a reply to message #302788] Wed, 12 December 2007 17:52 Go to previous messageGo to next message
danpaul88 is currently offline  danpaul88
Messages: 5795
Registered: June 2004
Location: England
Karma: 0
General (5 Stars)
Interesting twist, does it also damage enemy / friendly buildings that you are near? (Handy if you stick your timed C4 on an MCT and stand next to it, double explosion on the MCT that way...)

http://steamsignature.com/card/1/76561197975867233.png
Re: Code Release - Kamikaze Suit Crate [message #302799 is a reply to message #302788] Wed, 12 December 2007 18:10 Go to previous messageGo to next message
Genesis2001
Messages: 1397
Registered: August 2006
Karma: 0
General (1 Star)
The crate simply attaches my script to you. And, my script attaches "JFW_Blow_Up_On_Death" to you with the parameter to make you blow up like an Ion cannon would.


You *could* mix it up and complicate it more and have you blow up with a nuclear explosion. Razz Just play the Nuke Animation and explode with "Explosion_NukeStrikeBeacon" (Just going off the top of my head with that preset...)

~MathK1LL
Re: Code Release - Kamikaze Suit Crate [message #302815 is a reply to message #302788] Wed, 12 December 2007 19:53 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 love the timer, that's funny Smile

Nice release Big Grin



Re: Code Release - Kamikaze Suit Crate [message #302816 is a reply to message #302788] Wed, 12 December 2007 19:58 Go to previous messageGo to next message
Genesis2001
Messages: 1397
Registered: August 2006
Karma: 0
General (1 Star)
Thanks Very Happy

I'm going to be attempting a release of something after Christmas break that'll make it simpler for regulators now Razz (specifically BRenBot)


~MathK1LL
Re: Code Release - Kamikaze Suit Crate [message #302856 is a reply to message #302788] Thu, 13 December 2007 05:20 Go to previous messageGo to next message
Hex is currently offline  Hex
Messages: 858
Registered: March 2004
Karma: 0
Colonel
We have a crates plugin we were working on but got to to the side and never worked on again

EMP (disables and ejects players from all vehicles in xxx meters for xx time)
TeamMoney (like the normal money but the whole team gets it)
DisarmC4 (disarms all the players mines that picked the crate up)
BlownFuse (powers down base defences)

I'll upload the source later, maybe someone else can carry on were we ended


goztow wrote on Tue, 11 May 2010 08:00

If we had to ban all who ever cheated or ever created a cheat (obj3cts and such) then I don't think there would be many members left here (sad fact).


reborn wrote on Fri, 29 January 2010 23:37

std is for pro's. Razz
Re: Code Release - Kamikaze Suit Crate [message #302869 is a reply to message #302856] Thu, 13 December 2007 08:54 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
Hex wrote on Thu, 13 December 2007 06:20

We have a crates plugin we were working on but got to to the side and never worked on again

EMP (disables and ejects players from all vehicles in xxx meters for xx time)
TeamMoney (like the normal money but the whole team gets it)
DisarmC4 (disarms all the players mines that picked the crate up)
BlownFuse (powers down base defences)

I'll upload the source later, maybe someone else can carry on were we ended



EMP cannon? i created a Command in Lua wich Freeze players if you type !Freeze <name>, i used KAK_Freeze_Object
Re: Code Release - Kamikaze Suit Crate [message #302872 is a reply to message #302788] Thu, 13 December 2007 09:11 Go to previous messageGo to next message
CarrierII is currently offline  CarrierII
Messages: 3804
Registered: February 2006
Location: England
Karma: 0
General (3 Stars)

In the code for XpZelite somewhere there is a working fog crate, which deserves to be revived... I also think there was an EMP crate in it.


Renguard is a wonderful initiative
Toggle Spoiler
Re: Code Release - Kamikaze Suit Crate [message #302873 is a reply to message #302869] Thu, 13 December 2007 09:20 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)
MadRockz wrote on Thu, 13 December 2007 10:54

Hex wrote on Thu, 13 December 2007 06:20

We have a crates plugin we were working on but got to to the side and never worked on again

EMP (disables and ejects players from all vehicles in xxx meters for xx time)
TeamMoney (like the normal money but the whole team gets it)
DisarmC4 (disarms all the players mines that picked the crate up)
BlownFuse (powers down base defences)

I'll upload the source later, maybe someone else can carry on were we ended



EMP cannon? i created a Command in Lua wich Freeze players if you type !Freeze <name>, i used KAK_Freeze_Object



The LUA plugin is great, people with no experiance get to start coding and learning. I think Roshambo done a fantastic job with it. It's used by many people and I really think he deserves a cookie for it.

The only trouble is, everyone who uses it seems to only add shitty chat hooks with it. I really think they look tacky and crap. I hate going in a server and seeing "!turret", "!obbygun", "!buy beacon".
It wouldn't be so bad if they stopped working on character/vehichle purchases if the vehichle factory or soldier facotry for there team had been destroyed, and they only worked in proximity to your base. Hell.. some don't even check there team, so a GDI person can buy an sbh or a stank.

I learned the hard way that you shouldn't do something just because you can.

End of rant (I just hate those chat hooks).



Would be cool to see that Hex Very Happy
I would be interested to see how much your base defence crate differs from my one. I know myself and MathKill recyle old DA code if we can, or look to it for help if stuck. I think I am safe in assuming you do to looking at the parachutes code you posted. But everyone has there own twists to it and slight deviations (i'm not suggesting BTW that anyone is any less for doing that, why wouldn't you look at it to see how other examples have been done). I really will enjoy looking at it Smile



Re: Code Release - Kamikaze Suit Crate [message #302874 is a reply to message #302872] Thu, 13 December 2007 09:24 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)
CarrierII wrote on Thu, 13 December 2007 11:11

In the code for XpZelite somewhere there is a working fog crate, which deserves to be revived... I also think there was an EMP crate in it.



sorry for double post, but we posted at the same time.

I don't think the fog crate made it into the public release.
But the fog crate is pretty easy to remake. I was going to do it until I realised that the fog only works for players with BHS.dll.

It would be possible to make it "foggy" for only one player if they have bhs.dll, but if they don't then make then recieve some other crate.



Re: Code Release - Kamikaze Suit Crate [message #302876 is a reply to message #302788] Thu, 13 December 2007 09:29 Go to previous messageGo to next message
Hex is currently offline  Hex
Messages: 858
Registered: March 2004
Karma: 0
Colonel
Evil chat commands Huh used right they are great but people over use them, only thing we have used chat commands for is !sellveh and certain commands for info

On crate topic, We all should just add all of what we have and make one big crate.


goztow wrote on Tue, 11 May 2010 08:00

If we had to ban all who ever cheated or ever created a cheat (obj3cts and such) then I don't think there would be many members left here (sad fact).


reborn wrote on Fri, 29 January 2010 23:37

std is for pro's. Razz
Re: Code Release - Kamikaze Suit Crate [message #302877 is a reply to message #302788] Thu, 13 December 2007 09:41 Go to previous messageGo to next message
CarrierII is currently offline  CarrierII
Messages: 3804
Registered: February 2006
Location: England
Karma: 0
General (3 Stars)

I'm sure it did, if not, I still have the MSN of one of the team members. The BHS.dll limitation is a nuiscance, but like you said, the server can give a different crate if they don't have it. Doesn't stop BHS.dll players getting pwned in fog by non BHS.dll players though. Sad


Renguard is a wonderful initiative
Toggle Spoiler
Re: Code Release - Kamikaze Suit Crate [message #302878 is a reply to message #302788] Thu, 13 December 2007 09:43 Go to previous messageGo to next message
Hex is currently offline  Hex
Messages: 858
Registered: March 2004
Karma: 0
Colonel
This is a plugin rather than changing scripts directly, source attached, I know for a fact that this has some bugs in it and one that has crashed the fds before (as I said, this was put to a side)

goztow wrote on Tue, 11 May 2010 08:00

If we had to ban all who ever cheated or ever created a cheat (obj3cts and such) then I don't think there would be many members left here (sad fact).


reborn wrote on Fri, 29 January 2010 23:37

std is for pro's. Razz
Re: Code Release - Kamikaze Suit Crate [message #302879 is a reply to message #302788] Thu, 13 December 2007 09:50 Go to previous messageGo to next message
cnc95fan is currently offline  cnc95fan
Messages: 1261
Registered: July 2007
Karma: 0
General (1 Star)
Cool, I'll give it a test tommorow.
[EDIT]: Yuck, source code. I cannot compile Scripts.dll.

[Updated on: Thu, 13 December 2007 09:51]

Report message to a moderator

Re: Code Release - Kamikaze Suit Crate [message #302881 is a reply to message #302873] Thu, 13 December 2007 10:07 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


im with you reborn, chat hooks sucks and the !buy and !tanks commands, im working on a command, !send soldier (ai soldier, already have that command)but if gdi barracks dead u cant use the !send command, but i cant get it work with the building dead, can u post a command like !buy sbh in c++ with the function, if the HoN is dead u cant use !sbh then? then i can "convert" it to lua Smile

[Updated on: Thu, 13 December 2007 10:08]

Report message to a moderator

Re: Code Release - Kamikaze Suit Crate [message #302887 is a reply to message #302788] Thu, 13 December 2007 10:20 Go to previous messageGo to next message
Hex is currently offline  Hex
Messages: 858
Registered: March 2004
Karma: 0
Colonel
Something like

//VEHICLE_FACTORY wf/air SOLDIER_FACTORY bar/hand

if(Is_Building_Dead(Find_Building(Get_Team(id),SOLDIER_FACTORY)))
{
// dead building
return;
}





goztow wrote on Tue, 11 May 2010 08:00

If we had to ban all who ever cheated or ever created a cheat (obj3cts and such) then I don't think there would be many members left here (sad fact).


reborn wrote on Fri, 29 January 2010 23:37

std is for pro's. Razz

[Updated on: Thu, 13 December 2007 10:32]

Report message to a moderator

Re: Code Release - Kamikaze Suit Crate [message #302895 is a reply to message #302788] Thu, 13 December 2007 10:50 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
ty Hex do u mean with SOLDER_FACTORY mp_gdi_barracks or something? and (id) 0,1 and 2?

[Updated on: Thu, 13 December 2007 10:52]

Report message to a moderator

Re: Code Release - Kamikaze Suit Crate [message #302896 is a reply to message #302895] Thu, 13 December 2007 10:53 Go to previous messageGo to next message
Hex is currently offline  Hex
Messages: 858
Registered: March 2004
Karma: 0
Colonel
No, VEHICLE_FACTORY = wf/air SOLDIER_FACTORY = bar/hand, id would be how ever you are getting the players ID (id, obj, sender...)

goztow wrote on Tue, 11 May 2010 08:00

If we had to ban all who ever cheated or ever created a cheat (obj3cts and such) then I don't think there would be many members left here (sad fact).


reborn wrote on Fri, 29 January 2010 23:37

std is for pro's. Razz

[Updated on: Thu, 13 December 2007 10:54]

Report message to a moderator

Re: Code Release - Kamikaze Suit Crate [message #302897 is a reply to message #302788] Thu, 13 December 2007 10:56 Go to previous messageGo to next message
Genesis2001
Messages: 1397
Registered: August 2006
Karma: 0
General (1 Star)
EDIT: nvm. Blush

[Updated on: Thu, 13 December 2007 11:00]

Report message to a moderator

Re: Code Release - Kamikaze Suit Crate [message #302899 is a reply to message #302788] Thu, 13 December 2007 11:03 Go to previous messageGo to next message
Hex is currently offline  Hex
Messages: 858
Registered: March 2004
Karma: 0
Colonel
Sorry, we seem to have hyjacked your thread :/


goztow wrote on Tue, 11 May 2010 08:00

If we had to ban all who ever cheated or ever created a cheat (obj3cts and such) then I don't think there would be many members left here (sad fact).


reborn wrote on Fri, 29 January 2010 23:37

std is for pro's. Razz
Re: Code Release - Kamikaze Suit Crate [message #302900 is a reply to message #302788] Thu, 13 December 2007 11:04 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)
Yeah, sorry math Sad


Anyway, madrocks...


class sbhChatCommand : public ChatCommandClass {
	void Triggered(int ID,const TokenClass &Text,int ChatType) {
		GameObject *obj = Get_GameObj(ID);
float Credits = Commands->Get_Money(obj);
int Team = Get_Object_Type(obj);
GameObject *hon = Find_Soldier_Factory(0);
Vector3 position;
position = Commands->Get_Position(obj);
if(hon){
if(Credits >= 2000 && (Team == 0) ){
	Commands->Give_Money(obj,-2000,false);
Change_Character(obj,"CnC_Nod_FlameThrower_2SF");
Commands->Set_Position(obj,position);
	}
else{
Console_Input(StrFormat("ppage %d You have not been charged for this purchase because you did not meet requirements.",Get_Player_ID(obj)).c_str());		
}
}
	}
};
ChatCommandRegistrant<sbhChatCommand> sbhChatCommandReg("!sbh",CHATTYPE_TEAM,0,GAMEMODE_AOW);



I havn't looked at your code yet hex, looking foward to it Smile



[Updated on: Thu, 13 December 2007 11:05]

Report message to a moderator

Re: Code Release - Kamikaze Suit Crate [message #302932 is a reply to message #302899] Thu, 13 December 2007 15:44 Go to previous messageGo to next message
Genesis2001
Messages: 1397
Registered: August 2006
Karma: 0
General (1 Star)
Hex wrote on Thu, 13 December 2007 11:03

Sorry, we seem to have hyjacked your thread :/



My edit was because I was at school and was posting that when you were... and we posted the same thing.


~MathK1LL
Re: Code Release - Kamikaze Suit Crate [message #302986 is a reply to message #302856] Thu, 13 December 2007 20:26 Go to previous messageGo to next message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma: 1
General (3 Stars)
Hex wrote on Thu, 13 December 2007 04:20

We have a crates plugin we were working on but got to to the side and never worked on again

EMP (disables and ejects players from all vehicles in xxx meters for xx time)
TeamMoney (like the normal money but the whole team gets it)
DisarmC4 (disarms all the players mines that picked the crate up)
BlownFuse (powers down base defences)

I'll upload the source later, maybe someone else can carry on were we ended


I have those 2 Big Grin , but not the team money.


http://s18.postimage.org/jc6qbn4k9/bricks3.png
Re: Code Release - Kamikaze Suit Crate [message #303336 is a reply to message #302788] Sat, 15 December 2007 14:25 Go to previous messageGo to next message
Genesis2001
Messages: 1397
Registered: August 2006
Karma: 0
General (1 Star)
class zbl_Kamikaze_Suit_Crate : public ScriptImpClass {
	int Team;
	void Created(GameObject *obj);
	void Timer_Expired(GameObject *obj, int number);
};




Thanks to Hex for pointing out that I didn't post my class declaration.


~MathK1LL
Re: Code Release - Kamikaze Suit Crate [message #306621 is a reply to message #302788] Sun, 30 December 2007 04:28 Go to previous messageGo to previous message
wittebolx is currently offline  wittebolx
Messages: 332
Registered: May 2007
Location: the netherlands
Karma: 0
Recruit
MathK1LL wrote on Thu, 13 December 2007 01:35

I'm feeling generous so here you guys are! Very Happy

This is for people who like to mod their Server Scripts.dll and are running SSGM.
Hope you enjoy this. Smile

Thanks,
MathK1LL


Hex wrote on Thu, 13 December 2007 13:20

We have a crates plugin we were working on but got to to the side and never worked on again

EMP (disables and ejects players from all vehicles in xxx meters for xx time)
TeamMoney (like the normal money but the whole team gets it)
DisarmC4 (disarms all the players mines that picked the crate up)
BlownFuse (powers down base defences)

I'll upload the source later, maybe someone else can carry on were we ended


thx Guys!
now i got 5 extra crates in the game Big Grin
they all work ok!


Previous Topic: Editing Reborn
Next Topic: How to add an OBGun in SSGM
Goto Forum:
  


Current Time: Fri Dec 20 11:04:06 MST 2024

Total time taken to generate the page: 0.01861 seconds