TFS 1.X+ Help with two codes c++

jackl90

Member
Joined
Jul 25, 2017
Messages
153
Reaction score
5
How could I be adding ZONE_NOPVP in these two codes too?

basically work the same thing with two zones ZONE_PVP and ZONE_NOPVP


Code 1
C++:
bool Player::dropCorpse(Creature* lastHitCreature, Creature* mostDamageCreature, bool lastHitUnjustified, bool mostDamageUnjustified)
{
    if (getZone() != ZONE_PVP || !Player::lastHitIsPlayer(lastHitCreature)) {
        return Creature::dropCorpse(lastHitCreature, mostDamageCreature, lastHitUnjustified, mostDamageUnjustified);
    }

    setDropLoot(true);
    return false;
}
Code 2
C++:
bool Player::onKilledCreature(Creature* target, bool lastHit/* = true*/)
{
    bool unjustified = false;

    if (hasFlag(PlayerFlag_NotGenerateLoot)) {
        target->setDropLoot(false);
    }

    Creature::onKilledCreature(target, lastHit);

    if (Player* targetPlayer = target->getPlayer()) {
        if (targetPlayer && targetPlayer->getZone() == ZONE_PVP) {
            targetPlayer->setDropLoot(false);
            targetPlayer->setLossSkill(false);
        }
 

Steve Albert

Banned User
Joined
Dec 9, 2018
Messages
267
Reaction score
101
C++:
bool Player::dropCorpse(Creature* lastHitCreature, Creature* mostDamageCreature, bool lastHitUnjustified, bool mostDamageUnjustified)
{
    if (getZone() != ZONE_PVP || getZone() != ZONE_NOPVP || !Player::lastHitIsPlayer(lastHitCreature)) {
        return Creature::dropCorpse(lastHitCreature, mostDamageCreature, lastHitUnjustified, mostDamageUnjustified);
    }

    setDropLoot(true);
    return false;
}
C++:
bool Player::onKilledCreature(Creature* target, bool lastHit/* = true*/)
{
    bool unjustified = false;

    if (hasFlag(PlayerFlag_NotGenerateLoot)) {
        target->setDropLoot(false);
    }

    Creature::onKilledCreature(target, lastHit);

    if (Player* targetPlayer = target->getPlayer()) {
        auto zone = targetPlayer->getZone();
        if (targetPlayer && (zone == ZONE_PVP || zone == ZONE_NOPVP)) {
            targetPlayer->setDropLoot(false);
            targetPlayer->setLossSkill(false);
        }
 
OP
J

jackl90

Member
Joined
Jul 25, 2017
Messages
153
Reaction score
5
worked ! thanks


It was not working because I was killing myself with fields on the floor.
 
Last edited:
OP
J

jackl90

Member
Joined
Jul 25, 2017
Messages
153
Reaction score
5
how could I add in the first code, to work in case if he kills himself with fire field on the floor for example?

because have this in code...
C++:
!Player::lastHitIsPlayer(lastHitCreature)
this work only for players attack i think


how could this code work with if the player tries to kill himself with fields?

Code:
bool Player::dropCorpse(Creature* lastHitCreature, Creature* mostDamageCreature, bool lastHitUnjustified, bool mostDamageUnjustified)
{
    if (getZone() != ZONE_PVP || getZone() != ZONE_NOPVP || !Player::lastHitIsPlayer(lastHitCreature)) {
        return Creature::dropCorpse(lastHitCreature, mostDamageCreature, lastHitUnjustified, mostDamageUnjustified);
    }

    setDropLoot(true);
    return false;
}
 
OP
J

jackl90

Member
Joined
Jul 25, 2017
Messages
153
Reaction score
5
something like this
!Player::lastHitIsPlayer(lastHitCreature)
But in case last hit is a field damage?
 
Top