kosamika
New Member
- Joined
- Nov 8, 2008
- Messages
- 8
- Reaction score
- 4
Hello otlanders!
im trying to edit the game perspective, into an standard RPG style
this post explains perspective, as i understand, in case im not explaining myself.
this is what i have:
first image, red arrows represent the movements i cant make.
2nd , 3rd images, shows the building on RME, so you can get a visual representation
first image, you can get on the roof, but i can only assume the check is being done in the blue square instead.
second image, wont allow me to get on the roof, again, i assume check is being done on blue square instead.
third image, levitation spell
it looks to me as if these functions are all using the same mathematics, i could be wrong, tho
totaly speaking from ignorance
this is my game::internalmovecreature at game.cpp, actualy using tfs 1.4.2
every change has a comment on it, i just moved out the destination a little bit, but the checks are still being done somewhere else
i can only assume getNextPosition(direction, currentPos); is my answer, but any shread of light will be highly appreciated.
Also, worth mentioning i do lack game mechanics knowledge, therefore im not completely sure, if tibia allows you to get on top of roofs from the north side/west side.
if someone can confirm this to me, that helps too.
Please, help this tiny necromancer get on the roof!
thanks for your time.
im trying to edit the game perspective, into an standard RPG style
this post explains perspective, as i understand, in case im not explaining myself.
this is what i have:
first image, red arrows represent the movements i cant make.
2nd , 3rd images, shows the building on RME, so you can get a visual representation
first image, you can get on the roof, but i can only assume the check is being done in the blue square instead.
second image, wont allow me to get on the roof, again, i assume check is being done on blue square instead.
third image, levitation spell
it looks to me as if these functions are all using the same mathematics, i could be wrong, tho
totaly speaking from ignorance
this is my game::internalmovecreature at game.cpp, actualy using tfs 1.4.2
C++:
ReturnValue Game::internalMoveCreature(Creature* creature, Direction direction, uint32_t flags /*= 0*/)
{
creature->setLastPosition(creature->getPosition());
const Position& currentPos = creature->getPosition();
Position destPos = getNextPosition(direction, currentPos);
Player* player = creature->getPlayer();
bool diagonalMovement = (direction & DIRECTION_DIAGONAL_MASK) != 0;
if (player && !diagonalMovement) {
//try to go up
if (currentPos.z != 8 && creature->getTile()->hasHeight(3)) {
Tile* tmpTile = map.getTile(currentPos.x +1, currentPos.y, currentPos.getZ() - 1); // add +1 to currentPos.x
if (tmpTile == nullptr || (tmpTile->getGround() == nullptr && !tmpTile->hasFlag(TILESTATE_BLOCKSOLID))) {
tmpTile = map.getTile(destPos.x +1, destPos.y, destPos.getZ() - 1); //add +1 to destPos.x
if (tmpTile && tmpTile->getGround() && !tmpTile->hasFlag(TILESTATE_IMMOVABLEBLOCKSOLID)) {
flags |= FLAG_IGNOREBLOCKITEM | FLAG_IGNOREBLOCKCREATURE;
if (!tmpTile->hasFlag(TILESTATE_FLOORCHANGE)) {
player->setDirection(direction);
destPos.x++; //add +1 to destPos.x
destPos.z--;
}
}
}
}
//try to go down
if (currentPos.z != 7 && currentPos.z == destPos.z) {
Tile* tmpTile = map.getTile(destPos.x, destPos.y, destPos.z);
if (tmpTile == nullptr || (tmpTile->getGround() == nullptr && !tmpTile->hasFlag(TILESTATE_BLOCKSOLID))) {
tmpTile = map.getTile(destPos.x -1, destPos.y, destPos.z + 1); //substract -1 to destPos.x
if (tmpTile && tmpTile->hasHeight(3) && !tmpTile->hasFlag(TILESTATE_IMMOVABLEBLOCKSOLID)) {
flags |= FLAG_IGNOREBLOCKITEM | FLAG_IGNOREBLOCKCREATURE;
player->setDirection(direction);
destPos.x--; //substract -1 to destPos.x
destPos.z++;
}
}
}
}
Tile* toTile = map.getTile(destPos);
if (!toTile) {
return RETURNVALUE_NOTPOSSIBLE;
}
return internalMoveCreature(*creature, *toTile, flags);
}
every change has a comment on it, i just moved out the destination a little bit, but the checks are still being done somewhere else
i can only assume getNextPosition(direction, currentPos); is my answer, but any shread of light will be highly appreciated.
Also, worth mentioning i do lack game mechanics knowledge, therefore im not completely sure, if tibia allows you to get on top of roofs from the north side/west side.
if someone can confirm this to me, that helps too.
Please, help this tiny necromancer get on the roof!
thanks for your time.