gadget: how to handle loading of enemy units

gadget: how to handle loading of enemy units

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
jamerlan
Balanced Annihilation Developer
Posts: 683
Joined: 20 Oct 2009, 13:04

gadget: how to handle loading of enemy units

Post by jamerlan »

Hi!

I want to prevent loading of enemy units with level 2 transports and allow loading with t1 transports.
I have a gadget for that: http://pastebin.com/FXS9LjD0

when I give a single loading command I can intercept it in "gadget:AllowCommand" function and I have unit_id in cmdParams[1] - easy to understand that unit is enemy and t2 transport is selected => easy to allow/not allow

When I give area load for trans I have these as cmdParams for gadget:allowCommand:
1: 5109.23046875
2: 121.40710449219
3: 7735.2333984375
4: 197.80801391602

It means I can't understand - is trans going to nap ally or enemy unit. So I cant cancel "load" command for some units. How to filter only ally units in this case?
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: gadget: how to handle loading of enemy units

Post by jK »

check wiki for the CMDTYPE of CMD.LOAD_UNITS
User avatar
jamerlan
Balanced Annihilation Developer
Posts: 683
Joined: 20 Oct 2009, 13:04

Re: gadget: how to handle loading of enemy units

Post by jamerlan »

I checked and I see this:
CMDTYPE.ICON_UNIT_OR_AREA
expect 1 parameter in return (unitid) or 4 parameters in return (mappos+radius)
it only confirms my observations. But my question was: in case of area - how to filter some units from loading? just when command was issued.

I know at least 3 widget with this issue in different games. And this case is not handled/fixed in these widgets
Post Reply

Return to “Lua Scripts”