Change unit side help.

All discussions & material related to Command's Lua interface

Moderators: RoryAndersonCDT, michaelm75au, angster, MOD_Command

Post Reply
rmunie0613
Posts: 202
Joined: Tue Jan 02, 2018 7:41 pm

Change unit side help.

Post by rmunie0613 »

Hello all.
I am trying to accomplish the following, and I see the "change unit side" function but cannot seem to make it work ***when*** I need.

Situation desired: When a unit from Side A (Blufor) gets to position XYZ inside an airbase and remains for 30 minutes, the base changes hands to BLUFOR.
On changing hands it is still considered unusable (simulating the fact you cannot usually simply walk in, and have your own side's technical needs met) but slowly over the next few hours, wish to make it usable, first to simply refuel a/c, then to fully operate as refuel/rearm/etc.

I have also tried to make something like this work with pirate vessels "seizing" merchants..
What keeps happening however is the base/ship just remain as REDFOR.
Obviously I am not understanding one of the steps required.
Any help appreciated[:)]
User avatar
michaelm75au
Posts: 12463
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: Change unit side help.

Post by michaelm75au »

Sounds like you need something where the facilities of the base slowly change hands rather than the whole base (assuming you aren't using a single unit base).
Like:
1. the airbase group itself changes to REDFOR
2. the units in the group changes to a 'hidden' side
3. and then switch the hidden side units to REDFOR as time goes on by a timing event.
Michael
rmunie0613
Posts: 202
Joined: Tue Jan 02, 2018 7:41 pm

RE: Change unit side help.

Post by rmunie0613 »

You may very well be onto something- I had not even considered an "in-between" change of sides-
User avatar
michaelm75au
Posts: 12463
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: Change unit side help.

Post by michaelm75au »

I am trying to create an example scenario of this, but the change side is not being friendly to me for some reason. Trying to determine if a defect introduced by something, or just me forgetting how it works.[:D]
Michael
thewood1
Posts: 10364
Joined: Sun Nov 27, 2005 6:24 pm
Location: Boston

RE: Change unit side help.

Post by thewood1 »

I have been using change side with no issues in 1.14. Granted its a very simple implementation, but it works.
User avatar
michaelm75au
Posts: 12463
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: Change unit side help.

Post by michaelm75au »

A simple example - not too complex.
I had to code around a defect - SetUnitSide() on a group doesn't put the group in to the new side's list. I have added a fix for the future.
Load up.
Move one of the Chinese infantry units towards the base.
After one hour near the base, the base will change hands, and the attached units (except one) will become neutral.
Then every 5 minutes, one of the units will be attached back to the base.
Attachments
baseassault2.zip
(15.09 KiB) Downloaded 27 times
Michael
rmunie0613
Posts: 202
Joined: Tue Jan 02, 2018 7:41 pm

RE: Change unit side help.

Post by rmunie0613 »

Excellent, Thank you
AlphaSierra
Posts: 132
Joined: Mon Feb 13, 2017 9:35 am

RE: Change unit side help.

Post by AlphaSierra »

Hi Michael;

I used your example to invade an island with a port and an airfield, works awesome, except it looks as though they did not leave the keys to the Submarine or aircraft when I invaded like I'd hoped.

Is not being able to use the newly acquired hardware normal behavior? How would we make them available?

Thanks,

HP
I wish to have no connection with any ship that does not sail fast; for I intend to go in harm's way. -John Paul Jones
User avatar
michaelm75au
Posts: 12463
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: Change unit side help.

Post by michaelm75au »

Can you upload a save or scenario file? Are you changing the side of the unit which I assume is being 'hosted' by one of the facilities?
Michael
AlphaSierra
Posts: 132
Joined: Mon Feb 13, 2017 9:35 am

RE: Change unit side help.

Post by AlphaSierra »

Notice the cargo on the pier can be unloaded and used by the Red side after the "assault"
Attachments
SanNicolasAssult.zip
(76.07 KiB) Downloaded 17 times
I wish to have no connection with any ship that does not sail fast; for I intend to go in harm's way. -John Paul Jones
User avatar
michaelm75au
Posts: 12463
Joined: Sat May 05, 2001 8:00 am
Location: Melbourne, Australia

RE: Change unit side help.

Post by michaelm75au »

You need to also change the side of the hosted aircraft and boats.
Michael
Post Reply

Return to “Lua Legion”