LUA Command to Drop Contact

All discussions & material related to Command's Lua interface

Moderators: RoryAndersonCDT, michaelm75au, angster, MOD_Command

Post Reply
tmoilanen
Posts: 74
Joined: Wed Oct 19, 2011 4:28 pm

LUA Command to Drop Contact

Post 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.
KnightHawk75
Posts: 1557
Joined: Thu Nov 15, 2018 7:24 pm

RE: LUA Command to Drop Contact

Post 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)
Post Reply

Return to “Lua Legion”