Repository navigation
Replies: 1 comment 1 reply
|
On Normal, Roll it like Lazarus' normal drop and reroll the seed untill it lands on your unique. On 1.5.5, with a } else if (ActiveItemCount < MAXITEMS) {
std::underlying_type_t<_item_indexes> idx = 0;
while (AllItemsList[idx].iItemId != UniqueItems[d.uid].UIItemId)
idx++;
int ii = AllocateItem();
Item &droppedItem = Items[ii];
GetSuperItemSpace(pos, ii);
const Point itemPos = droppedItem.position;
do {
droppedItem = {};
droppedItem.position = itemPos;
// onlygood, recreate, pregen
SetupAllItems(*MyPlayer, droppedItem, static_cast<_item_indexes>(idx), AdvanceRndSeed(), MonstersData[MT_ADVOCATE].level, 15, true, true, false);
} while (droppedItem._iUid != d.uid);
if (sendmsg)
NetSendCmdPItem(false, CMD_DROPITEM, droppedItem.position, droppedItem);
}Level 30 and uper 15 match his normal drop so multiplayer accepts it, and Also, that if (monster.ai != MonsterAIID::Lazarus || !SpawnLazarusLoot(monster.position.tile, sendmsg))
SpawnLoot(monster, sendmsg); |
Uh oh!
There was an error while loading. Please reload this page.
Hi everyone! I'm modding DevilutionX to add a custom loot drop for Archbishop Lazarus.
Goal:
When Lazarus dies, there is a 50% chance to drop 1 item from this pool:
Unique Items: Thinking Cap, Mind Cry, or Nightscape (Naj's Robe)
Spell Books: 1 random book (Teleport, Chain Lightning, Guardian, Stone Curse, or Golem)
Issue:
The Unique items drop normally in-game upon death. However, when starting a New Game or reloading, the dropped Unique item loses all its properties and turns into a plain white item with no stats.
Could someone please help check where my code logic is failing? Here are the modifications across 3 files:
Added custom drop check inside MonsterDeath():
void MonsterDeath(Monster &monster, Direction md, bool sendmsg)
{
if (!monster.isPlayerMinion())
AddPlrMonstExper(monster.level(sgGameInitInfo.nDifficulty), monster.exp(sgGameInitInfo.nDifficulty), monster.whoHit);
Declared SpawnLazarusLoot:
void CreateSpellBook(Point position, SpellID ispell, bool sendmsg, bool delta);
bool SpawnLazarusLoot(Point pos); // Added function prototype
void CreateMagicArmor(Point position, ItemType itemType, int icurs, bool sendmsg, bool delta);
Custom drop logic and item generation:
struct LazarusDrop {
_unique_items uid;
int weight;
};
const LazarusDrop LazarusDrops[] = {
{ UITEM_THINKINGCAP, 25 },
{ UITEM_MINDCRY, 25 },
{ UITEM_NIGHTSCAPE, 25 }, // Naj's Robe
{ UITEM_INVALID, 25 }, // Random spell book placeholder
};
const SpellID RandomBookSpells[] = {
SpellID::Teleport,
SpellID::ChainLightning,
SpellID::Guardian,
SpellID::StoneCurse,
SpellID::Golem,
};
bool SpawnLazarusLoot(Point pos)
{
if (GenerateRnd(100) >= 50) // 50% chance gate
return false;
}
Any insight into how DevilutionX handles RecreateItem() or how to properly flag/preserve spawned Uniques across sessions would be greatly appreciated. Thanks in advance!
All reactions