Code: Select all
function counttiles()
local zero = 0
local one = 0
local two = 0
local three = 0
for x = 0,31 do
for y = 0,31 do
if party.map:getAutomapTile(x,y) == 0 then
zero = zero + 1
elseif party.map:getAutomapTile(x,y) == 1 then
one = one + 1
elseif party.map:getAutomapTile(x,y) == 2 then
blocker = spawn("blocker", party.level, x,y,0,0)
blocker.obstacle:setBlockItems(false)
blocker.obstacle:setBlockMonsters(true)
blocker.obstacle:setBlockParty(false)
blocker.obstacle:setRepelProjectiles(false)
two = two + 1
elseif party.map:getAutomapTile(x,y) == 3 then
three = three + 1
end
end
end
print(zero,one,two,three)
local total = zero + one + two + three
print("Total =", total)
end
counttiles()
So my solution is to put a sheet of blockers on the water surface that is set to only block monsters. Doing this manually is extremely tedious, so I wrote a script to place them all for me and apply the correct settings to each one.
I left in the debug code so you can experiment with that each number represents, 2 = water. In a 32*32 map grid, you should end up with 1024 tiles, and it does, at least on the map I tested it on.
Change party.level to the actual number for your level once you know it.
EDIT: found out that the coordinates start at 0 instead of 1, so X range is 0, 31 and Y range is 0, 31