Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Code/Source Request Crates
Code/Source Request Crates [message #325515] Mon, 07 April 2008 14:41 Go to next message
wittebolx is currently offline  wittebolx
Messages: 332
Registered: May 2007
Location: the netherlands
Karma: 0
Recruit
Many thx to Reborn and Hex for there source release on several crates.

Crate code release on request from EA-DamageEverything.

gmmain.cpp
/////////////////////////
/////////////////////////
//Electromagnetic Pulse//
/////////////////////////
/////////////////////////

void reb_Electromagnetic_pulse::Created(GameObject *obj) {

		Commands->Set_Rain(10.0f,3.5f,true);
		Commands->Set_Wind(0.7f,2.0f,1.0f,3.5f);


		char empstormmsg[128];
		char empstormmsg2[128];
		Commands->Create_2D_WAV_Sound("m00evag_dsgn0069i1evag_snd.wav");
		sprintf(empstormmsg,"msg Warning!!!");
		Console_Input(empstormmsg);
		sprintf(empstormmsg2,"msg Electromagnetic Pulse approaching...");
		Console_Input(empstormmsg2);



		Commands->Start_Timer(obj,this,3.0f,1);
		Commands->Start_Timer(obj,this,4.0f,2);
		Commands->Start_Timer(obj,this,4.7f,3);
		Commands->Start_Timer(obj,this,14.7f,4);
		Commands->Start_Timer(obj,this,15.7f,5);
		Commands->Start_Timer(obj,this,16.7f,6);
		Commands->Start_Timer(obj,this,17.7f,7);
		Commands->Start_Timer(obj,this,18.7f,8);
		Commands->Start_Timer(obj,this,19.7f,9);
		Commands->Start_Timer(obj,this,20.4f,10);
		Commands->Start_Timer(obj,this,21.4f,11);
		Commands->Start_Timer(obj,this,22.0f,12);
		Commands->Start_Timer(obj,this,23.0f,13);
		Commands->Start_Timer(obj,this,23.6f,14);
		Commands->Start_Timer(obj,this,24.2f,15);
		Commands->Start_Timer(obj,this,24.8f,16);
		Commands->Start_Timer(obj,this,25.4f,17);
		Commands->Start_Timer(obj,this,26.6f,18);
		Commands->Start_Timer(obj,this,27.2f,19);
		Commands->Start_Timer(obj,this,28.2f,20);
		Commands->Start_Timer(obj,this,28.8f,21);
		Commands->Start_Timer(obj,this,29.6f,22);
		Commands->Start_Timer(obj,this,30.2f,23);
		Commands->Start_Timer(obj,this,31.2f,24);
		Commands->Start_Timer(obj,this,42.2f,25);
}

void reb_Electromagnetic_pulse::Timer_Expired(GameObject *obj, int number) {

	    char empstormmsg[128];

	    if(number == 1){
		Commands->Create_2D_WAV_Sound("m00evag_dsgn0097i1evag_snd.wav");
		
	}
		if(number == 2){
		Commands->Create_2D_WAV_Sound("m00evag_dsgn0076i1evag_snd.wav");
		
	}
		if(number == 3){
		Commands->Create_2D_WAV_Sound("m00evag_dsgn0098i1evag_snd.wav");
		
	}
/////////////////////////////////////
// numer count down 5,4,3,2,1
/////////////////////////////////////
		if(number == 4){
		Commands->Create_2D_WAV_Sound("m00evag_dsgn0082i1evag_snd.wav");
		sprintf(empstormmsg,"msg 5");
		Console_Input(empstormmsg);
	}
		if(number == 5){
		Commands->Create_2D_WAV_Sound("m00evag_dsgn0083i1evag_snd.wav");
		sprintf(empstormmsg,"msg 4");
		Console_Input(empstormmsg);
	}
		if(number == 6){
		Commands->Create_2D_WAV_Sound("m00evag_dsgn0084i1evag_snd.wav");
		sprintf(empstormmsg,"msg 3");
		Console_Input(empstormmsg);
	}
		if(number == 7){
		Commands->Create_2D_WAV_Sound("m00evag_dsgn0085i1evag_snd.wav");
		sprintf(empstormmsg,"msg 2");
		Console_Input(empstormmsg);
	}
		if(number == 8){
		Commands->Create_2D_WAV_Sound("m00evag_dsgn0086i1evag_snd.wav");
		sprintf(empstormmsg,"msg 1");
		Console_Input(empstormmsg);
	}
////////////////////////////////
// actual EMP starts here
////////////////////////////////
        if(number == 9){
Vector3 position;
position = Commands->Get_Position(Find_War_Factory(2));
position.Y += 20.0f;

Commands->Create_2D_WAV_Sound("cc_pwr_dwn_01.wav");
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
GenericSLNode *x = BaseGameObjList->HeadNode;
while (x) {
GameObject *o = (GameObject *)x->NodeData;
if (o && Is_Vehicle(o)) {
		    if (Commands->Get_Distance(Commands->Get_Position(o),position) < 1000) {
			Attach_Script_Once(o,"EMP_Effect","");
		}
	   }
	   x = x->NodeNext;
	}
 }
		if(number == 10){
Vector3 position;
position = Commands->Get_Position(Find_Refinery(2));
position.Y -= 20.0f;

Commands->Create_2D_WAV_Sound("cc_pwr_dwn_01.wav");
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
GenericSLNode *x = BaseGameObjList->HeadNode;
while (x) {
GameObject *o = (GameObject *)x->NodeData;
if (o && Is_Vehicle(o)) {
		    if (Commands->Get_Distance(Commands->Get_Position(o),position) < 1000) {
			Attach_Script_Once(o,"EMP_Effect","");
		}
	   }
	   x = x->NodeNext;
	}
 }
		if(number == 11){
Vector3 position;
position = Commands->Get_Position(Find_Soldier_Factory(2));
position.X += 15.0f;

Commands->Create_2D_WAV_Sound("cc_pwr_dwn_01.wav");
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
GenericSLNode *x = BaseGameObjList->HeadNode;
while (x) {
GameObject *o = (GameObject *)x->NodeData;
if (o && Is_Vehicle(o)) {
		    if (Commands->Get_Distance(Commands->Get_Position(o),position) < 1000) {
			Attach_Script_Once(o,"EMP_Effect","");
		}
	   }
	   x = x->NodeNext;
	}
 }
		if(number == 12){
Vector3 position;
position = Commands->Get_Position(Find_Refinery(2));

Commands->Create_2D_WAV_Sound("cc_pwr_dwn_01.wav");
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);

float refhealth = Commands->Get_Health(Find_Refinery(2));
Commands->Set_Health((Find_Refinery(2)),(refhealth/1.3f));
	}
		if(number == 13){
Vector3 position;
position = Commands->Get_Position(Find_War_Factory(2));
position.Y -= 20.0f;

Commands->Create_2D_WAV_Sound("cc_pwr_dwn_01.wav");
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
GenericSLNode *x = BaseGameObjList->HeadNode;
while (x) {
GameObject *o = (GameObject *)x->NodeData;
if (o && Is_Vehicle(o)) {
		    if (Commands->Get_Distance(Commands->Get_Position(o),position) < 1000) {
			Attach_Script_Once(o,"EMP_Effect","");
		}
	   }
	   x = x->NodeNext;
	}
 }
		if(number == 14){
Vector3 position;
position = Commands->Get_Position(Find_Soldier_Factory(2));
position.Y -= 20.0f;

Commands->Create_2D_WAV_Sound("cc_pwr_dwn_01.wav");
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
GenericSLNode *x = BaseGameObjList->HeadNode;
while (x) {
GameObject *o = (GameObject *)x->NodeData;
if (o && Is_Vehicle(o)) {
		    if (Commands->Get_Distance(Commands->Get_Position(o),position) < 1000) {
			Attach_Script_Once(o,"EMP_Effect","");
		}
	   }
	   x = x->NodeNext;
	}
 }
		if(number == 15){
Vector3 position;
position = Commands->Get_Position(Find_Base_Defense(2));


Commands->Create_2D_WAV_Sound("cc_pwr_dwn_01.wav");
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);

float agthealth = Commands->Get_Health(Find_Base_Defense(2));
Commands->Set_Health((Find_Base_Defense(2)),(agthealth/1.4f));
GenericSLNode *x = BaseGameObjList->HeadNode;
while (x) {
GameObject *o = (GameObject *)x->NodeData;
if (o && Is_Vehicle(o)) {
		    if (Commands->Get_Distance(Commands->Get_Position(o),position) < 1000) {
			Attach_Script_Once(o,"EMP_Effect","");
		}
	   }
	   x = x->NodeNext;
	}
 }
		if(number == 16){
Vector3 position;
position = Commands->Get_Position(Find_Base_Defense(2));
position.X += 10.0f;

Commands->Create_2D_WAV_Sound("cc_pwr_dwn_01.wav");
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
GenericSLNode *x = BaseGameObjList->HeadNode;
while (x) {
GameObject *o = (GameObject *)x->NodeData;
if (o && Is_Vehicle(o)) {
		    if (Commands->Get_Distance(Commands->Get_Position(o),position) < 1000) {
			Attach_Script_Once(o,"EMP_Effect","");
		}
	   }
	   x = x->NodeNext;
	}
 }
		if(number == 17){
Vector3 position;
position = Commands->Get_Position(Find_Soldier_Factory(2));

Commands->Create_2D_WAV_Sound("cc_pwr_dwn_01.wav");
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);

