• 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++ help with this code modify please bros

darknelson

Member
Joined
Jun 19, 2011
Messages
190
Solutions
1
Reaction score
15
i already modified the tile on house, to not be pz, also the spell of summon for can be summoned on house.

this was my line on tile.cpp allow walk monster walk in pz, but

Lua:
if(monster->getMaster())
                return RETURNVALUE_NOERROR;

im trying to add this now

Code:
if(monster->getHouse())
                return RETURNVALUE_NOERROR;

but i got an error.

also with this
Code:
if(!houseTile)
                return RETURNVALUE_NOERROR;

help please brothers


edit: i find the part of the code can be edited, is on housetile.cpp but for most i try i cant get, this is the original function of tile


Lua:
ReturnValue HouseTile::queryAdd(int32_t index, const Thing& thing, uint32_t count, uint32_t flags, Creature* actor/* = nullptr*/) const
{
    if (const Creature* creature = thing.getCreature()) {
        if (const Player* player = creature->getPlayer()) {
            if (!house->isInvited(player)) {
                return RETURNVALUE_PLAYERISNOTINVITED;
            }
        } else {
            return RETURNVALUE_NOTPOSSIBLE;
        }
    } else if (thing.getItem() && actor) {
        Player* actorPlayer = actor->getPlayer();
        if (!house->isInvited(actorPlayer)) {
            return RETURNVALUE_CANNOTTHROW;
        }
    }
    return Tile::queryAdd(index, thing, count, flags, actor);
}

how i can modify that part to allow monsters enter with no error? ill try this but give me error

Code:
ReturnValue HouseTile::queryAdd(int32_t index, const Thing& thing, uint32_t count, uint32_t flags, Creature* actor/* = nullptr*/) const
{
    if (const Creature* creature = thing.getCreature()) {
        if (const Player* player = creature->getPlayer()) {
            if (!house->isInvited(player)) {
                return RETURNVALUE_PLAYERISNOTINVITED;
            }
        } else {
            return RETURNVALUE_NOTPOSSIBLE;
        }
    } else if (thing.getItem() && actor) {
        Player* actorPlayer = actor->getPlayer();
        if (!house->isInvited(actorPlayer)) {
            return RETURNVALUE_CANNOTTHROW;
        }
    }
    if (const Monster* monster = creature->getMonster()) {
        if(monster->getMaster())
                return RETURNVALUE_NOERROR;
            }
    return Tile::queryAdd(index, thing, count, flags, actor);
}
 
Last edited:
To receive appropriate help, the error should be shared. Because without that, and any context as to exactly what you intend to accomplish with those two lines of code, no one can help.
 
Back
Top