[help] make ai bandit's drop more then one item
im trying to get my ai bandit's to drop 2-3 things
i have tryed
Code:
// create network object obj_DroppedItem* obj = (obj_DroppedItem*)srv_CreateGameObject("obj_DroppedItem", "obj_DroppedItem", pos);
obj->SetNetworkID(gServerLogic.GetFreeNetId());
obj->NetworkLocal = true;
// vars
obj->m_Item.itemID = 101173 || 101262; //TAR, bandage DX,
obj->m_Item.quantity = 1;
but as soon as you kill a ai the game crash's if i take the || 101262 out of it its fine :/
Re: [help] make ai's drop more then one item
Sorry, I didn't understand what you mean by "ai's" would be Zombies?
Re: [help] make ai's drop more then one item
Quote:
Originally Posted by
Dragonbooss
Sorry, I didn't understand what you mean by "ai's" would be Zombies?
sorry my bad i meen ai bandits
Re: [help] make ai bandit's drop more then one item
Try using a u_GetRandom function. I haven't tested it tho.
Re: [help] make ai bandit's drop more then one item
There must be something related to life of him, right? EX: If his life is <0, the server kills the bot, correct? I use this in SuperZombies also try (WarZ_Server.sln):
Code:
for(int i=0; i<25; i++) {
if(spawnObject->lootBoxCfg)
{
extern wiInventoryItem RollItem(const LootBoxConfig* lootCfg, int depth);
wiInventoryItem wi = RollItem(spawnObject->lootBoxCfg, 0);
if(wi.itemID > 0)
{
// create random position around zombie
r3dPoint3D pos = GetPosition();
pos.y += 0.4f;
pos.x += u_GetRandom(-1, 1);
pos.z += u_GetRandom(-1, 1);
// create network object
obj_DroppedItem* obj = (obj_DroppedItem*)srv_CreateGameObject("obj_DroppedItem", "obj_DroppedItem", pos);
obj->SetNetworkID(gServerLogic.GetFreeNetId());
obj->NetworkLocal = true;
// vars
obj->m_Item = wi;
}
}
}
And change the "for" condition, i<25 = 25 items dropped XD
Re: [help] make ai bandit's drop more then one item
Quote:
Originally Posted by
Dragonbooss
There must be something related to life of him, right? EX: If his life is <0, the server kills the bot, correct? I use this in SuperZombies also try (WarZ_Server.sln):
Code:
for(int i=0; i<25; i++) {
if(spawnObject->lootBoxCfg)
{
extern wiInventoryItem RollItem(const LootBoxConfig* lootCfg, int depth);
wiInventoryItem wi = RollItem(spawnObject->lootBoxCfg, 0);
if(wi.itemID > 0)
{
// create random position around zombie
r3dPoint3D pos = GetPosition();
pos.y += 0.4f;
pos.x += u_GetRandom(-1, 1);
pos.z += u_GetRandom(-1, 1);
// create network object
obj_DroppedItem* obj = (obj_DroppedItem*)srv_CreateGameObject("obj_DroppedItem", "obj_DroppedItem", pos);
obj->SetNetworkID(gServerLogic.GetFreeNetId());
obj->NetworkLocal = true;
// vars
obj->m_Item = wi;
}
}
}
And change the "for" condition, i<25 = 25 items dropped XD
and then it pulls what will drop from the LootBox i have set to the ai spawn in studio ?
sorry im half a sleep just woke up :/
Re: [help] make ai bandit's drop more then one item
Quote:
Originally Posted by
fpskiller
and then it pulls what will drop from the LootBox i have set to the ai spawn in studio ?
sorry im half a sleep just woke up :/
From what I know yes, but you can edit to instead of looking for LootBox, look for ID's you set ;)
Re: [help] make ai bandit's drop more then one item
nice i will give it ago in a bit just setting up a war inc server for a side project what i have just moved over to the farcry engine
Re: [help] make ai bandit's drop more then one item
I have this completed... umm was along time ago ill check if i have my source with this added ill just edit this post and add code if i can find it.