Faraonekkk
New Member
- Joined
- Feb 15, 2010
- Messages
- 686
- Reaction score
- 4
Can anyone more experienced say me what thats mean?
the script
Its in position32
Code:
if math.random(1,100) >= 51 then
the script
Code:
local dire = getDirectionTo(getThingPos(getCreatureSummons(cid)[1]), params.topos)
if dire >= 0 and dire <= 7 then
if dire == NORTHWEST then
if math.random(1,100) >= 51 then
dire = NORTH
if isWalkable(getPosByDir(getThingPos(getCreatureSummons(params.cid)[1]), dire), params.ccid, 0, 0) then
dire = NORTH
else
dire = WEST
end
Its in position32
Code:
function getDirectionTo(pos1, pos2)
local dir = NORTH
if(pos1.x > pos2.x) then
dir = WEST
if(pos1.y > pos2.y) then
dir = NORTHWEST
elseif(pos1.y < pos2.y) then
dir = SOUTHWEST
end
elseif(pos1.x < pos2.x) then
dir = EAST
if(pos1.y > pos2.y) then
dir = NORTHEAST
elseif(pos1.y < pos2.y) then
dir = SOUTHEAST
end
else
if(pos1.y > pos2.y) then
dir = NORTH
elseif(pos1.y < pos2.y) then
dir = SOUTH
end
end