Page 1 of 1

Simulate VBSS, capture of enemy airport & vehicles

Posted: Fri Dec 20, 2019 1:58 pm
by TYHo
Hi everyone, how would you use lua to simulate VBSS fast-roping onto a unfriendly vessel and taking control of it? E.g. helo remains in an area for 1min, and the vessel would than change to player side? Thanks! [;)]

RE: Simulate VBSS

Posted: Sat Dec 21, 2019 5:17 am
by michaelm75au
You would need an action where the unit side was changed to capturing side.

ScenEdit_SetUnitSide({side=oldSide, Name=unitToChange, newside=newSide})

RE: Simulate VBSS

Posted: Sat Dec 21, 2019 9:05 pm
by TYHo
Thanks for replying! Would such a script be correct? For e.g.

ScenEdit_SetUnitSide(side='Iran', Name='Very Large Crude Carrier', newside='UK')

What parameters am I missing?

RE: Simulate VBSS

Posted: Sat Dec 21, 2019 10:39 pm
by michaelm75au
That looks okay. However the name has to be unique for it to work properly.

RE: Simulate VBSS

Posted: Sat Dec 21, 2019 10:56 pm
by michaelm75au
Also you can use the GUID of the actual unit in place of 'Name'
ScenEdit_SetUnitSide(oldside='Iran', guid='4503e1fa-b6be-43c0-87bf-a602dded4001', newside='UK')

RE: Simulate VBSS

Posted: Sun Dec 22, 2019 1:44 am
by Rory Noonan
This scenario I made a while back has pretty solid VBSS mechanics; you can also 'shoot out the engine' from Coast Guard helos to slow fast boats down.

https://www.matrixgames.com/forums/tm.asp?m=4690352

RE: Simulate VBSS

Posted: Sun Dec 22, 2019 11:43 am
by TYHo
Thanks guys! Esp. apache85... I will take a look at your scenario and see I can figure out the LUAs through 'reverse engineering'! [;)]

RE: Simulate VBSS

Posted: Sun Dec 22, 2019 10:17 pm
by Rory Noonan
Let us know here if you need any help with it [:)]

RE: Simulate VBSS

Posted: Mon Dec 23, 2019 8:23 am
by TYHo
Thanks for your patience and kind offer to help, mate! This old dog really has trouble learning new LUA tricks... [&:] Anyway I have attached a simple creation with objectives to capture enemy airport, tank, and vessel... can I trouble you to take a look and help me correct and improve the event LUA scripts? Thanks! [;)]

RE: Simulate VBSS

Posted: Tue Dec 24, 2019 3:40 am
by Rory Noonan
There's only an .ini file in that zip, I'll need the .scen file to help [:)]

RE: Simulate VBSS

Posted: Tue Dec 24, 2019 5:52 am
by TYHo
Oh yes... Oops! Here you go, thanks! And I looked through your scenario and noticed you used 'Special Action' extensively... I don't know how to link that to the Lua Trigger actually... [:(]

RE: Simulate VBSS

Posted: Tue Dec 24, 2019 7:10 am
by Rory Noonan
I'm not able to look at the .scen file tonight (although I plan to tomorrow), but on Special Actions they are basically Lua scripts that are executed on demand. You can access them (in the editor) through Editor > Event Editor > Special Actions. They're side specifc, so keep that in mind. There is no trigger for them apart from the player activating them through the special action menu.

Very under-utilised in my opinion, nearly all of the scenarios I've made use at least one and often 4-5. I don't recall actually seeing them in any other scenarios though!

RE: Simulate VBSS

Posted: Tue Dec 24, 2019 9:17 pm
by Whicker
you are missing the curly brackets - and the air base one the name is incorrect:

ScenEdit_SetUnitSide({oldside='Red', Name='Building (Airport Terminal)', newside='Blue'})

you can run that in the lua console, move time forward and it should change. Then you can update the code in the action (after you reverse it to put it back).

On the helo one you can also check the speed and altitude to only do it if the helo is hovering and at low alt.

RE: Simulate VBSS

Posted: Wed Dec 25, 2019 1:48 am
by TYHo
Awesome Whicker, got it, Thanks! How do you 'force' the helo to be hovering at low alt? Set it as a Condition?
ORIGINAL: Whicker

you are missing the curly brackets - and the air base one the name is incorrect:

ScenEdit_SetUnitSide({oldside='Red', Name='Building (Airport Terminal)', newside='Blue'})

you can run that in the lua console, move time forward and it should change. Then you can update the code in the action (after you reverse it to put it back).

On the helo one you can also check the speed and altitude to only do it if the helo is hovering and at low alt.

RE: Simulate VBSS

Posted: Thu Dec 26, 2019 3:46 am
by Whicker
I think you could do it as a condition, but you can just do it in the action itself.

I think the helo will trigger the action right? the unit that triggers an action is called UnitX and can be set to a variable:

local u = ScenEdit_UnitX ()

then you can test to see if u.altitude and or u.speed are equal to whatever you want them to be. If so then run your other code, if not then don't.

RE: Simulate VBSS

Posted: Fri Dec 27, 2019 12:11 pm
by TYHo
Thanks! I'll give it a try... [;)]