Page 1 of 1

gadget: how to handle loading of enemy units

Posted: 17 Aug 2015, 22:29
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?

Re: gadget: how to handle loading of enemy units

Posted: 17 Aug 2015, 22:59
by jK
check wiki for the CMDTYPE of CMD.LOAD_UNITS

Re: gadget: how to handle loading of enemy units

Posted: 18 Aug 2015, 00:45
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