Page 1 of 1
map object has no function to get the level number?? Ugh
Posted: Sat Dec 06, 2014 4:51 pm
by MrChoke
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.
Re: map object has no function to get the level number?? Ugh
Posted: Sat Dec 06, 2014 5:40 pm
by Scotty
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
Posted: Sat Dec 06, 2014 7:23 pm
by MrChoke
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

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.
Re: map object has no function to get the level number?? Ugh
Posted: Sat Dec 06, 2014 8:21 pm
by JKos
Here is a workaround
Code: Select all
function getMapLevel(map)
for ent in map:allEntities() do
return ent.level
end
end
Re: map object has no function to get the level number?? Ugh
Posted: Sat Dec 06, 2014 9:37 pm
by MrChoke
JKos wrote:Here is a workaround
Code: Select all
function getMapLevel(map)
for ent in map:allEntities() do
return ent.level
end
end
Yes, that would work. I did a work around too. I will admit yours is more simple than mine. Thanks.