stinkx Posted October 31, 2015 Share Posted October 31, 2015 Hi there, I have been trying to get together a very simple range script but it seems i have hit a brick wall. Would appreciate any help. We have two planes with pilot names (unit name) unitNames={'DEBUG_P','MULE_P'}then we have other functions for starting a run, finishing a run, reporting and resetting scores etc. for simplicity i wanted to add start/reset/report to f10 to avoid dealing with zones etc. here is the code that assigns those functions to each player's f10 menu seperately function addFuncs(unitNames) for _,v in ipairs(unitNames) do local LunitName = v local unit = Unit.getByName(LunitName) if unit then local group = unit:getGroup() if group then if not funcAddState[LunitName] then trigger.action.outText('added functions to ' .. LunitName, 10) local gid = group:getID() if gid then local _sub = missionCommands.addSubMenuForGroup(gid, "RUN" , nil) for _,v in ipairs(targetNames) do local txt= "Run " .. v missionCommands.addCommandForGroup(gid,txt, _sub , startRun, {LunitName, v}) end missionCommands.addCommandForGroup(gid,"Reset Stats", nil, resetStats, LunitName) missionCommands.addCommandForGroup(gid,"Display Stats", nil, displayStats, LunitName) funcAddState[LunitName]=true end end end end end mist.scheduleFunction(addFuncs,{unitNames},timer.getTime() + 5) endwhile funcAddState={} --the list of planes who has the f10 menu added for k,v in ipairs(unitNames) do funcAddState[v]=false endhas been initialized at the start now the problem is, when we get into the multiplayer, i am unable to feed groupID to the addCommandForGroup because local LunitName = 'DEBUG_P' local Lunit= Unit.getByName(LunitName) local Lgroup=Lunit:getGroup() return Lgroupand local LunitName = 'MULE_P' local Lunit= Unit.getByName(LunitName) local Lgroup=Lunit:getGroup() return Lgroupreturns { "id_": 0 }for both any ideas on groupID of players during multiplayer, or on workarounds to the addCommandForGroup ? PS:btw in singleplayer the proper ids of 1 and 2 are correctly returned 1 Link to comment Share on other sites More sharing options...
Grimes Posted October 31, 2015 Share Posted October 31, 2015 Its a known bug that is quite annoying. Simply put none of the Group functions work on anything a client is in. It should work ok if the host is in the group. http://forums.eagle.ru/showthread.php?t=147792 31682 - Client groups not accessible in multiplayer. 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 Link to comment Share on other sites More sharing options...
stinkx Posted October 31, 2015 Author Share Posted October 31, 2015 Thanks for the reply Grimes. Just to double check, this thing worked before 1.5 right? Link to comment Share on other sites More sharing options...
Grimes Posted October 31, 2015 Share Posted October 31, 2015 It should. It also works in 1.5 as long as its single player or MP as the host. I know its not ideal, but you can work under the assumption that something like that will get fixed. 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 Link to comment Share on other sites More sharing options...
Recommended Posts