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

Random pos.

Potar

SocialWorld
Senator
Joined
Mar 1, 2009
Messages
1,661
Reaction score
125
Location
Warsaw, Poland
Hello i got problem:

Code:
[4:54:20.857] [Error - GlobalEvent Interface]
[4:54:20.857] In a timer event called from:
[4:54:20.857] data/globalevents/scripts/event.lua:onTime
[4:54:20.857] Description:
[4:54:20.857] data/globalevents/scripts/event.lua:75: attempt to call global 'isWalkable' (a nil value)
[4:54:20.857] stack traceback:
[4:54:20.857]   data/globalevents/scripts/event.lua:75: in function <data/globalevents/scripts/event.lua:72>


There is part of script:

LUA:
fromPosition = {x = 341, y = 465, z = 7}, -- top left cornor of the playground
    toPosition = {x = 424, y = 520, z = 7}, -- bottom right cornor of the playground
    

pos = {x = math.random(config.fromPosition.x, config.toPosition.x), y = math.random(config.fromPosition.y, config.toPosition.y), z = math.random(config.fromPosition.z, config.toPosition.z)}
if isWalkable(pos, true, true, true) then
doSummonCreature(config.zombieName, pos) 
doSendMagicEffect(pos, CONST_ME_MORTAREA)
end

How t change it?

I want to SummonCreature in free (walkable) title.
 
u need this function :

LUA:
function isWalkable(pos, creature, pz, proj) -- nord
if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
local creature = getTopCreature(pos)
if creature.type > 0 then	 return false end
if getTilePzInfo(pos) and not pz then return false end
local n = not proj and 3 or 2
for i = 0, 255 do
pos.stackpos = i
local tile = getTileThingByPos(pos)
if tile.itemid ~= 0 and not isCreature(tile.uid) then
if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
return false
end
end
end
return true
end
 
Back
Top