


How to add altitude to maps?
like topological maps, if i add z coordinate
edited 1×, last 01.02.15 03:07:38 pm
altitudetiles = {{[[X, Y, HEIGHT]]}} playerheight = {} for id = 1, 32 do 	playerheight[id] = 0 end
addhook("always", "alwayshook") addhook("movetile", "movetilehook") function alwayshook() 	for none, id in pairs(player(0, "tableliving")) do 		for none, tilevalue in pairs(altitudetiles) do 			if (player(id, "tilex") == tilevalue[1] and player(id, "tiley") == tilevalue[2]) then 				if (tilevalue[3] > playerheight[id]) then 					parse("setpos " .. id .. " " .. player(id, "x") .. " " .. player(id, "y")) 				end 			end 		end 	end end function movetilehook(id, tilex, tiley) 	for none, tilevalue in pairs(altitudetiles) do 		if (tilex == tilevalue[1] and tiley == tilevalue[2]) then 			if (tilevalue[3] < playerheight[id]) then 				playerheight[id] = tilevalue[3] 				 				if (tilevalue[3] <= -5) then 					parse("sethealth " .. id .. " " .. player(id, "health") - math.abs(tilevalue[3]) / 5)) 				end 			end 		end 	end end