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

teleport with rotation possible?

Mauzim

Member
Joined
Jan 3, 2011
Messages
568
Reaction score
9
Example.
doTeleportThing(cid, {x=32968, y=32626, z=5}, north)
doTeleportThing(cid, {x=32968, y=32626, z=5}, south)
doTeleportThing(cid, {x=32968, y=32626, z=5}, west)
doTeleportThing(cid, {x=32968, y=32626, z=5}, east)

Is there any function that resembles this?
 
Code:
NORTH (0) - creature is rotated up (north) (/\)
EAST (1) - creature is rotated right (east) (>)
SOUTH (2) - creature is rotated down (south) (\/)
WEST (3) - creature is rotated left (west) (<)

so this changed the creature direction to the north i.e.

LUA:
doTeleportThing(cid, {x=32968, y=32626, z=5})
doCreatureSetLookDirection(cid,0)
 
edit sources instead. it's better.

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;

	fromCylinder->getTile()->moveCreature(actor, creature, toCylinder);
	if(creature->getParent() != toCylinder)
		return RET_NOERROR;

	Item* toItem = NULL;
	Cylinder* subCylinder = NULL;

	int32_t n = 0, tmp = 0;
	while((subCylinder = toCylinder->__queryDestination(tmp, creature, &toItem, flags)) != toCylinder)
	{
		[B][COLOR="red"]internalCreatureTurn(creature, getDirectionTo(toCylinder->getTile()->getPosition(), subCylinder->getTile()->getPosition(), false));[/COLOR][/B]
[...]
and
Code:
ReturnValue Game::internalTeleport(Thing* thing, const Position& newPos, bool pushMove, uint32_t flags /*= 0*/)
{
	[B][COLOR="red"]Position p = thing->getPosition();[/COLOR][/B]
	if(newPos == [B][COLOR="red"]p[/COLOR][/B])
		return RET_NOERROR;

	if(thing->isRemoved())
		return RET_NOTPOSSIBLE;

	if(Tile* toTile = map->getTile(newPos))
	{
		if(Creature* creature = thing->getCreature())
		{
[B][COLOR="red"]			creature->getTile()->moveCreature(NULL, creature, toTile, (pushMove && Position::areInRange<1,1,0>(creature->getPosition(), newPos)) ? false : true);
			if(!pushMove)
			{
				if(p.x == newPos.x && p.y < newPos.y)
					internalCreatureTurn(creature, SOUTH);
				else if(p.x > newPos.x)
					internalCreatureTurn(creature, WEST);
				else if(p.x < newPos.x)
					internalCreatureTurn(creature, EAST);
			}[/COLOR][/B]
			return RET_NOERROR;
		}
[...]
'100% rl', don't ask
 
Back
Top