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

Parcel trap 8.6 - 0.4

zabuzo

Well-Known Member
Joined
Jun 10, 2016
Messages
238
Reaction score
54
What i need to search/change in my sources to make parcel traps like was on old tibia

Should be amazing play anothers 8.60 having it :D

Example like was on 7.4 (what i want put in my 8.60)
 
Solution
Game.cpp:

Code:
ReturnValue Game::internalMoveCreature(Creature* actor, Creature* creature, Cylinder* fromCylinder, Cylinder* toCylinder, uint32_t flags/* = 0*/)
{
    //check if we can move the creature to the destination
    ReturnValue ret = toCylinder->__queryAdd(0, creature, 1, flags);
    if(ret != RET_NOERROR)
        return ret;

    //height check
    Tile* toTile = toCylinder->getTile();
    Tile* fromTile = fromCylinder->getTile();
    if(toTile->getHeight() - fromTile->getHeight() >= 2) {
        return RET_NOTPOSSIBLE;
    }
   
    fromCylinder->getTile()->moveCreature(actor, creature, toCylinder);
   
    if(creature->getParent() != toCylinder)
        return RET_NOERROR;

    Item* toItem = NULL;
    Cylinder* subCylinder...
According to the comments on youtube you would need to edit the dat file of the parcel similar to that of a table in tibia, tables you can not walk on.
The comments state that the players could not walk over 2 stacked parcels.

Also since the pker had a friend help out you would have to make it so that runes only effect the top most player/creature if they do not do that already.
 
According to the comments on youtube you would need to edit the dat file of the parcel similar to that of a table in tibia, tables you can not walk on.
The comments state that the players could not walk over 2 stacked parcels.

Also since the pker had a friend help out you would have to make it so that runes only effect the top most player/creature if they do not do that already.

I've edited items.otb to edit item 2562...
To block if have this item on map, you cant move up it...

But parcels i need make like stairs:
To up in 3 parcels you need be on 2 parcels or can up you with no change your z position
To up in 2 parcels you need be on 1 parcel or can up you with no change your z position
To up 1 parcel you dont need be on no one parcel
 
According to the comments on youtube you would need to edit the dat file of the parcel similar to that of a table in tibia, tables you can not walk on.
The comments state that the players could not walk over 2 stacked parcels.

Also since the pker had a friend help out you would have to make it so that runes only effect the top most player/creature if they do not do that already.

That require some source edits, it has nothing to do with dat edits.

I could supply you with those edits, I've got them somewhere, @Nottinghster did the coding, maybe he still has got it somwhere.
 
Exactly if someone have a 8.6 server using this elevation trap system(stacked parcels,boxes,crates is blocking movement)
Give me IP now :cool:

That's the way parcels should work :)



would be amazing :( :)


That require some source edits, it has nothing to do with dat edits.

I could supply you with those edits, I've got them somewhere, @Nottinghster did the coding, maybe he still has got it somwhere.

If you have the code or know where edit or know anything give to us pls
 
Wouldn't editing the dat being easier?
It's not easier as it's not possible.

Shouldn't be hard to do this if you know C++, just check the height of the tile the player is moving from and to (iterate over all items and check for height flag and increment and you have your height), and return not possible to move if the to is 2 blocks higher than the from tile.

Ofc this could be laggy if there are too many items in a tile as it would need to iterate over all to calculate the heigth, this could be solved by saving the height in the tile the moment you move an item that has height to it.
 
Last edited:
It's not easier as it's not possible.

Shouldn't be hard to do this if you know C++, just check the height of the tile the player is moving from and to (iterate over all items and check for height flag and increment and you have your height), and return not possible to move if the to is 2 blocks higher than the from tile.

Ofc this could be laggy if there are too many items in a tile as it would need to iterate over all to calculate the heigth, this could be solved by saving the height in the tile the moment you move an item that has height to it.

height?
How?
Where?

When i get up in 2 parcels my z position change? What? What i could see this all what u said?

Srry if i dont understand you, im a starter

I'm using 3884 (0.4)
 
Well there is already a function to do it, it doesn't get the height tho it just checks if the tile has n hight given:
https://github.com/peonso/forgottenserver036pl1/blob/master/src/tile.cpp#L95-L120

You would need to change and implement in the place that checks for walk.

Ty man...

Code:
bool Player::canWalkthrough(const Creature* creature) const
{
   if(creature == this || hasCustomFlag(PlayerCustomFlag_CanWalkthrough) || creature->isWalkable() ||
     (creature->getMaster() && creature->getMaster() != this && canWalkthrough(creature->getMaster())))
     return true;

   const Player* player = creature->getPlayer();
   if(!player)
     return false;

   if((player.height - ground.height) > 2 ) {
     return false;
   }
   if((((g_game.getWorldType() == WORLDTYPE_OPTIONAL && !player->isEnemy(this, true) &&
     player->getVocation()->isAttackable()) || player->getTile()->hasFlag(TILESTATE_PROTECTIONZONE) || (player->getVocation()->isAttackable() &&
     player->getLevel() < (uint32_t)g_config.getNumber(ConfigManager::PROTECTION_LEVEL))) && player->getTile()->ground &&
     Item::items[player->getTile()->ground->getID()].walkStack) && (!player->hasCustomFlag(PlayerCustomFlag_GamemasterPrivileges)
     || player->getAccess() <= getAccess()))
     return true;

   return (player->isGhost() && getGhostAccess() < player->getGhostAccess())
     || (isGhost() && getGhostAccess() > player->getGhostAccess());
}

I'm on the right way? Could you help me to something more?
 
Ty man...

Code:
bool Player::canWalkthrough(const Creature* creature) const
{
   if(creature == this || hasCustomFlag(PlayerCustomFlag_CanWalkthrough) || creature->isWalkable() ||
     (creature->getMaster() && creature->getMaster() != this && canWalkthrough(creature->getMaster())))
     return true;

   const Player* player = creature->getPlayer();
   if(!player)
     return false;

   if((player.height - ground.height) > 2 ) {
     return false;
   }
   if((((g_game.getWorldType() == WORLDTYPE_OPTIONAL && !player->isEnemy(this, true) &&
     player->getVocation()->isAttackable()) || player->getTile()->hasFlag(TILESTATE_PROTECTIONZONE) || (player->getVocation()->isAttackable() &&
     player->getLevel() < (uint32_t)g_config.getNumber(ConfigManager::PROTECTION_LEVEL))) && player->getTile()->ground &&
     Item::items[player->getTile()->ground->getID()].walkStack) && (!player->hasCustomFlag(PlayerCustomFlag_GamemasterPrivileges)
     || player->getAccess() <= getAccess()))
     return true;

   return (player->isGhost() && getGhostAccess() < player->getGhostAccess())
     || (isGhost() && getGhostAccess() > player->getGhostAccess());
}

I'm on the right way? Could you help me to something more?
That's not the right place to add this, you should add here:
https://github.com/peonso/forgottenserver036pl1/blob/master/src/game.cpp#L1183-L1211
 
Last edited:
Why shouldn't work in canWalkthrough?
Because it will only be called when the player tried to walk through another creature and that's not what he wants.

You will need this:
Code:
int32_t Tile::getHeight() {
    int32_t height = 0;
    if(ground) {
        if(ground->hasProperty(HASHEIGHT)) {
            ++height;
        }
    }

    if(const TileItemVector* items = getItemList()) {
        for(ItemVector::const_iterator it = items->begin(); it != items->end(); ++it) {
            if((*it)->hasProperty(HASHEIGHT)) {
                ++height;
            }
        }
    }

    return height;
}

Edit: sorry that was not the place to put it as well here it's:
https://github.com/peonso/forgottenserver036pl1/blob/master/src/game.cpp#L1183-L1211
 
Last edited:
Because it will only be called when the player tried to walk through another creature and that's not what he wants.

Plus in this one that I sent you already have newTile and oldTile you just have to check for the heights of newTile and oldTile.

Oh ty. i ask for myself, i will use it too :D

Is like @zabuzo show?
Code:
void Player::onCreatureMove(const Creature* creature, const Tile* newTile, const Position& newPos,
   const Tile* oldTile, const Position& oldPos, bool teleport)
{
   Creature::onCreatureMove(creature, newTile, newPos, oldTile, oldPos, teleport);
   if(creature != this)
     return;

   if(getParty())
     getParty()->updateSharedExperience();

   //check if we should close trade
   if(tradeState != TRADE_TRANSFER && ((tradeItem && !Position::areInRange<1,1,0>(tradeItem->getPosition(), getPosition()))
     || (tradePartner && !Position::areInRange<2,2,0>(tradePartner->getPosition(), getPosition()))))
     g_game.internalCloseTrade(this);

   // elevation system
   if((player.height - ground.height) > 2 ) {
    return false;
   }

   if((teleport || oldPos.z != newPos.z) && !hasCustomFlag(PlayerCustomFlag_CanStairhop))
   {
     int32_t ticks = g_config.getNumber(ConfigManager::STAIRHOP_DELAY);
     if(ticks > 0)
     {
       addExhaust(ticks, EXHAUST_COMBAT);
       if(Condition* condition = Condition::createCondition(CONDITIONID_DEFAULT, CONDITION_PACIFIED, ticks))
         addCondition(condition);
     }
   }
}

That's the functions?
 
Oh ty. i ask for myself, i will use it too :D

Is like @zabuzo show?
Code:
void Player::onCreatureMove(const Creature* creature, const Tile* newTile, const Position& newPos,
   const Tile* oldTile, const Position& oldPos, bool teleport)
{
   Creature::onCreatureMove(creature, newTile, newPos, oldTile, oldPos, teleport);
   if(creature != this)
     return;

   if(getParty())
     getParty()->updateSharedExperience();

   //check if we should close trade
   if(tradeState != TRADE_TRANSFER && ((tradeItem && !Position::areInRange<1,1,0>(tradeItem->getPosition(), getPosition()))
     || (tradePartner && !Position::areInRange<2,2,0>(tradePartner->getPosition(), getPosition()))))
     g_game.internalCloseTrade(this);

   // elevation system
   if((player.height - ground.height) > 2 ) {
    return false;
   }

   if((teleport || oldPos.z != newPos.z) && !hasCustomFlag(PlayerCustomFlag_CanStairhop))
   {
     int32_t ticks = g_config.getNumber(ConfigManager::STAIRHOP_DELAY);
     if(ticks > 0)
     {
       addExhaust(ticks, EXHAUST_COMBAT);
       if(Condition* condition = Condition::createCondition(CONDITIONID_DEFAULT, CONDITION_PACIFIED, ticks))
         addCondition(condition);
     }
   }
}

That's the functions?
No it is not like that and it was not the right place my mistake. (it could be done there but there is a better place to put it.)
 
Back
Top