Hahstudios
New Member
- Joined
- Mar 11, 2010
- Messages
- 49
- Solutions
- 3
- Reaction score
- 1
im trying to get the spell "utevo res" to allow me to walk through the creatures but only the master ofc.
i have tried several bools and just cant seem to get it to work
i have tried several bools and just cant seem to get it to work
Lua:
bool Player::canWalkthrough(const Creature* creature) const
{
if (group->access || creature->isInGhostMode()) {
return true;
}
const Player* player = creature->getPlayer();
if (!player) {
return false;
}
auto summons = player->getSummons();
auto summonsIt = find(summons.begin(), summons.end(), creature);
if (summonsIt != summons.end()) {
return true;
}
const Tile* playerTile = player->getTile();
if (!playerTile || !playerTile->hasFlag(TILESTATE_PROTECTIONZONE)) {
return false;
}
const Item* playerTileGround = playerTile->getGround();
if (!playerTileGround || !playerTileGround->hasWalkStack()) {
return false;
}
Player* thisPlayer = const_cast<Player*>(this);
if ((OTSYS_TIME() - lastWalkthroughAttempt) > 2000) {
thisPlayer->setLastWalkthroughAttempt(OTSYS_TIME());
return false;
}
if (creature->getPosition() != lastWalkthroughPosition) {
thisPlayer->setLastWalkthroughPosition(creature->getPosition());
return false;
}
thisPlayer->setLastWalkthroughPosition(creature->getPosition());
return true;
}
bool Player::canWalkthroughEx(const Creature* creature) const
{
if (group->access) {
return true;
}
const Player* player = creature->getPlayer();
if (!player) {
return false;
}
const Tile* playerTile = player->getTile();
return playerTile && playerTile->hasFlag(TILESTATE_PROTECTIONZONE);
}