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.
That's the way parcels should work
Exactly if someone have a 8.6 server using this elevation trap system(stacked parcels,boxes,crates is blocking movement)
Give me IP now
That's the way parcels should work
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.
Wouldn't editing the dat being easier?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.
It's not easier as it's not possible.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.
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: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.
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());
}
That's not the right place to add this, you should add here: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/player.cpp#L1522-L1547
Because it will only be called when the player tried to walk through another creature and that's not what he wants.Why shouldn't work in canWalkthrough?
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;
}
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.
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);
}
}
}
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.)Oh ty. i ask for myself, i will use it too
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.)