LUA OutOfComms (Full Version)

All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> Mods and Scenarios >> Lua Legion



Message


De Savage -> LUA OutOfComms (10/22/2018 7:21:30 PM)

I want to simulate COM JAMMER and create area (four RP points) where enemy side will have nocomms and when they exit the area comms are back.

First I created event for unit entering, but cant figure out how to check UnitX and make it out of comms. And also I can't figure out how to get comms back after leaving area. Have anyone made this kind of LUA?

My example:

local unit = ScenEdit_UnitX()
ScenEdit_SetUnit({Side=”Japan”, unitname=UnitxX(), methodOutOfComms=”True”})





michaelm75au -> RE: LUA OutOfComms (10/23/2018 8:32:37 AM)

I don't think I have a function to change the OOC as it is relies on several factors. The unit wrapper only shows the state of it.
Someone else asked about this the other week, and I was going to see what is involved.




michaelm75au -> RE: LUA OutOfComms (10/23/2018 12:31:26 PM)

I have been reviewing the code, and you should be able to turn OUTOFCOMMS on and off.

local unit = ScenEdit_UnitX()
ScenEdit_SetUnit( {side = unit.side, unitname = unit.name, outofcomms = true} )




Parel803 -> RE: LUA OutOfComms (3/28/2021 1:35:08 PM)

Good afternoon,

Hope someone can point me in the right direction and telling me what I'm doing wrong:


local Unit = ScenEdit_GetUnit({name='Protector USV [Typhoon, Armed] #1', guid='50PVO4-0HM7FN02G2FE9'})
-- out of comms
ScenEdit_SetUnit({side = Unit.side, guid=Unit.guid, outOfComms = true})
print (Unit.outOfComms)

probably something like a typo but not seeing it

with regards Gert-Jan




musurca -> RE: LUA OutOfComms (3/28/2021 6:24:19 PM)

Here's the function I use internally, taking a Unit wrapper unit and a boolean commsState:

function Unit_SetOutOfComms(unit, commsState)
ScenEdit_SetUnit({guid=unit.guid, outOfComms=commsState})
end


Just tested it on 1147.18, and seemed to work okay. Your code looks close and I don't immediately see why the code you posted above wouldn't work. However I would note that you don't need to provide a side if you're also providing the GUID to _SetUnit (the GUID is unique among all units regardless of side). Possibly that's the issue?




Parel803 -> RE: LUA OutOfComms (3/29/2021 7:47:31 PM)

Thank you for your time and answer,
with regards Gert-Jan




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
1.21875