• 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++ problem pushing monsters downstairs

kosamika

New Member
Joined
Nov 8, 2008
Messages
8
Reaction score
4
hello otlanders!!!

im using vb2010 and last OTHire-master server revision

im tryng to push monsters downstairs, but i always get ret_notenoughtroom
the only holes that seem to work are the dirthole and the traphole
but even those wont work once they are open. i can use them again when they close

i did try to skip line 916 on game.cpp at Game::playerMoveCreature

C++:
    if(player != movingCreature){
        if(toTile->hasProperty(BLOCKPATH)){
            player->sendCancelMessage(RET_NOTENOUGHROOM);
            return false;
        }

could accomplish same thing by removing block_pathfind flags from items.otb on holes
but i do get ret_notpossible when i do this.

game.cpp later on, line 1031, at Game::internalMoveCreature
C++:
    //check if we can move the creature to the destination
    ReturnValue ret = toCylinder->__queryAdd(0, creature, 1, flags);
    if(ret != RET_NOERROR){
        return ret;
    }

i assume we could add here an exception, but im kinda lost with the syntax at this point

any help would be apreciated
 
quick update:
so in line 530 on tile.cpp at ReturnValue Tile::__queryAdd(int32_t index, const Thing* thing, uint32_t count, uint32_t flags) const
found where the ret_notpossible is coming from:

C++:
const CreatureVector* creatures = getCreatures();
    const TileItemVector* items = getItemList();


    if(const Creature* creature = thing->getCreature()){
        if(hasBitSet(FLAG_NOLIMIT, flags)){
            return RET_NOERROR;
        }


        if(hasBitSet(FLAG_PATHFINDING, flags)){             // check - pathfind
            if(floorChange() || positionChange()){             //check - floorchange
                return RET_NOTPOSSIBLE;    
            }
        }


        if(ground == NULL)
            return RET_NOTPOSSIBLE;


        if(const Monster* monster = creature->getMonster()){
            if(hasFlag(TILESTATE_PROTECTIONZONE))
                return RET_NOTPOSSIBLE;


            if(floorChange() || positionChange()){             //check -floorchange
                //return RET_NOTPOSSIBLE;    
            }


if you skip both of these, monsters will chase you up/downstairs since theyr pathfinding is not blocked.
never thought i would be chased by trolls and rotworms up to the surface level...

thought it was funny to mention!.

by skipping the second floorchange check, it kinda works for me, monsters dont seem to fall in holes by themselves , and i can push them
so im going to assume this is ok.

if you have a better way to do this, please let me know!.
 
Back
Top