- Joined
- Aug 2, 2004
- Messages
- 125
- Reaction score
- 16
Why hardcode and wasted time to build server everytime you need to change item in air drop ? when your can roll it and put loot id in config, so i'll share this small tut.
sobj_DroppedItem.cpp
sobj_DroppedItem.h
This also can be use for OPEN CASE hardcode poop system =)
sobj_DroppedItem.cpp
Code:
int obj_DroppedItem::RollAirBox(int AirBoxID)
{
extern wiInventoryItem RollItem(const class LootBoxConfig* lootCfg, int depth);
wiInventoryItem wi;
// If the rewardID is a Loot table, roll the reward, otherwise, give them the item.
LootBoxConfig* cfg = const_cast<LootBoxConfig*>(g_pWeaponArmory->getLootBoxConfig( AirBoxID ));
wi = RollItem( cfg, 0 );
wi.quantity = 1;
return wi.itemID;
}
Code:
int obj_DroppedItem::GetItemDefault(int i)
static const char* configFile = "MasterServer.cfg";
const char* group = "AirDrop";
int AirItem1 = r3dReadCFG_I(configFile, group, "AirItem1", 301128);
int AirItem2 = r3dReadCFG_I(configFile, group, "AirItem2", 301128);
int AirItem3 = r3dReadCFG_I(configFile, group, "AirItem3", 301128);
int AirItem4 = r3dReadCFG_I(configFile, group, "AirItem4", 301128);
int AirItem5 = r3dReadCFG_I(configFile, group, "AirItem5", 301128);
switch(i)
{
case 0:
return RollAirBox(AirItem1);//
case 1:
return RollAirBox(AirItem2);//
.....go on....
sobj_DroppedItem.h
Code:
int RollAirBox(int AirBoxID);
This also can be use for OPEN CASE hardcode poop system =)