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

Lua Move Creature

lhc00

New Member
Joined
Mar 23, 2010
Messages
23
Reaction score
0
I would like to know a way to make a creature move from a position to a new position, is there any function that i can use to do this?

Edit: I need to make the creature walk, not to teleport the creature.

Thx by the attention ^_^
 
Last edited:
Lua:
doMoveCreature(cid, direction)

Lua:
NORTH = 0
EAST = 1
SOUTH = 2
WEST = 3
SOUTHWEST = 4
SOUTHEAST = 5
NORTHWEST = 6
NORTHEAST = 7
 
Last edited:
Thx, I used this function, now i could make a creature chase other ^_^:

Code:
function onCastSpell(cid, var)
         target = getCreatureTarget(cid)    
         while getDistanceBetween(getCreaturePosition(cid), getCreaturePosition(target)) > 1 do
               doMoveCreature(cid, getDirectionTo(getCreaturePosition(cid), getCreaturePosition(target)))
         end       
end
 
Yup exactly that, but it wont function well , why?
It may oush creature on walls, unstepable areas etc, you should do some checks, to get the free area to be pushed in.
 
Code:
function onCastSpell(cid, var)
         target = getCreatureTarget(cid)    
         while getDistanceBetween(getCreaturePosition(cid), getCreaturePosition(target)) > 1 do
               [B]if doTileQueryAdd(cid, getCreaturePosition(target)) ~= 1 then[/B]--this check?
               doMoveCreature(cid, getDirectionTo(getCreaturePosition(cid), getCreaturePosition(target)))
               end
         end       
end
 
Back
Top