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 |
Genesis2001
Messages: 1397 Registered: August 2006
Karma: 0
|
General (1 Star) |
|
|
I'm feeling generous so here you guys are!
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
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:
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.
Thanks,
MathK1LL
[Updated on: Fri, 30 January 2009 14:24] by Moderator Report message to a moderator
|
|
|
|
Re: Code Release - Kamikaze Suit Crate [message #302799 is a reply to message #302788] |
Wed, 12 December 2007 18:10 |
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. 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 #302873 is a reply to message #302869] |
Thu, 13 December 2007 09:20 |
|
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
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
|
|
|
Re: Code Release - Kamikaze Suit Crate [message #302874 is a reply to message #302872] |
Thu, 13 December 2007 09:24 |
|
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 #302881 is a reply to message #302873] |
Thu, 13 December 2007 10:07 |
|
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
[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 |
|
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.
|
[Updated on: Thu, 13 December 2007 10:32] 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 |
|
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.
|
[Updated on: Thu, 13 December 2007 10:54] Report message to a moderator
|
|
|
|
|
Re: Code Release - Kamikaze Suit Crate [message #302900 is a reply to message #302788] |
Thu, 13 December 2007 11:04 |
|
reborn
Messages: 3231 Registered: September 2004 Location: uk - london
Karma: 0
|
General (3 Stars) |
|
|
Yeah, sorry math
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
[Updated on: Thu, 13 December 2007 11:05] Report message to a moderator
|
|
|
|
|
Re: Code Release - Kamikaze Suit Crate [message #303336 is a reply to message #302788] |
Sat, 15 December 2007 14:25 |
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
|
|
|
|
Goto Forum:
Current Time: Sat Nov 02 07:26:21 MST 2024
Total time taken to generate the page: 0.01185 seconds
|