• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

C++ monster onDeath

ConAn Edujawa

Member
Joined
Feb 23, 2015
Messages
457
Reaction score
17
how i can check player->getplayerBouns() in monster.cpp in bool Monster::eek:nDeath()
want to add
(uint32_t)random_range(1, 100) < player->getplayerBouns())
0.4
 
Solution
i used
Lua:
Creature* _owner = attackedCreature;
Player* owner = NULL;
    if(_owner->getPlayer())
        owner = _owner->getPlayer();
owner ->getplayerBouns()
but when kill monster server crash
You added it into 1-line IF, so it's not 'in if'.
Add it next to stamina check:
Code:
    auto value = owner->getplayerBouns();
// here any code to do something with bonus value
    uint64_t stamina = g_config.getNumber(ConfigManager::STAMINA_DESTROY_LOOT);
I don't know, if it's available in onDeath, but you can read it in Item* Monster::createCorpse(DeathList deathList). Player who owns corpse is in variable _owner in this line:
i used
Lua:
Creature* _owner = attackedCreature;
Player* owner = NULL;
    if(_owner->getPlayer())
        owner = _owner->getPlayer();
owner ->getplayerBouns()
but when kill monster server crash
 
i used
Lua:
Creature* _owner = attackedCreature;
Player* owner = NULL;
    if(_owner->getPlayer())
        owner = _owner->getPlayer();
owner ->getplayerBouns()
but when kill monster server crash
You added it into 1-line IF, so it's not 'in if'.
Add it next to stamina check:
Code:
    auto value = owner->getplayerBouns();
// here any code to do something with bonus value
    uint64_t stamina = g_config.getNumber(ConfigManager::STAMINA_DESTROY_LOOT);
 
Last edited:
Solution
Back
Top