spinter Posted June 22, 2014 Posted June 22, 2014 sorry my eng country and can be derived from the helicopter? get country from uh1? ====VIAF==== Spinter 155° "Pantere Nere" TsSimComms My Site aiupgrade.net
spinter Posted June 22, 2014 Author Posted June 22, 2014 (edited) local unit = Unit.getByName('Pilot #1') local unitCountry= nil if unit ~= nil then unitCountry = unit:getCountry() trigger.action.outText(unitCountry, 20) end Edited June 22, 2014 by spinter ====VIAF==== Spinter 155° "Pantere Nere" TsSimComms My Site aiupgrade.net
spinter Posted June 22, 2014 Author Posted June 22, 2014 I have a problem I would find it before you can create the helicopter? is possible? ====VIAF==== Spinter 155° "Pantere Nere" TsSimComms My Site aiupgrade.net
ajax Posted June 22, 2014 Posted June 22, 2014 Yes, you could iterate through the env.mission table to find it. Take a look at the Mist code to see how it's done.
spinter Posted June 22, 2014 Author Posted June 22, 2014 and can you help me? ====VIAF==== Spinter 155° "Pantere Nere" TsSimComms My Site aiupgrade.net
ajax Posted June 22, 2014 Posted June 22, 2014 -- returns name of unit's country if found or nil if not found function getCountry(unitName) 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 == unitName then return country.name end end end end end end end end end end end return nil end
spinter Posted June 23, 2014 Author Posted June 23, 2014 thank you I would like to know if I can use this function in my script without using mist? ====VIAF==== Spinter 155° "Pantere Nere" TsSimComms My Site aiupgrade.net
spinter Posted June 23, 2014 Author Posted June 23, 2014 excuse can or can not use it? ====VIAF==== Spinter 155° "Pantere Nere" TsSimComms My Site aiupgrade.net
spinter Posted June 23, 2014 Author Posted June 23, 2014 thank you!! ====VIAF==== Spinter 155° "Pantere Nere" TsSimComms My Site aiupgrade.net
ajax Posted June 27, 2014 Posted June 27, 2014 thank you I would like to know if I can use this function in my script without using mist? Spinter, I saw your question in the other forum topic but I will answer it here. Yes, feel free to use the function in your scripts and to modify it however you want to. Mist does not need to be loaded.
ajax Posted June 27, 2014 Posted June 27, 2014 If using a group name instead of a unit name, I would change your modification slightly: [font=Courier New]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] [color=Blue] if group and group.name == groupName then return country.name end [/color][color=Red]-- 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 [/color] end end end end end end end end return nil end[/font]
spinter Posted June 27, 2014 Author Posted June 27, 2014 Spinter, I saw your question in the other forum topic but I will answer it here. Yes, feel free to use the function in your scripts and to modify it however you want to. Mist does not need to be loaded. Thank you you are very kind! ====VIAF==== Spinter 155° "Pantere Nere" TsSimComms My Site aiupgrade.net
NRG-Vampire Posted June 27, 2014 Posted June 27, 2014 can you write a script/formula what we can use to add more countries via mods folder ?
ajax Posted June 27, 2014 Posted June 27, 2014 can you write a script/formula what we can use to add more countries via mods folder ? Do you mean add countries not currently available in DCS? If so, I'm sure somebody has the knowledge to do it but I'm sorry to say I don't. IIIRC, I think someone has actually done that (in a previous version of DCS). I can't remember any specifics. This thread might point you in the right direction: http://forums.eagle.ru/showthread.php?t=54015&highlight=add+country .
NRG-Vampire Posted June 27, 2014 Posted June 27, 2014 (edited) Do you mean add countries not currently available in DCS? If so, I'm sure somebody has the knowledge to do it but I'm sorry to say I don't. IIIRC, I think someone has actually done that (in a previous version of DCS). I can't remember any specifics. This thread might point you in the right direction: http://forums.eagle.ru/showthread.php?t=54015&highlight=add+country . thanks, i know that mods but that was for fc2 afaik we needed to edit many lua files in scripts/database folder but as you know if we will able to add countries in mods folder then we wont need too edit existing lua files in database folder - which will be overwritten all the time when we run an update of course it's possible to add more countries in database folder afaik but i dont like that way :) however with using jsgme it is not a difficult activity another old topic by Michelange: http://forums.eagle.ru/showthread.php?t=93205 ^ afaik that was for fc3-dcsw but i dont know it's still working with current version (1.2.8.) or not :dunno: Edited June 27, 2014 by NRG-Vampire
Recommended Posts