I am finding that I need to write a function that iterates through all of the maps in the game (using Dungeon.getMap(number)) in order to find the level number of a map object. I have to match the level coordinates of the map object in question to the map objects being iterated. We have getName(), getLevelCoords(), etc... but no getLevel()???
Anyway, seems like a miss to me. Maybe I am missing something. There isn't anything in the scripting reference that I can see nor did I find anything with trial and error testing.
map object has no function to get the level number?? Ugh
Re: map object has no function to get the level number?? Ugh
But isn't level index essentially the "input" to get back co-ords, name etc. You can't get any of that information without giving a level index at some point, so getLevel() would just return the value you already knew.
Unless I'm misunderstanding the question
Unless I'm misunderstanding the question
Re: map object has no function to get the level number?? Ugh
Here is the situation I am having. I am using another map function, getAdjacentLevel(number, number, number). Each number is the X, Y and Z direction for the adjacent level you want to get for this map. What it returns is the map object of the adjacent level. That's great but what is that map's level number!?!? Its not on the map object. That is the problem.Scotty wrote:But isn't level index essentially the "input" to get back co-ords, name etc. You can't get any of that information without giving a level index at some point, so getLevel() would just return the value you already knew.
Unless I'm misunderstanding the question
Re: map object has no function to get the level number?? Ugh
Here is a workaround
Code: Select all
function getMapLevel(map)
for ent in map:allEntities() do
return ent.level
end
end
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
- cloneObject viewtopic.php?f=22&t=8450
Re: map object has no function to get the level number?? Ugh
Yes, that would work. I did a work around too. I will admit yours is more simple than mine. Thanks.JKos wrote:Here is a workaroundCode: Select all
function getMapLevel(map) for ent in map:allEntities() do return ent.level end end