float barhealth = Commands->Get_Health(Find_Soldier_Factory(2));
Commands->Set_Health((Find_Soldier_Factory(2)),(barhealth/1.35f));
GenericSLNode *x = BaseGameObjList->HeadNode;
while (x) {
GameObject *o = (GameObject *)x->NodeData;
if (o && Is_Vehicle(o)) {
		    if (Commands->Get_Distance(Commands->Get_Position(o),position) < 1000) {
			Attach_Script_Once(o,"EMP_Effect","");
		}
	   }
	   x = x->NodeNext;
	}
 }
		if(number == 18){
Vector3 position;
position = Commands->Get_Position(Find_Refinery(2));
position.Y -= 10.0f;

Commands->Create_2D_WAV_Sound("cc_pwr_dwn_01.wav");
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
GenericSLNode *x = BaseGameObjList->HeadNode;
while (x) {
GameObject *o = (GameObject *)x->NodeData;
if (o && Is_Vehicle(o)) {
		    if (Commands->Get_Distance(Commands->Get_Position(o),position) < 1000) {
			Attach_Script_Once(o,"EMP_Effect","");
		}
	   }
	   x = x->NodeNext;
	}
 }
		if(number == 19){
Vector3 position;
position = Commands->Get_Position(Find_Refinery(2));
position.X += 5.0f;

Commands->Create_2D_WAV_Sound("cc_pwr_dwn_01.wav");
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
GenericSLNode *x = BaseGameObjList->HeadNode;
while (x) {
GameObject *o = (GameObject *)x->NodeData;
if (o && Is_Vehicle(o)) {
		    if (Commands->Get_Distance(Commands->Get_Position(o),position) < 1000) {
			Attach_Script_Once(o,"EMP_Effect","");
		}
	   }
	   x = x->NodeNext;
	}
 }
		if(number == 20){
Vector3 position;
position = Commands->Get_Position(Find_War_Factory(2));

Commands->Create_2D_WAV_Sound("cc_pwr_dwn_01.wav");
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);

float wepshealth = Commands->Get_Health(Find_War_Factory(2));
Commands->Set_Health((Find_War_Factory(2)),(wepshealth/1.4f));
GenericSLNode *x = BaseGameObjList->HeadNode;
while (x) {
GameObject *o = (GameObject *)x->NodeData;
if (o && Is_Vehicle(o)) {
		    if (Commands->Get_Distance(Commands->Get_Position(o),position) < 1000) {
			Attach_Script_Once(o,"EMP_Effect","");
		}
	   }
	   x = x->NodeNext;
	}
 }
		if(number == 21){
Vector3 position;
position = Commands->Get_Position(Find_War_Factory(2));
position.X += 10.0f;

Commands->Create_2D_WAV_Sound("cc_pwr_dwn_01.wav");
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
GenericSLNode *x = BaseGameObjList->HeadNode;
while (x) {
GameObject *o = (GameObject *)x->NodeData;
if (o && Is_Vehicle(o)) {
		    if (Commands->Get_Distance(Commands->Get_Position(o),position) < 1000) {
			Attach_Script_Once(o,"EMP_Effect","");
		}
	   }
	   x = x->NodeNext;
	}
 }
		if(number == 22){
Vector3 position;
position = Commands->Get_Position(Find_Base_Defense(2));
position.Y += 15.0f;

Commands->Create_2D_WAV_Sound("cc_pwr_dwn_01.wav");
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
GenericSLNode *x = BaseGameObjList->HeadNode;
while (x) {
GameObject *o = (GameObject *)x->NodeData;
if (o && Is_Vehicle(o)) {
		    if (Commands->Get_Distance(Commands->Get_Position(o),position) < 1000) {
			Attach_Script_Once(o,"EMP_Effect","");
		}
	   }
	   x = x->NodeNext;
	}
 }
		if(number == 23){
Vector3 position;
position = Commands->Get_Position(Find_Base_Defense(2));
position.X += 5.0f;

Commands->Create_2D_WAV_Sound("cc_pwr_dwn_01.wav");
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);
GenericSLNode *x = BaseGameObjList->HeadNode;
while (x) {
GameObject *o = (GameObject *)x->NodeData;
if (o && Is_Vehicle(o)) {
		    if (Commands->Get_Distance(Commands->Get_Position(o),position) < 1000) {
			Attach_Script_Once(o,"EMP_Effect","");
		}
	   }
	   x = x->NodeNext;
	}
 }
		if(number == 24){
Vector3 position;
position = Commands->Get_Position(Find_Power_Plant(2));

Commands->Create_2D_WAV_Sound("cc_pwr_dwn_01.wav");
Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",position);

float pphealth = Commands->Get_Health(Find_Power_Plant(2));
Commands->Set_Health((Find_Power_Plant(2)),(pphealth/1.3f));

//////////////////////////////////
/// turn the weather off 
///////////////////////////////////
		Commands->Set_Rain(0.0f,10.0f,true);
		Commands->Set_Wind(0.0f,0.0f,0.0f,3.5f);
	}
		if(number == 25){
		Commands->Set_Fog_Enable(0);
		sprintf(empstormmsg,"msg The Electromagnetic Pulse has sub-sided.");
		Console_Input(empstormmsg);
	}

}

void EMP_Effect::Created(GameObject *obj) {
	Force_Occupants_Exit(obj);
	Commands->Enable_Vehicle_Transitions(obj,false);
	Commands->Start_Timer(obj,this,30,1);
}
void EMP_Effect::Timer_Expired(GameObject *obj,int number) {
	if (number == 1) {
		Commands->Enable_Vehicle_Transitions(obj,true);
		Destroy_Script();
	}
}
void Power_Down::Created(GameObject *obj) {
	Commands->Set_Building_Power(obj,false);
	Commands->Start_Timer(obj,this,120,1);
}
void Power_Down::Timer_Expired(GameObject *obj,int number) {
	if (number == 1) {
		if (Is_Base_Powered(Get_Object_Type(obj))) {
			Commands->Set_Building_Power(obj,true);
		}
		Destroy_Script();
	}
}
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 [WGC]: 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());
		}
	}
}


gmmain.h
class reb_Electromagnetic_pulse : public ScriptImpClass {
	void Created(GameObject *obj);
	void Timer_Expired(GameObject *obj,int number);
};


class zbl_kamikaze_Suit_Crate : public ScriptImpClass {
	int Team;
	void Created(GameObject *obj);
	void Timer_Expired(GameObject *obj, int number);
};


class EMP_Effect : public ScriptImpClass {
	void Created(GameObject *obj);
	void Timer_Expired(GameObject *obj,int number);
};


class Power_Down : public ScriptImpClass {
	void Created(GameObject *obj);
	void Timer_Expired(GameObject *obj,int number);
};

gmcrate.h
/*	Renegade Scripts.dll
	SSGM crate scripts
	Copyright 2007 Vloktboky, WhiteDragon(MDB), Mac, Jonathan Wilson

	This file is part of the Renegade scripts.dll
	The Renegade scripts.dll is free software; you can redistribute it and/or modify it under
	the terms of the GNU General Public License as published by the Free
	Software Foundation; either version 2, or (at your option) any later
	version. See the file COPYING for more details.
	In addition, an exemption is given to allow Run Time Dynamic Linking of this code with any closed source module that does not contain code covered by this licence.
	Only the source code to the module(s) containing the licenced code has to be released.
*/

#ifndef CRATE_H
#define CRATE_H

#include "gmsettingsclass.h"


//Crate specific settings
struct CrateSettings : public virtual SettingsLoader {
	CrateSettings(const char *ININame) : SettingsLoader(ININame) {
		EnableCrates = false;
		EnableNewCrates = false;
		VehCrate = false;
		CrateVehSpawnPos[0] = Vector3(0,0,0);
		CrateVehSpawnPos[1] = Vector3(0,0,0);
	}

	virtual void Load();

	//Settings added in 1.3.4
	bool EnableCrates;
	//Settings added in 1.4
	bool EnableNewCrates;
	bool VehCrate;
	//Settings added in 1.6
	Vector3	CrateVehSpawnPos[2];
	int	CrateWeapon;
	int	CrateMoney;	
	int	CratePoints;
	int	CrateVehicle;
	int	CrateDeath;
	int	CrateTiberium;
	int	CrateAmmo;
	int	CrateArmor;
	int	CrateHealth;
	int	CrateCharacter;
	int	CrateButterFingers;
	int	CrateRefill;
	int	CrateBeacon;
	int	CrateSpy;
	int	CrateStealth;
	int	CrateThief;
	int Cratekamikaze;
	int CrateEMP;
	int CrateTeamMoney;
	int CrateDisarmC4;
	int CrateBlownFuse;
	int CratePromote;
	int CrateEMPStorm;
};

//Crate specific data
struct CrateData {
	CrateData() {
		CrateExists = false;
		CrateLastPickup = -181;
		CrateID = 0;
	}
	bool CrateExists;
	int	CrateLastPickup;
	int CrateID;
};

void Crate_Level_Loaded();


