Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Working vehicle menus on SP maps, and how to purchase powerups from them and airdrop vehicles  () 1 Vote
Re: Working vehicle menus on SP maps, and how to purchase powerups from them and airdrop vehicles [message #467357 is a reply to message #467296] Mon, 14 May 2012 13:26 Go to previous message
Whitedragon is currently offline  Whitedragon
Messages: 832
Registered: February 2003
Location: California
Karma:
Colonel
Oh yeah, here's the character purchase hook so you can have powerups in the character menu too.

int CharacterPurchase(BaseControllerClass *Base,GameObject *Purchaser,unsigned int Cost,unsigned int Preset,const char *Data) {
	if (Base->Can_Generate_Soldiers() || !Cost) {
		DefinitionClass *Def = Find_Definition(Preset);
		if (Def->Get_Class_ID() == CID_Soldier) {
			if (Purchase_Item(Purchaser,Cost)) {
				Purchaser->As_SoldierGameObj()->Re_Init(*(SoldierGameObjDef*)Def);
				Purchaser->As_SoldierGameObj()->Post_Re_Init();
				return 0;
			}
			return 2;
		}
		else if (Def->Get_Class_ID() == CID_PowerUp) {
			PowerUpGameObjDef *PowerUpDef = (PowerUpGameObjDef*)Def;
			if (PowerUpDef->GrantWeapon && Has_Weapon(Purchaser,Get_Definition_Name(PowerUpDef->GrantWeaponID))) {
				return 4;
			}
			else if (Purchase_Item(Purchaser,Cost)) {
				PowerUpDef->Grant(Purchaser->As_SoldierGameObj());
				return 0;
			}
			return 2;
		}
	}
	return 3;
}


Black-Cell.net
Network Administrator (2003 - )

DragonServ, Renegade's first IRC interface bot
Creator and lead coder (2002 - )

Dragonade, Renegade's first server side modification
Lead coder (2005 - )
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: server crash (in tt.dll) after dead of ai
Next Topic: level edit .ddb
Goto Forum:
  


Current Time: Wed Dec 18 12:06:16 MST 2024

Total time taken to generate the page: 0.01174 seconds