Page 1 of 1

LUA Command to Drop Contact

Posted: Tue Dec 14, 2021 10:01 am
by tmoilanen
How do you drop a contact via LUA?

I created a Unit Remains in Area Trigger for x time, after which the airfield group changes to the red side via the code below. The airfield still remains as a contact on the red side after this event, and I would like to add syntax that drops the contact.

Code: Select all

local myside = 'AIRCOM'
 local mynewside = 'VKS'
 local myname = {'Kirkenes Airport'}
 
 for i = 1, #myname
 do
 
 ScenEdit_SetUnitSide({side=myside,name=myname[i],newside=mynewside})
 
 end

Any help would be appreciated.

RE: LUA Command to Drop Contact

Posted: Tue Dec 14, 2021 11:05 pm
by KnightHawk75
Once you get the contact wrapper from the side in question's perspective you can just call wrapperVar:DropContact();

local c = GetContact(side='oldside',guid='TheContactGuidHere') --reminders it's not the same as unit guid.
c:DropContact()

While back you can find example of something similar:
https://www.matrixgames.com/forums/tm.asp?m=4821501 (#10 shows cleaning up the contact)