• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

RevScripts how to increase the bestiary rate?

data/scripts/modules/bestiary_charms.lua
my bad, it's data/scripts/creaturescripts/others/bestiary_kill.lua
 
data/scripts/modules/bestiary_charms.lua
my bad, it's data/scripts/creaturescripts/others/bestiary_kill.lua


This is my script, but i don't think i could change for double or 3x..
LUA:
local bestiaryOnKill = CreatureEvent("BestiaryOnKill")
function bestiaryOnKill.onKill(player, creature, lastHit)
    if not player:isPlayer() or not creature:isMonster() or creature:hasBeenSummoned() or creature:isPlayer() then
        return true
    end

    for cid, damage in pairs(creature:getDamageMap()) do
        local participant = Player(cid)
        if participant and participant:isPlayer() then
            participant:addBestiaryKill(creature:getName())
        end
      end

    return true
end
bestiaryOnKill:register()
 
This is my script, but i don't think i could change for double or 3x..
LUA:
local bestiaryOnKill = CreatureEvent("BestiaryOnKill")
function bestiaryOnKill.onKill(player, creature, lastHit)
    if not player:isPlayer() or not creature:isMonster() or creature:hasBeenSummoned() or creature:isPlayer() then
        return true
    end

    for cid, damage in pairs(creature:getDamageMap()) do
        local participant = Player(cid)
        if participant and participant:isPlayer() then
            participant:addBestiaryKill(creature:getName())
        end
      end

    return true
end
bestiaryOnKill:register()
LUA:
participant:addBestiaryKill(creature:getName(), 3)

But u need to make some changes on the sources iobestiary.cpp:

Code:
void IOBestiary::addBestiaryKill(Player* player, MonsterType* mtype, uint32_t amount /*= 1*/)
{
    uint16_t raceid = mtype->info.raceid;
    if (raceid == 0) {
        return;
    }
    uint32_t curCount = player->getBestiaryKillCount(raceid);
    std::ostringstream ss;

    player->addBestiaryKillCount(raceid, amount);

    if (curCount == 0) {
        player->sendBestiaryEntryChanged(raceid);
        ss << "You unlocked details for the creature '" << mtype->name << "'";
        player->sendTextMessage(MESSAGE_STATUS, ss.str());
        return;
    }

    curCount += amount;

    if ((curCount == mtype->info.bestiaryFirstUnlock) || (curCount == mtype->info.bestiarySecondUnlock)) {
        ss << "You unlocked details for the creature '" << mtype->name << "'";
        player->sendTextMessage(MESSAGE_STATUS, ss.str());
        player->sendBestiaryEntryChanged(raceid);
} else if ((curCount >= mtype->info.bestiaryToUnlock) && curCount <= mtype->info.bestiaryToUnlock + 3) { 
        ss << "You unlocked details for the creature '" << mtype->name << "'";
        player->sendTextMessage(MESSAGE_STATUS, ss.str());
        addCharmPoints(player, mtype->info.bestiaryCharmsPoints);
        player->sendBestiaryEntryChanged(raceid);
    }

    std::list<MonsterType*> trackerList = player->getBestiaryTrackerList();
    for (MonsterType* mType : trackerList) {
        if (raceid == mType->info.raceid) {
            player->refreshBestiaryTracker(trackerList);
        }
    }
}
 
Back
Top