maverickturner Posted January 17, 2019 Share Posted January 17, 2019 I'm having trouble understanding how to properly send outText messages to specific players. I've disseminated quite a few scripts but still can't get my head around it. For this example, I am trying to display a message to only the player aircraft that would be in the zone. I know I'm doing something wrong here and was hoping someone could help me understand this better. Note- I have each client AC as its own group. local BLUE_Timer_Abu_Dhabi = trigger.misc.getUserFlag(800) local RED_Timer_Abu_Dhabi = trigger.misc.getUserFlag(900) local BLUE_units_Abu_Dhabi = mist.makeUnitTable({'[blue][plane]'}) local RED_units_Abu_Dhabi = mist.makeUnitTable({'[red][plane]'}) local capture_zone = {'Abu Dhabi Capture'} local BLUE_units_in_zone = mist.getUnitsInZones(BLUE_units_Abu_Dhabi, capture_zone, 'cylinder') local RED_units_in_zone = mist.getUnitsInZones(RED_units_Abu_Dhabi, capture_zone, 'cylinder') local BLUE_Countdown = 240 - BLUE_Timer_Abu_Dhabi local RED_Countdown = 240 - RED_Timer_Abu_Dhabi do for i = 1, #BLUE_units_in_zone do local ClientGroupID = BLUE_units_in_zone:GetClientGroupID() trigger.action.outTextForGroup(ClientGroupID, "Capturing airbase. " ..BLUE_Countdown.. " seconds remaining", 1) end end Link to comment Share on other sites More sharing options...
Grimes Posted January 18, 2019 Share Posted January 18, 2019 I think it mixing up a moose function with functionality within mist. For instance GetClientGroupID() is a moose function. But the mist.getUnitsInZones just returns a list of unit objects, which as far as I am aware does not return any object that works with moose. It works with the default scripting functionality though. So you'd have to iterate the table and get each units group Id like the following: for i, uObject in pairs(BLUE_units_in_zone) do local clientGroupId = Unit.getGroup(uObject):getID() trigger.action.outTextForGroup(ClientGroupID, "Capturing airbase. " ..BLUE_Countdown.. " seconds remaining", 1) end Alternatively you can cross reference it with the mist databases. for i, uObject in pairs(BLUE_units_in_zone) do local clientGroupId = mist.DBs.humansByName[unit.getName(uObject)].groupId trigger.action.outTextForGroup(ClientGroupID, "Capturing airbase. " ..BLUE_Countdown.. " seconds remaining", 1) end 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...
maverickturner Posted January 24, 2019 Author Share Posted January 24, 2019 I think it mixing up a moose function with functionality within mist. For instance GetClientGroupID() is a moose function. But the mist.getUnitsInZones just returns a list of unit objects, which as far as I am aware does not return any object that works with moose. It works with the default scripting functionality though. So you'd have to iterate the table and get each units group Id like the following: for i, uObject in pairs(BLUE_units_in_zone) do local clientGroupId = Unit.getGroup(uObject):getID() trigger.action.outTextForGroup(ClientGroupID, "Capturing airbase. " ..BLUE_Countdown.. " seconds remaining", 1) end Alternatively you can cross reference it with the mist databases. for i, uObject in pairs(BLUE_units_in_zone) do local clientGroupId = mist.DBs.humansByName[unit.getName(uObject)].groupId trigger.action.outTextForGroup(ClientGroupID, "Capturing airbase. " ..BLUE_Countdown.. " seconds remaining", 1) end Sorry for the late reply Gries but thank you. This was very helpful in helping me understand some key ideas. Link to comment Share on other sites More sharing options...
Recommended Posts