//******************************************************************************
//*************************** CRATE RELATED SCRIPTS ****************************
//******************************************************************************


//Attached to all crates.
class MDB_SSGM_Crate : public ScriptImpClass {
	void Created(GameObject *obj);
	void Custom(GameObject *obj, int message, int param, GameObject *sender);
	int vehBlocker;
	bool PickedUp;
};

class KAK_Prevent_Destruction_Until_Entered : public ScriptImpClass {
	void Created(GameObject *obj);
	void Damaged(GameObject *obj, GameObject *damager, float damage);
	void Custom(GameObject *obj, int message, int param, GameObject *sender);
	void Timer_Expired(GameObject *obj, int number);
};

#endif

gmcrate.cpp
/*	Renegade Scripts.dll
	SSGM crate scripts
	Copyright 2007 Vloktboky, WhiteDragon(MDB), Mac, Jonathan Wilson

	This file is part of the Renegade scripts.dll
	The Renegade scripts.dll is free software; you can redistribute it and/or modify it under
	the terms of the GNU General Public License as published by the Free
	Software Foundation; either version 2, or (at your option) any later
	version. See the file COPYING for more details.
	In addition, an exemption is given to allow Run Time Dynamic Linking of this code with any closed source module that does not contain code covered by this licence.
	Only the source code to the module(s) containing the licenced code has to be released.
*/

#include <stdlib.h>
#include <time.h>
#include "scripts.h"
#include "engine.h"
#include "date.h"
#include "gmmain.h"

void CrateSettings::Load() {
	LoadBool(EnableCrates,"EnableCrates");
	LoadBool(EnableNewCrates,"EnableNewCrates");

	if (EnableNewCrates) {
		LoadBool(VehCrate,"AllowVehCrates",false);

		LoadVector3(CrateVehSpawnPos[0],"NodRVC",Vector3(0.0f,0.0f,0.0f),false,true,false);
		LoadVector3(CrateVehSpawnPos[1],"GDIRVC",Vector3(0.0f,0.0f,0.0f),false,true,false);	

		CrateWeapon = INI->Get_Int("Crates","Weapon",0);
		CrateMoney = INI->Get_Int("Crates","Money",0);
		CratePoints = INI->Get_Int("Crates","Points",0);
		CrateVehicle = INI->Get_Int("Crates","Vehicle",0);
		CrateDeath = INI->Get_Int("Crates","Death",0);
		CrateTiberium = INI->Get_Int("Crates","Tiberium",0);
		CrateAmmo = INI->Get_Int("Crates","Ammo",0);
		CrateArmor = INI->Get_Int("Crates","Armor",0);
		CrateHealth = INI->Get_Int("Crates","Health",0);
		CrateCharacter = INI->Get_Int("Crates","Character",0);
		CrateButterFingers = INI->Get_Int("Crates","ButterFingers",0);
		CrateRefill = INI->Get_Int("Crates","Refill",0);
		CrateBeacon = INI->Get_Int("Crates","Beacon",0);
		CrateSpy = INI->Get_Int("Crates","Spy",0);
		CrateStealth = INI->Get_Int("Crates","Stealth",0);
		CrateThief = INI->Get_Int("Crates","Thief",0);
		Cratekamikaze = INI->Get_Int("Crates","kamikaze",0);
		CrateEMP = INI->Get_Int("Crates","EMP",0);
		CrateTeamMoney = INI->Get_Int("Crates","TeamMoney",0);
		CrateDisarmC4 = INI->Get_Int("Crates","DisarmC4",0);
		CrateBlownFuse = INI->Get_Int("Crates","BlownFuse",0);
		CratePromote = INI->Get_Int("Crates","Promote",0);
		CrateEMPStorm = INI->Get_Int("Crates","EMPStorm",0);
	}
}

char *RandomWeapon[24][3] = {
	{ "Auto	Rifle",	"POW_AutoRifle_Player",	"m00pwar_aqob0004i1evag_snd.wav" },
	{ "Shotgun", "POW_Shotgun_Player", "m00pwps_aqob0004i1evag_snd.wav"	},
	{ "Flamethrower", "POW_Flamethrower_Player", "m00pwft_aqob0001i1evag_snd.wav" },
	{ "Grenade Launcher", "POW_GrenadeLauncher_Player",	"m00pwgl_aqob0004i1evag_snd.wav" },
	{ "Repair Gun(Weak)", "POW_RepairGun_Player", "m00pwrp_aqob0001i1evag_snd.wav" },
	{ "Remote C4", "CnC_POW_MineRemote_02",	"m00pacp_aqob0004i1evag_snd.wav" },
	{ "Chain Gun", "POW_Chaingun_Player", "m00pwcg_aqob0004i1evag_snd.wav" },
	{ "Rocket Launcher(Weak)", "POW_RocketLauncher_Player",	"m00pwrl_aqob0004i1evag_snd.wav" },
	{ "Chemical	Sprayer", "POW_ChemSprayer_Player",	"m00pwcs_aqob0004i1evag_snd.wav" },
	{ "Tiberium	Auto Rifle", "POW_TiberiumAutoRifle_Player", "m00pwtr_aqob0004i1evag_snd.wav" },
	{ "Sniper Rifle", "POW_SniperRifle_Player",	"m00pwsr_aqob0004i1evag_snd.wav" },
	{ "Laser Chaingun",	"POW_LaserChaingun_Player",	"m00pwlc_aqob0004i1evag_snd.wav" },
	{ "Laser Rifle", "POW_LaserRifle_Player", "m00pwlr_aqob0004i1evag_snd.wav" },
	{ "Rocket Launcher(Strong)", "CnC_POW_RocketLauncher_Player", "m00pwrl_aqob0004i1evag_snd.wav" },
	{ "Tiberium	Flechette Gun",	"POW_TiberiumFlechetteGun_Player", "m00pwtf_aqob0004i1evag_snd.wav"	},
	{ "Personal	Ion	Cannon", "POW_PersonalIonCannon_Player", "m00pwpi_aqob0004i1evag_snd.wav" },
	{ "Railgun", "POW_Railgun_Player", "m00pwrg_aqob0004i1evag_snd.wav"	},
	{ "Ramjet Rifle", "POW_RamjetRifle_Player",	"m00pwrj_aqob0004i1evag_snd.wav" },
	{ "Volt	Auto Rifle", "POW_VoltAutoRifle_Player", "m00pwvr_aqob0004i1evag_snd.wav" },
	{ "Volt	Auto Rifle", "CnC_POW_VoltAutoRifle_Player_Nod", "m00pwvr_aqob0004i1evag_snd.wav" },
	{ "Proxy Mines", "CnC_MineProximity_05", "m00pwrj_aqob0004i1evag_snd.wav" },
	{ "Obelisk Gun", "POW_Double_Damage", "m00pwvr_aqob0004i1evag_snd.wav" },
	{ "AGT Missile Gun", "POW_Mobius_Shield", "m00pwvr_aqob0004i1evag_snd.wav" }
};

char *RandomVehicle[12][3] = {
	{ "GDI Humvee",	"humvee", "CnC_GDI_Humm-vee" },
	{ "Nod Buggy", "buggy", "CnC_Nod_Buggy" },
	{ "GDI APC", "gdiapc", "CnC_GDI_APC" },
	{ "Nod APC", "nodapc", "CnC_Nod_APC" },
	{ "GDI MRLS", "mrls", "CnC_GDI_MRLS" },
	{ "Nod Mobile Artillery", "arty", "CnC_Nod_Mobile_Artillery"},
	{ "GDI Medium Tank", "med", "CnC_GDI_Medium_Tank" },
	{ "Nod Light Tank",	"lighttank", "CnC_Nod_Light_Tank" },
	{ "Nod Flame Tank",	"flamer", "CnC_Nod_Flame_Tank" },
	{ "Nod Stealth Tank", "stank", "CnC_Nod_Stealth_Tank" },
	{ "GDI Mammoth Tank", "mammy", "CnC_GDI_Mammoth_Tank" },
	{ "Nod Recon Bike",	"recon", "CnC_Nod_Recon_Bike"}
};

char *RandomGDIChar[20][2] = {
	{ "Officer", "CnC_GDI_MiniGunner_1Off" },
	{ "Rocket Soldier",	"CnC_GDI_RocketSoldier_1Off" },
	{ "Sydney",	"CnC_Sydney" },
	{ "Deadeye", "CnC_GDI_MiniGunner_2SF" },
	{ "Gunner",	"CnC_GDI_RocketSoldier_2SF"	},
	{ "Patch", "CnC_GDI_Grenadier_2SF" },
	{ "Havoc", "CnC_GDI_MiniGunner_3Boss" },
	{ "Prototype Sydney", "CnC_Sydney_PowerSuit" },
	{ "Mobius",	"CnC_Ignatio_Mobius" },
	{ "Hotwire", "CnC_GDI_Engineer_2SF"	},
	{ "Mutated RaveShaw", "Mutant_3Boss_Raveshaw" },
	{ "SBH", "CnC_Nod_FlameThrower_2SF" },
	{ "Warden",	"M08_Nod_Warden" },
	{ "Logan", "CnC_GDI_MiniGunner_2SF_Logan" },
	{ "Prisoner", "GDI_Prisoner_v2b" },
	{ "Visceroid", "CnC_Visceroid" },
	{ "Mutant", "CnC_GDI_Mutant_0_Mutant" },
	{ "Templar", "CnC_GDI_Mutant_2SF_Templar" },
	{ "Holo Kane", "Nod_Kane_HologramHead_small" },
	{ "Petrova", "Mutant_3Boss_Petrova"	}
};

