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

Summoning / getClosestFreeTile

Thuggeh

New Member
Joined
Jul 10, 2007
Messages
201
Reaction score
1
Well I'm trying to make a script that summons a monster to the closest free tile around. The only problem is that certain borders (ocean borders to be more specific) are counted as free tiles, but you cannot summon on them. Anyone know how to workaround this?


Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local freeTile = getClosestFreeTile(cid, fromPosition)

function summonSeaCreature(cid, creatureName)
if doCreateMonster(creatureName, freeTile, false) then
ret = true
else
ret = false
end


function summonMonster(cid, creatureName)
repeat
summonSeaCreature(cid, creatureName)
until
ret == true
end

summonMonster(cid, "Rat")

It just doesn't seem to work at all. -.-
 
why i guess you may just make
Code:
doSummonCreature("rat", getClosestFreeTile(cid, fromPosition))

or
Code:
doSummonCreature("rat", getPlayerPosition(cid))
 
PHP:
doSummonMonster("Rat", getClosestFreeTile(getCreaturePosition(cid), false, false))
 
Back
Top