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

[Request] Add Stair-hop exhausted

Zell

Intermediate OT User
Joined
Oct 23, 2010
Messages
214
Reaction score
117
Hello otland,

I have a 7.6 ot, and I need add stair hopping exhausted.
I think, in game.cpp this is the function of the up/down

Code:
ReturnValue Game::internalMoveCreature(Creature* creature, Direction direction, uint32_t flags /*= 0*/)
{
	Cylinder* fromTile = creature->getTile();
	Cylinder* toTile = NULL;

	const Position& currentPos = creature->getPosition();
	Position destPos = currentPos;

	bool canChangeFloor = true;
	switch(direction){
		case NORTH:
			destPos.y -= 1;
			break;

		case SOUTH:
			destPos.y += 1;
			break;

		case WEST:
			destPos.x -= 1;
			break;

		case EAST:
			destPos.x += 1;
			break;

		case SOUTHWEST:
			destPos.x -= 1;
			destPos.y += 1;
			canChangeFloor = false;
			break;

		case NORTHWEST:
			destPos.x -= 1;
			destPos.y -= 1;
			canChangeFloor = false;
			break;

		case NORTHEAST:
			destPos.x += 1;
			destPos.y -= 1;
			canChangeFloor = false;
			break;

		case SOUTHEAST:
			destPos.x += 1;
			destPos.y += 1;
			canChangeFloor = false;
			break;
	}

	if(creature->getPlayer() && canChangeFloor){
		//try go up
		if(currentPos.z != 8 && creature->getTile()->hasHeight(3)){
			Tile* tmpTile = map->getTile(currentPos.x, currentPos.y, currentPos.z - 1);
				
			if(tmpTile == NULL || (tmpTile->ground == NULL && !tmpTile->hasProperty(BLOCKSOLID))){
				tmpTile = map->getTile(destPos.x, destPos.y, destPos.z - 1);
				if(tmpTile && tmpTile->ground && !tmpTile->hasProperty(BLOCKSOLID)){
					flags = flags | FLAG_IGNOREBLOCKITEM | FLAG_IGNOREBLOCKCREATURE;
					destPos.z -= 1;
				}
			}
		}
		else{
			//try go down
			Tile* tmpTile = map->getTile(destPos);
			if(currentPos.z != 7 && (tmpTile == NULL || (tmpTile->ground == NULL && !tmpTile->hasProperty(BLOCKSOLID)))){
				tmpTile = map->getTile(destPos.x, destPos.y, destPos.z + 1);
				
				if(tmpTile && tmpTile->hasHeight(3)){
					flags = flags | FLAG_IGNOREBLOCKITEM | FLAG_IGNOREBLOCKCREATURE;
					destPos.z += 1;
				}
			}
		}
	}

	toTile = map->getTile(destPos);

	ReturnValue ret = RET_NOTPOSSIBLE;
	if(toTile != NULL){
		ret = internalMoveCreature(creature, fromTile, toTile, flags);
	}

	if(ret != RET_NOERROR){
		if(Player* player = creature->getPlayer()){
			player->sendCancelMessage(ret);
			player->sendCancelWalk();
		}
	}

	return ret;
}

Thanks ;)
 
Last edited:
Alright its OTLand not OTFans! just let you know :blink:

I think this is the answer! In config.lua
Lua:
stairhopDelay = 2 * 1000

2 is the amount of seconds that player must wait to make a spell or so ,I hope it will help :p

Regards,
Sacred Anlyest
 
LOL! epic fail hahahah, sorry xD

So, im using avesta, I think this variable is undeclared and does not work.
I need add this lines to the game.cpp and configmanager.cpp to work in the config.lua

>.<
 
solution!

Hello zell if u are using avesta then search for this

Code:
void Creature::onCreatureMove(const Creature* creature, const Tile* newTile, const Position& newPos,

if u found that search for this

Code:
//floor change extra cost
	    lastStepCost = 1;


as u can see i have putted it on 1 so there wont be any delay if u put 2 than it should be as u want with delay;)

rep++ if i helped u;)

king regards
 
Back
Top