char *RandomNodChar[20][2] = {
	{ "Officer", "CnC_Nod_Minigunner_1Off" },
	{ "Rocket Soldier",	"CnC_Nod_RocketSoldier_1Off" },
	{ "Chem	Warrior", "CnC_Nod_FlameThrower_1Off" },
	{ "Blackhand Sniper", "CnC_Nod_Minigunner_2SF" },
	{ "Laser Chaingunner", "CnC_Nod_RocketSoldier_2SF" },
	{ "Stealth Black Hand",	"CnC_Nod_FlameThrower_2SF" },
	{ "Sakura",	"CnC_Nod_Minigunner_3Boss" },
	{ "Raveshaw", "CnC_Nod_RocketSoldier_3Boss"	},
	{ "Mendoza", "CnC_Nod_FlameThrower_3Boss" },
	{ "Technician",	"CnC_Nod_Technician_0" },
	{ "Mutated RaveShaw", "Mutant_3Boss_Raveshaw" },
	{ "SBH", "CnC_Nod_FlameThrower_2SF" },
	{ "Warden",	"M08_Nod_Warden" },
	{ "Logan", "CnC_GDI_MiniGunner_2SF_Logan" },
	{ "Prisoner", "GDI_Prisoner_v2b" },
	{ "Visceroid", "CnC_Visceroid" },
	{ "Mutant", "CnC_GDI_Mutant_0_Mutant" },
	{ "Templar", "CnC_GDI_Mutant_2SF_Templar" },
	{ "Holo Kane", "Nod_Kane_HologramHead_small" },
	{ "Petrova", "Mutant_3Boss_Petrova"	}
};

void Crate_Defaults() {
	Settings->CrateWeapon = 13;
	Settings->CrateMoney = 4;
	Settings->CratePoints = 8;
	Settings->CrateVehicle = 4;
	Settings->CrateDeath = 2;
	Settings->CrateTiberium = 4;
	Settings->CrateAmmo = 4;
	Settings->CrateArmor = 2;
	Settings->CrateHealth = 4;
	Settings->CrateCharacter = 8;
	Settings->CrateButterFingers = 3;
	Settings->CrateSpy = 3;
	Settings->CrateStealth = 3;
	Settings->CrateRefill = 3;
	Settings->CrateBeacon = 3;
	Settings->CrateThief = 2;
	Settings->Cratekamikaze = 9;
	Settings->CrateEMP = 3;
	Settings->CrateTeamMoney = 2;
	Settings->CrateDisarmC4 = 4;
	Settings->CrateBlownFuse = 5;
	Settings->CratePromote = 4;
	Settings->CrateEMPStorm = 3;
}

void Crate_Level_Loaded() {
	int	Total = 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 + Settings->CrateEMP + Settings->CrateTeamMoney + Settings->CrateDisarmC4 + Settings->CrateBlownFuse + Settings->CratePromote + Settings->CrateEMPStorm;
	if (Total != 100) {
		Crate_Defaults();
		FDSMessage(StrFormat("WGC: Total crate percentages equal %d instead of 100. Using default percentages.",Total),"_ERROR");
	}
	Data->CrateLastPickup = -181;
	Data->CrateExists = false;
	Data->CrateID = 0;
}


//******************************************************************************
//*************************** CRATE RELATED SCRIPTS ****************************
//******************************************************************************

//Attached to all crates.
void MDB_SSGM_Crate::Created(GameObject *obj) {
	if (!Settings->EnableCrates	|| Settings->GameMode == 3 || Settings->GameMode ==	4) {
		Commands->Destroy_Object(obj);
	}
	else if (Settings->EnableNewCrates) {
		if (Data->CrateExists || (The_Game()->GameDuration_Seconds - Data->CrateLastPickup) < 180) {
			Commands->Destroy_Object(obj);
		}
		else {
			PickedUp = false;
			Data->CrateExists = true;
			Commands->Set_Model(obj,"vehcol2m");
			Set_Is_Powerup_Persistant(obj,true);
			Set_Powerup_Always_Allow_Grant(obj,true);
			Set_Powerup_Grant_Sound(obj,0);
		}
	}
	else {
		Destroy_Script();
	}	
}

