Request - Lua Function - GetUnitSide

Take command of air and naval assets from post-WW2 to the near future in tactical and operational scale, complete with historical and hypothetical scenarios and an integrated scenario editor.

Moderator: MOD_Command

Post Reply
zaytsev
Posts: 99
Joined: Mon Jun 16, 2014 6:03 am

Request - Lua Function - GetUnitSide

Post by zaytsev »

Could you please implement function to get a side from units with some name/guid.

Currently you can only set/change side if old side is known, but if it is unknown it could be useful for some (if) statement where you want
to pull unit(s) from not new side (could be more then one/even with same name) and then set output to new side.

I guess it is simple, no?

Thanks
RoryAndersonCDT
Posts: 1826
Joined: Mon Jun 15, 2009 11:45 pm

RE: Request - Lua Function - GetUnitSide

Post by RoryAndersonCDT »

Command Dev Team
Technical Lead
zaytsev
Posts: 99
Joined: Mon Jun 16, 2014 6:03 am

RE: Request - Lua Function - GetUnitSide

Post by zaytsev »

Worked like a charm.

Code: Select all

 a = ScenEdit_GetUnit({name="Big Gas #4"})
 sidename = a.side 
 print (sidename)
 

.. but it fetches only first unit encountered in given parameters, okay for guid, but if only name was given and there are, maybe by an error
or deliberately, two or more units with the same name or in given parameters only one will be in output,

I was thinking more like to display incremental output as a list, if more units are in the same parameters, let's say to search for duplicates ;)

Thank you.

Post Reply

Return to “Command: Modern Operations series”