spinter Posted June 26, 2016 Posted June 26, 2016 ------------------------------ -- get id ------------------------------ function get_id(groupName) local i,j,k if env.mission.coalition then for coa,coaTable in pairs(env.mission.coalition) do if type(coaTable) == 'table' and coaTable.country then for i=1,#coaTable.country do local country = coaTable.country[i] for uType,uTable in pairs(country) do if uType == 'helicopter' or uType == 'ship' or uType == 'vehicle' or uType == 'plane' then if type(uTable)=='table' and uTable.group then for j=1,#uTable.group do local group = uTable.group[j] if group.units then for k=1,#group.units do local unit = group.units[k] if group.name and group.name == groupName then return unit.unitId end end end end end end end end end end end return nil end ------------------------------ -- get country ------------------------------ function getCountry(groupName) local i,j,k if env.mission.coalition then for coa,coaTable in pairs(env.mission.coalition) do if type(coaTable) == 'table' and coaTable.country then for i=1,#coaTable.country do local country = coaTable.country[i] for uType,uTable in pairs(country) do if uType == 'helicopter' or uType == 'ship' or uType == 'vehicle' or uType == 'plane' then if type(uTable)=='table' and uTable.group then for j=1,#uTable.group do local group = uTable.group[j] if group.units then for k=1,#group.units do local unit = group.units[k] -- if unit.name and unit.name == groupName then -- return group.name--country.name -- end if group.name and group.name == groupName then return country.name end end end end end end end end end end end return nil end I 126 in the version I was using these functions and can help me to use them with the version 153 1 ====VIAF==== Spinter 155° "Pantere Nere" TsSimComms My Site aiupgrade.net
Grimes Posted June 26, 2016 Posted June 26, 2016 Group and unit names are now saved in the mission file as "dict keys" for localization purposes. You can use env.getValueDictByKey() to return the actual value. Basically anything that can be used for localization in multiple languages is given a unique value. Within the mission is a lookup table in different languages that defines what the players sees. As a result you don't need to have 6 different versions of the mission created for the different languages. if group.name and env.getValueDictByKey(group.name) == groupName then The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum
spinter Posted June 26, 2016 Author Posted June 26, 2016 you can have full script? ====VIAF==== Spinter 155° "Pantere Nere" TsSimComms My Site aiupgrade.net
Recommended Posts