void MDB_SSGM_Crate::Custom(GameObject *obj,	int	message, int param,	GameObject *sender) {
	if (message	== 1000000025 && !PickedUp) {
		if (Settings->VehCrate || !Get_Vehicle(sender)) {
			int Team = Get_Object_Type(sender);
			if (Team > 1 || Team < 0) {
				return;
			}

			PickedUp = true;
			Data->CrateLastPickup = The_Game()->GameDuration_Seconds;
			Data->CrateExists = false;

			std::string message1; //Console_Input
			std::string message2; //FDSMessage
			std::string message3; //WriteGamelog

			CrateStart:
			int RandomIntCrate = Commands->Get_Random_Int(1,101);
			int	percent	= 0;
			if ((RandomIntCrate	<= (percent+=Settings->CrateWeapon)) && (Settings->CrateWeapon > 0)) {
				Reselect:
				int	Rnd	= Commands->Get_Random_Int(1,101);
				int	Index = 0;
				if (Rnd	<= 10) Index = 0;
				else if	(Rnd<=20) Index	= 1;
				else if	(Rnd<=30) Index	= 2;
				else if	(Rnd<=40) Index	= 3;
				else if	(Rnd<=50) Index	= 4;
				else if	(Rnd<=60) Index	= 5;
				else if	(Rnd<=65) Index	= 6;
				else if	(Rnd<=70) Index	= 7;
				else if	(Rnd<=75) Index	= 8;
				else if	(Rnd<=80) Index	= 9;
				else if	(Rnd<=82) Index	= 10;
				else if	(Rnd<=84) Index	= 11;
				else if	(Rnd<=86) Index	= 12;
				else if	(Rnd<=88) Index	= 13;
				else if	(Rnd<=90) Index	= 14;
				else if	(Rnd<=92) Index	= 15;
				else if	(Rnd<=94) Index	= 16;
				else if	(Rnd<=96) Index	= 17;
				else if	(Rnd<=98) Index	= 18;
				else Index = 19;
				if (Settings->Is_Disabled(RandomWeapon[Index][1])) goto Reselect;
				Commands->Give_Powerup(sender,RandomWeapon[Index][1],true);
				if (RandomWeapon[Index][2][0] != '\0') {
					Create_2D_WAV_Sound_Player(sender,RandomWeapon[Index][2]);
				}
				StrFormat2(message1,"ppage %d [WGC] You just got a %s from the Random Weapon Crate.",Get_Player_ID(sender),RandomWeapon[Index][0]);
				StrFormat2(message2,"[WGC] %ls picked up a Random Weapon Crate.",Get_Wide_Player_Name(sender));
				if (Settings->Gamelog) {
					Vector3 pos	= Commands->Get_Position(sender);
					StrFormat2(message3,"CRATE;WEAPON;%s;%d;%s;%f;%f;%f;%f;%f;%f;%d",RandomWeapon[Index][0],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));
				}
			}
			else if	((RandomIntCrate <=	(percent+=Settings->CrateMoney))	&& (Settings->CrateMoney	> 0)) {
				int	Amount = Commands->Get_Random_Int(1,1000);
				int	RndGood	= Commands->Get_Random_Int(1,2);
				if (RndGood	== 1) {
					Commands->Give_Money(sender,(float)Amount,false);
					Create_2D_WAV_Sound_Player(sender,"m00pc$$_aqob0002i1evag_snd.wav");
				}
				else {
					Commands->Give_Money(sender,(float)(Amount*-1),false);
					if (Commands->Get_Money(sender)	< 0) Commands->Give_Money(sender,(Commands->Get_Money(sender) *	-1),false);
				}
				if (RndGood == 1) {
					StrFormat2(message1,"ppage %d [WGC] You just got the Money Crate, you have gained %d credits.",Get_Player_ID(sender),(int)Amount);
					StrFormat2(message2,"[WGC] %ls picked up a Money Crate.",Get_Wide_Player_Name(sender));
					if (Settings->Gamelog) {
						Vector3 pos = Commands->Get_Position(obj);
						StrFormat2(message3,"CRATE;MONEY;%d;%d;%s;%f;%f;%f;%f;%f;%f;%d", int(Amount),	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));
					}
				}
				else {
					StrFormat2(message1,"ppage %d [WGC] You just got the Demoney Crate, you have lost %d credits, i know it sucks...",Get_Player_ID(sender),(int)Amount);
					StrFormat2(message2,"[WGC] %ls picked up a WGC Demoney Crate.",Get_Wide_Player_Name(sender));
					if (Settings->Gamelog) {
						Vector3 pos = Commands->Get_Position(obj);
						StrFormat2(message3,"CRATE;MONEY;%d;%d;%s;%f;%f;%f;%f;%f;%f;%d", int(Amount) * -1, 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));
					}
				}			
			}
			else if	((RandomIntCrate <=	(percent+=Settings->CratePoints)) &&	(Settings->CratePoints >	0)) {
				int	Amount = Commands->Get_Random_Int(1,500);
				int	RndGood	= Commands->Get_Random_Int(1,2);
				if (RndGood	== 1) {
					Commands->Give_Points(sender,(float)Amount,false);
				}
				else {
					Commands->Give_Points(sender,(float)(Amount*-1),false);
				}

				if (RndGood == 1) {
					StrFormat2(message2,"[WGC] %ls picked up a Points Crate.",Get_Wide_Player_Name(sender));
					StrFormat2(message1,"ppage %d [WGC] You just got the Points Crate, you have gained %d points. you are One step closer to MVP",Get_Player_ID(sender),(int)Amount);
					Console_Input(StrFormat("msg [WGC]: Enjoy those %d points from the Crate God, %ls.",(int)Amount,Get_Wide_Team_Name(Team)).c_str());
					if (Settings->Gamelog) {
						Vector3	pos	= Commands->Get_Position(sender);
						StrFormat2(message3,"CRATE;POINTS;%d;%d;%s;%f;%f;%f;%f;%f;%f;%d",int(Amount), 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));
					}
				}
				else {
					StrFormat2(message2,"[WGC] %ls picked up a Depoints Crate.",Get_Wide_Player_Name(sender));
					StrFormat2(message1,"ppage %d [WGC] You just got the Depoints Crate, you lost %d points, i know it sucks...",Get_Player_ID(sender),(int)Amount);
					Console_Input(StrFormat("msg [WGC]: Hope you won't miss those %d points, %ls.",(int)Amount,Get_Wide_Team_Name(Team)).c_str());
					if (Settings->Gamelog) {
						Vector3	pos	= Commands->Get_Position(sender);
						StrFormat2(message3,"CRATE;POINTS;%d;%d;%s;%f;%f;%f;%f;%f;%f;%d",int(Amount)	* -1, 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));
					}
				}		
			}
			else if	((RandomIntCrate <=	(percent+=Settings->CrateVehicle)) && (Settings->CrateVehicle	> 0)) {
				if (Get_Vehicle(sender) || Settings->GameMode != 1 || Settings->CrateVehSpawnPos[0].X == 0.0f || Settings->CrateVehSpawnPos[0].Y == 0.0f || Settings->CrateVehSpawnPos[0].Z == 0.0f || Settings->CrateVehSpawnPos[1].X == 0.0f || Settings->CrateVehSpawnPos[1].Y == 0.0f || Settings->CrateVehSpawnPos[1].Z == 0.0f) {
					goto CrateStart;
				}
				Vector3	Pos = Settings->CrateVehSpawnPos[Get_Object_Type(sender)];
				Damage_All_Vehicles_Area(999999.0f,"Laser_NoBuilding",Pos,2.0f,obj,0);
				Commands->Set_Position(sender,Pos);

				GameObject *Temp = Commands->Create_Object("Invisible_Object",Pos);
				Reselect2:
				int	Rnd	= Commands->Get_Random_Int(1,201);
				int	Index = 0;
				if (Rnd	<= 25) Index = 0;
				else if	(Rnd <=	50)	Index =	1;
				else if	(Rnd <=	70)	Index =	2;
				else if	(Rnd <=	90)	Index =	3;
				else if	(Rnd <=	110) Index = 4;
				else if	(Rnd <=	130) Index = 5;
				else if	(Rnd <=	145) Index = 6;
				else if	(Rnd <=	160) Index = 7;
				else if	(Rnd <=	170) Index = 8;
				else if	(Rnd <=	180) Index = 9;
				else if	(Rnd <=	190) Index = 10;
				else Index = 11;
				if (Settings->Is_Disabled(RandomVehicle[Index][2])) goto Reselect2;		
				StrFormat2(message2,"[WGC] %ls picked up a Random Vehicle Crate.",Get_Wide_Player_Name(sender));
				StrFormat2(message1,"ppage %d [WGC] You got a %s from the Random Vehicle Crate.",Get_Player_ID(sender), RandomVehicle[Index][0]);
				Commands->Attach_Script(Temp,"Test_Cinematic",StrFormat("%sRVC_%s.txt",Commands->Get_Player_Type(sender)	== 0?"Nod":"GDI",RandomVehicle[Index][1]).c_str());
				Console_Input(StrFormat("msg [WGC]: Looks like %ls just got a random vehicle! Go them!",Get_Wide_Team_Name(Team)).c_str());
				if (Settings->Gamelog) {
					Vector3 pos = Commands->Get_Position(sender);
					StrFormat2(message3,"CRATE;VEHICLE;%s;%d;%s;%f;%f;%f;%f;%f;%f;%d", RandomVehicle[Index][0], 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));
				}	
			}
			else if	((RandomIntCrate <=	(percent+=Settings->CrateDeath))	&& (Settings->CrateDeath	> 0)) {
				StrFormat2(message2,"[WGC] %ls picked up a Death Crate.",Get_Wide_Player_Name(sender));
				Commands->Apply_Damage(Get_Vehicle(sender),99999,"Shrapnel",0);
				Commands->Apply_Damage(sender,99999,"Shrapnel",0);
				Commands->Create_Explosion("Explosion_Mine_Proximity_01",Commands->Get_Position(obj),0);
				StrFormat2(message1,"ppage %d [WGC] You just got a WittebolX Crate, you have been killed. Sorry :(",Get_Player_ID(sender));
				Console_Input(StrFormat("msg [WGC]: Some poor %ls guy got pwned by the WittebolX Crate!!",Get_Wide_Team_Name(Team)).c_str());
				if (Settings->Gamelog)  {
					Vector3	pos;
					pos	= Commands->Get_Position(sender);
					StrFormat2(message3,"CRATE;DEATH;;%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));
				}
			}
			else if	((RandomIntCrate <=	(percent+=Settings->CrateTiberium)) && (Settings->CrateTiberium >	0)) {
				StrFormat2(message2,"[WGC] %ls picked up a Tiberium Death Crate.",Get_Wide_Player_Name(sender));
				Commands->Apply_Damage(Get_Vehicle(sender),99999,"Shrapnel",0);
				Commands->Apply_Damage(sender,99999,"TiberiumRaw",false);
				Commands->Create_Object("CnC_Visceroid",Commands->Get_Position(sender));
				StrFormat2(message1,"ppage %d [Crate] You have been killed by the tiberium death crate and your remains mutated into a visceroid.",Get_Player_ID(sender));
				Commands->Create_2D_WAV_Sound("m00evag_dsgn0027i1evag_snd.wav");
				if (Settings->Gamelog) {
					Vector3	pos	= Commands->Get_Position(sender);
					StrFormat2(message3,"CRATE;TIBERIUMDEATH;;%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));
				}
			}
			else if	((RandomIntCrate <=	(percent+=Settings->CrateAmmo)) && (Settings->CrateAmmo > 0)) {
				Commands->Give_Powerup(sender,"CnC_POW_Ammo_ClipMax",false);
				Commands->Give_Powerup(sender,"CnC_POW_Ammo_ClipMax",false);
				Commands->Give_Powerup(sender,"CnC_POW_Ammo_ClipMax",false);
				Commands->Give_Powerup(sender,"CnC_POW_Ammo_ClipMax",false);
				StrFormat2(message2,"[WGC] %ls picked up a WittebolX Ammo Refill.",Get_Wide_Player_Name(sender));
				StrFormat2(message1,"ppage %d [WGC] You just got the Ammo Refill Crate, your ammo has been refilled.",Get_Player_ID(sender));
				Create_2D_WAV_Sound_Player(sender,"m00puar_aqob0002i1evag_snd.wav");
				if (Settings->Gamelog) {
					Vector3	pos	= Commands->Get_Position(sender);
					StrFormat2(message3,"CRATE;FULLAMMO;;%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));
				}
			}
			else if	((RandomIntCrate <=	(percent+=Settings->CrateArmor)) && (Settings->CrateArmor > 0)) {
				int	RndGood	= Commands->Get_Random_Int(1,3);
				if (Commands->Get_Shield_Strength(sender) <	2) RndGood = 1;
				if (RndGood	== 1) {
					Commands->Give_Powerup(sender,"POW_Medal_Armor",true);
					StrFormat2(message2,"[WGC] %ls picked up a Armor Upgrade.",Get_Wide_Player_Name(sender));
					StrFormat2(message1,"ppage %d [WGC] You just got the Armor Upgrade, your max armor has been increased!",Get_Player_ID(sender));
					if (Settings->Gamelog) {
						Vector3	pos	= Commands->Get_Position(sender);
						StrFormat2(message3,"CRATE;ARMORINCREASE;;%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));
					}
				}
				else {
					Commands->Set_Shield_Strength(sender,1);
					StrFormat2(message2,"[WGC] %ls picked up a Dearmor Crate.",Get_Wide_Player_Name(sender));
					StrFormat2(message1,"ppage %d [WGC] You just got the Dearmor Crate, your armor has been set to 1.",Get_Player_ID(sender));
					if (Settings->Gamelog) {
						Vector3	pos	= Commands->Get_Position(sender);
						StrFormat2(message3,"CRATE;ARMORLOST;;%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));
					}
				}
			}
			else if	((RandomIntCrate <=	(percent+=Settings->CrateHealth)) &&	(Settings->CrateHealth >	0)) {
				int	RndGood	= Commands->Get_Random_Int(1,3);
				if (Commands->Get_Health(sender) ==	1) RndGood = 1;
				if (RndGood	== 1) {
					Commands->Give_Powerup(sender,"POW_Medal_Health",true);
					StrFormat2(message2,"[WGC] %ls picked up a Health Upgrade.",Get_Wide_Player_Name(sender));
					StrFormat2(message1,"ppage %d [WGC] You just got the Health Upgrade Crate, your max health has been increased!",Get_Player_ID(sender));
					if (Settings->Gamelog)  {
						Vector3	pos	= Commands->Get_Position(sender);
						StrFormat2(message3,"CRATE;HEALTHUPGRADE;;%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));
					}
				}
				else {
					Commands->Set_Health(sender,1);
					StrFormat2(message2,"[WGC] %ls picked up a Dehealth Crate.",Get_Wide_Player_Name(sender));
					StrFormat2(message1,"ppage %d [WGC] You just got the Dehealth Crate, your health has been set to 1.",Get_Player_ID(sender));
					Create_2D_WAV_Sound_Player(sender,"m00evag_dsgn0026i1evag_snd.wav");
					if (Settings->Gamelog) {
						Vector3 pos = Commands->Get_Position(sender);
						StrFormat2(message3,"CRATE;HEALTHREDUCE;;%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));
					}
				}
			}
			else if	((RandomIntCrate <=	(percent+=Settings->CrateCharacter))	&& (Settings->CrateCharacter	> 0)) {
				if (Get_Vehicle(sender) || Settings->GameMode == 3 || Settings->GameMode == 4) {
					goto CrateStart;
				}
				Reselect3:
				int	Rnd	= Commands->Get_Random_Int(1,101);
				int	Index = 0;
				if (Rnd	<= 20) Index = 0;
				else if	(Rnd <=	40)	Index =	1;
				else if	(Rnd <=	50)	Index =	2;
				else if	(Rnd <=	60)	Index =	3;
				else if	(Rnd <=	70)	Index =	4;
				else if	(Rnd <=	80)	Index =	5;
				else if	(Rnd <=	85)	Index =	6;
				else if	(Rnd <=	90)	Index =	7;
				else if	(Rnd <=	95)	Index =	8;
				else Index = 9;
				if (Team == 1 && Settings->Is_Disabled(RandomGDIChar[Index][1])) {
					goto Reselect3;
				}
				else if (Team == 0 && Settings->Is_Disabled(RandomNodChar[Index][1])) {
					goto Reselect3;
				}
				StrFormat2(message2,"[WGC] %ls picked up a Random WittebolX Character Crate.",Get_Wide_Player_Name(sender));
				if (Commands->Get_Player_Type(sender) == 1) {
					Change_Character(sender,RandomGDIChar[Index][1]);
					StrFormat2(message1,"ppage %d [WGC] You have been transformed into a %s by the Random WittebolX Character Crate.",Get_Player_ID(sender),RandomGDIChar[Index][0]);
					if (Settings->Gamelog)  {
						Vector3	pos	= Commands->Get_Position(sender);
						StrFormat2(message3,"CRATE;CHARACTER;%s;%d;%s;%f;%f;%f;%f;%f;%f;%d", RandomGDIChar[Index][0],	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));
					}
				}
				else {
					Change_Character(sender,RandomNodChar[Index][1]);
					StrFormat2(message1,"ppage %d [WGC] You have been transformed into a %s by the Random WittebolX Character Crate.",Get_Player_ID(sender),RandomNodChar[Index][0]);
					if (Settings->Gamelog)  {
						Vector3	pos	= Commands->Get_Position(sender);
						StrFormat2(message3,"CRATE;CHARACTER;%s;%d;%s;%f;%f;%f;%f;%f;%f;%d", RandomNodChar[Index][0],	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));
					}
				}
			}
			else if	((RandomIntCrate <=	(percent+=Settings->CrateButterFingers))	&& (Settings->CrateButterFingers	> 0)) {
				Commands->Clear_Weapons(sender);
				int	Rnd	= Commands->Get_Random_Int(1,3);
				if (Rnd	== 1) {
					Commands->Give_Powerup(sender,"POW_Pistol_Player",false);
					Commands->Select_Weapon(sender,"Weapon_Pistol_Player");
				}
				else {
					Commands->Give_Powerup(sender,"CnC_POW_MineTimed_Player_01",false);
					Commands->Select_Weapon(sender,"CnC_Weapon_MineTimed_Player");
				}
				StrFormat2(message2,"[WGC] %ls picked up the Butter Fingers Crate.",Get_Wide_Player_Name(sender));
				StrFormat2(message1,"ppage %d [WGC] You picked up the Butter Fingers Crate, you have dropped most of your weapons.",Get_Player_ID(sender));
				if (Settings->Gamelog) {
					Vector3	pos	= Commands->Get_Position(sender);
					StrFormat2(message3,"CRATE;BUTTERFINGER;;%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));
				}
			}
			else if	((RandomIntCrate <=	(percent+=Settings->CrateRefill)) &&	(Settings->CrateRefill >	0)) {
				Grant_Refill(sender);
				StrFormat2(message2,"[WGC] %ls picked up the Refill All Crate.",Get_Wide_Player_Name(sender));
				StrFormat2(message1,"ppage %d [WGC] You just got the Refill Crate, your health, armor, and ammo have all been refilled.",Get_Player_ID(sender));
				Create_2D_WAV_Sound_Player(sender,"m00puar_aqob0002i1evag_snd.wav");
				if (Settings->Gamelog) {
					Vector3	pos	= Commands->Get_Position(sender);
					StrFormat2(message3,"CRATE;REFILL;;%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));
				}
			}
			else if	((RandomIntCrate <=	(percent+=Settings->CrateBeacon)) &&	(Settings->CrateBeacon >	0)) {
				if (Settings->DisableBeacons ||	Settings->GameMode == 2 || Settings->GameMode == 3 || Settings->GameMode == 4) {
					goto CrateStart;
				}
				int	RndGood	= Commands->Get_Random_Int(1,3);
				if (RndGood	== 1) {
					StrFormat2(message2,"[WGC] %ls picked up a Beacon Crate.",Get_Wide_Player_Name(sender));
					if (Commands->Get_Player_Type(sender) == 1) {
						TeamPurchaseSettingsDefClass *PT = TeamPurchaseSettingsDefClass::Get_Definition(0);
						Commands->Give_Powerup(sender,Get_Definition_Name(PT->beaconpresetid),true);
						StrFormat2(message1,"ppage %d [WGC] You just got the Beacon Crate, you have been given an Ion Cannon Beacon.",Get_Player_ID(sender));
						Create_2D_Sound_Player(sender,"m00evag_dsgn0070i1evag_snd.wav");
					}
					else if	(Commands->Get_Player_Type(sender) == 0) {
						TeamPurchaseSettingsDefClass *PT = TeamPurchaseSettingsDefClass::Get_Definition(1);
						Commands->Give_Powerup(sender,Get_Definition_Name(PT->beaconpresetid),true);
						StrFormat2(message1,"ppage %d [WGC] You just got the Beacon Crate, you have been given a Nuclear Strike Beacon.",Get_Player_ID(sender));
						Create_2D_Sound_Player(sender,"m00evan_dsgn0074i1evan_snd.wav");
					}
					if (Settings->Gamelog) {
						Vector3	pos	= Commands->Get_Position(sender);
						StrFormat2(message3,"CRATE;BEACON;;%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));
					}
				}
				else {
					Commands->Create_Object("Beacon_Nuke_Strike_Anim_Post",Commands->Get_Position(obj));
					Commands->Create_Explosion("Explosion_NukeBeacon",Commands->Get_Position(obj),0);
					Damage_All_Objects_Area(2500.0f,"None",Commands->Get_Position(obj),15.0f,obj,0);
					StrFormat2(message2,"[WGC] %ls picked up a WittebolX Bomb Crate.",Get_Wide_Player_Name(sender));
					StrFormat2(message1,"ppage %d [WGC] You just got a WittebolX Bomb Crate, you have been killed. Sorry :(",Get_Player_ID(sender));
					Console_Input(StrFormat("msg [WGC]: Looks like a %ls player just got blown to bits by a WittebolX Bomb.",Get_Wide_Team_Name(Team)).c_str());
					if (Settings->Gamelog)  {
						Vector3	pos	= Commands->Get_Position(sender);
						StrFormat2(message3,"CRATE;BEACONDEATH;;%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));
					}
				}
			}
			else if	((RandomIntCrate <=	(percent+=Settings->CrateSpy)) && (Settings->CrateSpy > 0)) {
				if (Settings->GameMode != 1) goto CrateStart;
				Change_Character(sender,"CnC_Nod_FlameThrower_2SF");
				Commands->Set_Is_Visible(sender,false);
				StrFormat2(message2,"[WGC] A %ls player picked up a Spy Crate.",Get_Wide_Team_Name(Team));
				StrFormat2(message1,"ppage %d [WGC] You got the Spy Crate, base defenses will ignore you until you die, buy a new character or destroy a building.",Get_Player_ID(sender));
				Console_Input(StrFormat("msg Crate: Oh no! A %ls player just got a Spy Crate, better watch your base %ls!",Get_Wide_Team_Name(Team),Get_Wide_Team_Name(PTTEAM(Team))).c_str());
				if (Settings->Gamelog)  {
					Vector3 pos	= Commands->Get_Position(sender);
					StrFormat2(message3,"CRATE;SPY;;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));
				}
			}
			else if	((RandomIntCrate <=	(percent+=Settings->CrateStealth)) && (Settings->CrateStealth	> 0)) {
				Commands->Enable_Stealth(sender,true);
				StrFormat2(message2,"[WGC] %ls picked up a Stealth Crate.",Get_Wide_Player_Name(sender));
				StrFormat2(message1,"ppage %d [WGC] You got the stealth crate! You have been given a stealth suit.",Get_Player_ID(sender));
				if (Settings->Gamelog) {
					Vector3	pos	= Commands->Get_Position(sender);
					StrFormat2(message3,"CRATE;STEALTH;;%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));
				}
			}
			else if	((RandomIntCrate <=	(percent+=Settings->CrateThief))	&& (Settings->CrateThief	> 0)) {
				Commands->Give_Money(sender,(Commands->Get_Money(sender) * -1),false);
				StrFormat2(message2,"[WGC] %ls picked up a Thief Crate.",Get_Wide_Player_Name(sender));
				StrFormat2(message1,"ppage %d [WGC] You got the Thief Crate, you have lost all of your credits. Hahaha.",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));
				}
			}
			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,"[WGC] %ls picked up the kamikaze suit crate",Get_Wide_Player_Name(sender));
				StrFormat2(message1,"ppage %d [WGC] 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 [WGC]: Some crazy ass %ls guy just got an Kamikaze 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));
				}
			}
			else if	((RandomIntCrate <=	(percent+=Settings->CrateEMP)) && (Settings->CrateEMP > 0)) {
				StrFormat2(message2,"[WGC] %ls picked up the EMP Crate.",Get_Wide_Player_Name(sender));
				StrFormat2(message1,"msg [WGC] %ls got the EMP Crate, all vehicles around %ls are disabled for 30 seconds.",Get_Wide_Player_Name(sender),Get_Wide_Player_Name(sender));
				Vector3	pos	= Commands->Get_Position(sender);
				Commands->Create_Object("Beacon_Ion_Cannon_Anim_Post",pos);
				GenericSLNode *x = BaseGameObjList->HeadNode;
				while (x) {
					GameObject *o = (GameObject *)x->NodeData;
					if (o && Is_Vehicle(o)) {
						if (Commands->Get_Distance(Commands->Get_Position(o),pos) < 100) {
							Attach_Script_Once(o,"EMP_Effect","");
						}
					}
					x = x->NodeNext;
				}
				if (Settings->Gamelog) {
					StrFormat2(message3,"CRATE;EMP;;%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));
				}
			}
			else if	((RandomIntCrate <=	(percent+=Settings->CrateTeamMoney)) && (Settings->CrateTeamMoney > 0)) {
				int	Amount = Commands->Get_Random_Int(1,500);
				int Team = Get_Team(Get_Player_ID(sender));
				StrFormat2(message2,"[WGC] %ls picked up the Team Money Crate (%d).",Get_Wide_Player_Name(sender),Amount);
				StrFormat2(message1,"msg [WGC] %ls got the Team Money crate, everyone on %s gets %d credits!",Get_Wide_Player_Name(sender),Get_Team_Name(Team),Amount);
				for (GenericSLNode* PlayerIter = PlayerList->HeadNode; (PlayerIter != NULL); PlayerIter = PlayerIter->NodeNext) {
					cPlayer *p = (cPlayer *)PlayerIter->NodeData;
					if (!p->IsActive) {
						continue;
					}
					if (Commands->Get_Player_Type((GameObject *)p->Owner.Reference->obj) == Team) {
						p->Increment_Money((float)Amount);
					}
				}
				if (Settings->Gamelog) {
					Vector3	pos	= Commands->Get_Position(sender);
					StrFormat2(message3,"CRATE;TeamMoney;;%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));
				}
			}
			else if	((RandomIntCrate <=	(percent+=Settings->CrateDisarmC4)) && (Settings->CrateDisarmC4 > 0)) {
				int	Type = Commands->Get_Random_Int(1,3);
				int Team = Get_Team(Get_Player_ID(sender));
				StrFormat2(message2,"[WGC] %ls picked up the Disarm Crate.",Get_Wide_Player_Name(sender));
				if (Type == 1) {
					for (GenericSLNode* PlayerIter = PlayerList->HeadNode; (PlayerIter != NULL); PlayerIter = PlayerIter->NodeNext) {
						cPlayer *p = (cPlayer *)PlayerIter->NodeData;
						if (!p->IsActive) {
							continue;
						}
						if (Commands->Get_Player_Type((GameObject *)p->Owner.Reference->obj) == Team) {
							Disarm_All_C4(p->PlayerId);
						}
					}
					StrFormat2(message1,"msg [WGC] %ls got the Disarm crate, all mines and C4 for %s have been disarmed!",Get_Wide_Player_Name(sender),Get_Team_Name(Team));
				}
				else {
					StrFormat2(message1,"ppage %d [WGC] You got the Disarm Crate, all of your mines and C4 have been disarmed!",Get_Player_ID(sender));
					Disarm_All_C4(Get_Player_ID(sender));
				}
				if (Settings->Gamelog) {
					Vector3	pos	= Commands->Get_Position(sender);
					StrFormat2(message3,"CRATE;Disarm;;%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));
				}
			}
			else if	((RandomIntCrate <=	(percent+=Settings->CrateBlownFuse)) && (Settings->CrateBlownFuse > 0)) {
				StrFormat2(message2,"[WGC] %ls picked up the Blown Fuse Crate.",Get_Wide_Player_Name(sender));
				StrFormat2(message1,"msg [WGC] %ls got the Blown Fuse Crate, base defences lose power for 2 minutes!",Get_Wide_Player_Name(sender));
				Attach_Script_Once(Find_Base_Defense(0),"Power_Down","");
				Attach_Script_Once(Find_Base_Defense(1),"Power_Down","");
				if (Settings->Gamelog) {
					Vector3	pos	= Commands->Get_Position(sender);
					StrFormat2(message3,"CRATE;BlownFuse;;%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));
				}
			}
			else if	((RandomIntCrate <=	(percent+=Settings->CratePromote)) && (Settings->CratePromote > 0)) {
				StrFormat2(message2,"[WGC] %ls picked up the Promotion Crate.",Get_Wide_Player_Name(sender));
				StrFormat2(message1,"ppage %d [WGC] You got the Promotion Crate!",Get_Player_ID(sender));
				Commands->Send_Custom_Event(sender,sender,20354,0,0);
				if (Settings->Gamelog) {
					Vector3	pos	= Commands->Get_Position(sender);
					StrFormat2(message3,"CRATE;Promotion;;%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));
				}
			}
			else if	((RandomIntCrate <=	(percent+=Settings->CrateEMPStorm)) && (Settings->CrateEMPStorm > 0)) {
				StrFormat2(message2,"[WGC] %ls picked up the EMP Storm Crate.",Get_Wide_Player_Name(sender));
				StrFormat2(message1,"msg [WGC] %ls got the EMP Storm Crate, All Purchased Vehicles are now Disabled for 2 minutes!",Get_Wide_Player_Name(sender));
				Commands->Attach_Script(sender,"reb_Electromagnetic_pulse","");
				if (Settings->Gamelog) {
					Vector3	pos	= Commands->Get_Position(sender);
					StrFormat2(message3,"CRATE;EMPStorm;;%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));
				}
			}
			else {
				goto CrateStart;
			}
			Console_Input(message1.c_str());
			FDSMessage(message2,"_CRATE");
			if (Settings->Gamelog) {
				WriteGamelog(message3);
			}
			Commands->Destroy_Object(obj);
		}
	}
}

void KAK_Prevent_Destruction_Until_Entered::Created(GameObject *obj) {
	Commands->Set_Player_Type(obj,-2);
	Commands->Start_Timer(obj,this,30,1);
}

void KAK_Prevent_Destruction_Until_Entered::Damaged(GameObject *obj, GameObject *damager, float damage) {
	Commands->Set_Health(obj,Commands->Get_Max_Health(obj));
	Commands->Set_Shield_Strength(obj,Commands->Get_Max_Shield_Strength(obj));
}

void KAK_Prevent_Destruction_Until_Entered::Custom(GameObject *obj, int message, int param, GameObject *sender) {
	if (message == CUSTOM_EVENT_VEHICLE_ENTER) {
		Destroy_Script();
	}
}

void KAK_Prevent_Destruction_Until_Entered::Timer_Expired(GameObject *obj, int number) {
	if (number == 1) {
		Destroy_Script();
	}
}

ScriptRegistrant<MDB_SSGM_Crate> MDB_SSGM_Crate_Registrant("MDB_SSGM_Crate","");
ScriptRegistrant<KAK_Prevent_Destruction_Until_Entered>	KAK_Prevent_Destruction_Until_Entered_Registrant("KAK_Prevent_Destruction_Until_Entered","");



have fun Wink


Re: Code/Source Request Crates [message #325517 is a reply to message #325515] Mon, 07 April 2008 15:09 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
Ok this is a C++ Thread,
Nice Code, anyways Clients need Scripts 2.* to use this Function.
It Displays the Purchase terminal, NOT the Sidebar. Enjoy:


// !PCT
class PCTframeChatCommand : public ChatCommandClass {
	void Triggered(int ID,const TokenClass &Text,int ChatType) {
		GameObject *obj = Get_GameObj(ID);
	if(Get_Object_Type(obj) == 0)
	    {
		Display_NOD_Player_Terminal_Player(obj);
		}
		else 
		if(Get_Object_Type(obj) == 1)
		{
		Display_GDI_Player_Terminal_Player(obj);
		}
	}
	};
ChatCommandRegistrant<PCTframeChatCommand> PCTframeChatCommandReg("!pct",CHATTYPE_ALL, 0, GAMEMODE_ALL);

[Updated on: Mon, 07 April 2008 15:10]

Report message to a moderator

Re: Code/Source Request Crates [message #325975 is a reply to message #325515] Fri, 11 April 2008 13:59 Go to previous messageGo to next message
EA-DamageEverything
Messages: 423
Registered: January 2005
Location: Germany
Karma: 0
Commander
Many thanks to you Witte for the code. Unfortunately, using it by following the instruction causes the script-based crates to mess up. The EMP scripts, the power down and the kamikaze won't work.

EDIT= I am sorry, of course the classes can also go into the gmmain.h. I figured out that it doesn't matter if they are placed in the gmcrate.h or the gmmain.h!

Nevertheless, to get this SSGM source working as a compiled scripts.dll, here is the missing part=

-And at the end of the gmcrate.cpp, you have to add the four Registrants- it should look like this=
ScriptRegistrant<MDB_SSGM_Crate> MDB_SSGM_Crate_Registrant("MDB_SSGM_Crate","");
ScriptRegistrant<KAK_Prevent_Destruction_Until_Entered>	KAK_Prevent_Destruction_Until_Entered_Registrant("KAK_Prevent_Destruction_Until_Entered","");
ScriptRegistrant<Power_Down> Power_Down_Registrant("Power_Down","");
ScriptRegistrant<EMP_Effect> EMP_Effect_Registrant("EMP_Effect","");
ScriptRegistrant<zbl_kamikaze_Suit_Crate> zbl_kamikaze_Suit_Crate_Registrant("zbl_kamikaze_Suit_Crate","");
ScriptRegistrant<reb_Electromagnetic_pulse> reb_Electromagnetic_pulse_Registrant("reb_Electromagnetic_pulse","");


BTW, I honestly didn't figure out what the PromotionCrate does. It gives me the ppage and nothing happens then. There's no custom event being activated etc. The EMPStorm seems to work -but on the GDI side only as far as I have seen.

Anyway, it's nice to have 5 new crates. On some I've added decent ingame sounds. The BlownFuse for example does need a sound so players will notice that something is going on.

What's more, the Set_Health and Set_Shield_strength commands aren't working. The Cook from the Kamikaze crate stays on his defaults, even though there is a Commands->Set_Health(sender,150); command included. I am planning to bypass this with a modified objects.gm because the Health+Shield commands aren't working on the GODcrate either.
--------------------------------
Madrockz, I really enjoyed the !pct command! This is going into my SSGM release which will be released soon (this is the reason I am collecting tons of code ^^). The only change I made was limiting the command to teamchat. Maybe, it will be limited to CTF in the final, because the AOW mode already has more new features than any other gameplay mode atm.

[Updated on: Fri, 11 April 2008 17:54]

Report message to a moderator

Re: Code/Source Request Crates [message #326009 is a reply to message #325515] Sat, 12 April 2008 02:06 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 havn't looked, but you can't actually set the ehalth of a player to higher then what his max health is. If the God crate os trying to set the health to 1000 or something, but the presets current max health is 150 then it won't work.
You can however set the max health, so you would have to set the max health to 1000 first then set health to 1000.



Re: Code/Source Request Crates [message #326010 is a reply to message #326009] Sat, 12 April 2008 03:54 Go to previous messageGo to next message
ExEric3 is currently offline  ExEric3
Messages: 746
Registered: February 2005
Location: Slovakia
Karma: 0
Colonel
reborn wrote on Sat, 12 April 2008 11:06

I havn't looked, but you can't actually set the ehalth of a player to higher then what his max health is. If the God crate os trying to set the health to 1000 or something, but the presets current max health is 150 then it won't work.
You can however set the max health, so you would have to set the max health to 1000 first then set health to 1000.


Exactly what I typed in my Source code about God Crate Thumbs Up

Then how is possible in SSAOW 1.3 it works? Was modified objects file?
Re: Code/Source Request Crates [message #326017 is a reply to message #325975] Sat, 12 April 2008 05:24 Go to previous messageGo to next message
Hex is currently offline  Hex
Messages: 858
Registered: March 2004
Karma: 0
Colonel
EA-DamageEverything wrote on Fri, 11 April 2008 16:59

I honestly didn't figure out what the PromotionCrate does. It gives me the ppage and nothing happens then


Because it requires a veteran plugin to work, which is not public, wittebolx just copyed everything from my crates plugin that was posted a while ago


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: Sat, 12 April 2008 05:25]

Report message to a moderator

Re: Code/Source Request Crates [message #326019 is a reply to message #326017] Sat, 12 April 2008 06:04 Go to previous messageGo to next message
wittebolx is currently offline  wittebolx
Messages: 332
Registered: May 2007
Location: the netherlands
Karma: 0
Recruit
Hex wrote on Sat, 12 April 2008 14:24

EA-DamageEverything wrote on Fri, 11 April 2008 16:59

I honestly didn't figure out what the PromotionCrate does. It gives me the ppage and nothing happens then


Because it requires a veteran plugin to work, which is not public, wittebolx just copyed everything from my crates plugin that was posted a while ago


indeed i copyed some of the crates and added some new ones.
thats why you (hex) and reborn are on the credits list.

soemone asked me to share the crates im currently using, so thats why i posted this.

ps. the veteran system is open source (reborn's version)


[Updated on: Sat, 12 April 2008 06:05]

Report message to a moderator

Re: Code/Source Request Crates [message #326020 is a reply to message #325515] Sat, 12 April 2008 06:43 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
Hex's version is not Wink
Re: Code/Source Request Crates [message #326030 is a reply to message #325515] Sat, 12 April 2008 11:32 Go to previous messageGo to next message
Gen_Blacky is currently offline  Gen_Blacky
Messages: 3250
Registered: September 2006
Karma: 1
General (3 Stars)
there like 6 veteran systems out there 1 is public .....

http://s18.postimage.org/jc6qbn4k9/bricks3.png
Re: Code/Source Request Crates [message #326036 is a reply to message #326017] Sat, 12 April 2008 12:37 Go to previous messageGo to next message
MacKinsey is currently offline  MacKinsey
Messages: 83
Registered: March 2008
Karma: 0
Recruit
Hex wrote on Sat, 12 April 2008 07:24

EA-DamageEverything wrote on Fri, 11 April 2008 16:59

I honestly didn't figure out what the PromotionCrate does. It gives me the ppage and nothing happens then


Because it requires a veteran plugin to work, which is not public, wittebolx just copyed everything from my crates plugin that was posted a while ago

Its a very good plugin, thank you about that!
But i want to have a good working Veteran System.
EDIT: I dont need the source of it. It would be good, if its working with the crate plugin, and i get support for it, if anything is wrong.

[Updated on: Sat, 12 April 2008 12:58]

Report message to a moderator

Re: Code/Source Request Crates [message #326040 is a reply to message #326019] Sat, 12 April 2008 13:42 Go to previous messageGo to next message
Hex is currently offline  Hex
Messages: 858
Registered: March 2004
Karma: 0
Colonel
wittebolx wrote on Sat, 12 April 2008 09:04

ps. the veteran system is open source (reborn's version)


Very true, but tha version does not have the Send_Custom_Event receiver that is required to use it


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/Source Request Crates [message #326093 is a reply to message #325515] Sun, 13 April 2008 10:36 Go to previous messageGo to next message
EA-DamageEverything
Messages: 423
Registered: January 2005
Location: Germany
Karma: 0
Commander
Ok Hex you released a SSGM crates plugin with the promotion crate which only works with your vet system? If I find Reborns' vet code, how do I attach the Send_Custom_Event receiver? Will it work then like it should?
Re: Code/Source Request Crates [message #326095 is a reply to message #325515] Sun, 13 April 2008 11:51 Go to previous message
reborn is currently offline  reborn
Messages: 3231
Registered: September 2004
Location: uk - london
Karma: 0
General (3 Stars)
If you're using a veteran system based on the code I posted a while ago, then it is pretty easy to make a crate function to make a player get "promoted", just do this in the crates function:

VetUpdate(Get_Player_ID(sender), 40, Commands->Get_Points(sender));


That will add 40 veteran points to there current vet worth, promoting them immediately.



Previous Topic: C++ IntelliSense
Next Topic: Texture Rotation of Treads (Tank-Tracks)
Goto Forum:
  


Current Time: Sun Dec 29 18:16:17 MST 2024

Total time taken to generate the page: 0.00994 seconds