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

Compiling Creaturescripts onMove

knightxd

Member
Joined
Feb 21, 2009
Messages
211
Reaction score
16
Location
Rio de Janeiro
well, i'm trying to implement darkhaos function onMove(cid, fromPosition, toPosition) on tfs 0.4 trunk 3676...

this one "darkhaos onMove"

i've add all and made elf changes, its on
[cpp] bool deny = false;
CreatureEventList moveEvents = creature->getCreatureEvents(CREATURE_EVENT_MOVE);
for(CreatureEventList::iterator it = moveEvents.begin(); it != moveEvents.end(); ++it)
if(!(*it)->executeMove(creature, currentPos, destPos))
deny = true;

if(deny)
return RET_NOTPOSSIBLE;[/cpp]

now its looking like;

[cpp] bool deny = false;
CreatureEventList moveEvents = creature->getCreatureEvents(CREATURE_EVENT_MOVE);
for(CreatureEventList::iterator it = moveEvents.begin(); it != moveEvents.end(); ++it)
{
if(!(*it)->executeMove(creature, Position(currentPos), Position(destPos)))
deny = true;
}

if(deny)
return RET_NOTPOSSIBLE;[/cpp]

and also here

[cpp]env->streamPosition(scriptstream, "fromPosition", fromPosition, 0);
env->streamPosition(scriptstream, "toPosition", toPosition, 0);[/cpp]
into
[cpp]scriptstream << "local fromPosition = " << fromPosition << std::endl;
scriptstream << "local toPosition = " << toPosition << std::endl;[/cpp]

well its working but, does anyone know where can i edit to it work with this

Lua:
if(toPosition == {x = 100, y = 100, z = 7}) then

its working on 0.4 well but just with it

Lua:
if(toPosition.x == 100 and toPosition.y == 100 and toPosition.z == 7) then

and also, if i use return true it work well, but if i use return false in the end, when a character walks into the position he become stuck... (if anyone can help me just to get the return false to work.. :X)
 
Last edited:
Back
Top