• 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!

Tfs 1.2 Summon ShareExp

mezuf98

New Member
Joined
Jul 4, 2016
Messages
37
Reaction score
0
Hi otland, i'm stucked here and need your help to disable summon gainexp!
Thanks...
 
you want to disable exp gain if a monster is summoned?

edit: if that's what you're asking for, try this
Code:
    if source:getMaster() then
        return
    end
put it under
Code:
    if not source or source:isPlayer() then
        return exp
    end
in player event for exp gain
 
Last edited:
Shouldn't he put it before not after?
no, since if you add exp to a player without a source, you can't use the method to get master on nil value
either way you dont gain exp from summons and i still dont understand his question so idk what to do lol
 
if you dont want to do it in sources, you might be able to register a creature event for gaining xp (not sure if it works on creatures), and add the xp gained to its master
 
if you dont want to do it in sources, you might be able to register a creature event for gaining xp (not sure if it works on creatures), and add the xp gained to its master

I prefer do it in sources, but i dont know the part where i need to change...
 
In creature.cpp you can edit this:

Code:
void Creature::onGainExperience(uint64_t gainExp, Creature* target)
{
    if (gainExp == 0 || !master) {
        return;
    }

    gainExp /= 2;
    master->onGainExperience(gainExp, target);

    SpectatorVec list;
    g_game.map.getSpectators(list, position, false, true);
    if (list.empty()) {
        return;
    }

    TextMessage message(MESSAGE_EXPERIENCE_OTHERS, ucfirst(getNameDescription()) + " gained " + std::to_string(gainExp) + (gainExp != 1 ? " experience points." : " experience point."));
    message.position = position;
    message.primary.color = TEXTCOLOR_WHITE_EXP;
    message.primary.value = gainExp;

    for (Creature* spectator : list) {
        spectator->getPlayer()->sendTextMessage(message);
    }
}

That will just stop you from seeing the exp that is given to summons though....

You can edit this so the summons dont get any exp at all, also in creature.cpp

Code:
void Creature::addDamagePoints(Creature* attacker, int32_t damagePoints)
{
    if (damagePoints <= 0) {
        return;
    }

    uint32_t attackerId = attacker->id;

    auto it = damageMap.find(attackerId);
    if (it == damageMap.end()) {
        CountBlock_t cb;
        cb.ticks = OTSYS_TIME();
        cb.total = damagePoints;
        damageMap[attackerId] = cb;
    } else {
        it->second.total += damagePoints;
        it->second.ticks = OTSYS_TIME();
    }

    lastHitCreatureId = attackerId;
}
 
Last edited:
stealing exp? what you mean, explain me a lil bit pls
when you have a summon and it hits a monster, some of the experience from that monster goes to the summon instead of the player
he wants that exp that goes to the summon to go to the player instead so the player gets 100% of the exp
 
Back
Top Bottom