MegaGlest Forum
Modding and game content creation => Mods => Topic started by: andy_5995 on 17 June 2016, 15:59:29
-
I couldn't find a function that would return a value based on whether or not a unit is movable. Did I miss something? I'm using this page as a reference:
https://docs.megaglest.org/MG/Lua
In the meantime, I made this function. (It doesn't cover all factions)
nonMovableUnits = {
"blacksmith", "bone_tent", "castle", "house", "valhalla", "farm", "thor_totem", "mistletoe_tree", "mead_bar",
"air_pyramid", "desert_camp", "obelisk", "pyramid", "sphinx", "temple",
"beehive", "big_tent", "campfire", "horse_farm", "main_teepee", "reed", "round_tent", "tent", "totem"
}
function isMovableUnit(value)
local isMovable=1
for i = 1, #nonMovableUnits do
if value == nonMovableUnits[i] then
isMovable = 0
break
end
end
return isMovable
end
-
Thanks Andy, that's helpful.
-
Cool. Are you working on a scenario?
-
You missed getUnitsForFaction. Thx to this function your code may be shorter and universal (no hardcoded names).