Page 1 of 1

Custom Formations

Posted: 21 Mar 2010, 17:53
by Gota
How to prevent custom formations from working on air units?
I have another widget that i want to control air units and i need custom formations to stop doing anything with air units,completely.

Re: Custom Formations

Posted: 21 Mar 2010, 20:36
by knorke
not sure if that is correct, i just looked at the widget.
There seems to be this array

Code: Select all

    -- Get units command applies to
    local mUnits = {}
where it puts units that will be affected.

So during the creation of this array the air units must be filterd out. Maybe this way?

Code: Select all

for uDefID, uIDs in pairs(units) do
			if commandApplies(0, uDefID, cmdTag and UNIT IS NOT AIR) then
The cap stuff should check if the is air by looking at a tag all air units share, like uhm no idea what this could be you probally know better.

edit
if you add

Code: Select all

and uDefs[uDefID].canFly ==false
any planes in the selection will not get the order to spread across the curvy formation line. if you just click they will fly there. crtl click works too but not line move. dont know how to fix line move sorry.

edit
wtf am i writing

Re: Custom Formations

Posted: 22 Mar 2010, 03:39
by Niobium
The easiest and friendliest way is just to set your widgets layer in :GetInfo to below that of custom formations, then return true on your widgets :MousePress if your specific criteria (i.e. only air selected) is met. This prevents custom formations 2 being informed about the mouse press and as a result it won't do anything at all.

Re: Custom Formations

Posted: 22 Mar 2010, 09:50
by zwzsg
No, because when both planes and kbots are selected, you probably still want kbots to use custom formation.

Re: Custom Formations

Posted: 22 Mar 2010, 09:54
by Gota
Problem Solved due to some other advice niobium game me,thx all.

Re: Custom Formations

Posted: 22 Mar 2010, 13:13
by manolo_
release your widget version please, i think it might be very usefull

Re: Custom Formations

Posted: 22 Mar 2010, 13:26
by Gota
nothing special my CF was outdated and the newest version works fine.

Re: Custom Formations

Posted: 23 Mar 2010, 17:44
by Gota
No,I didn't test enough.
Both widgets til ldont work together.
I get this error :
[ 310] Giving 5 armfig to team 0
[ 468] <CustomFormations2> Conflict detected with Air Formation widget on MOVE command, expect anomalies
[ 552] <CustomFormations2> Conflict detected with Air Formation widget on MOVE command, expect anomalies
[ 624] <CustomFormations2> Conflict detected with Air Formation widget on MOVE command, expect anomalies

Re: Custom Formations

Posted: 23 Mar 2010, 18:54
by Pako
Gota wrote:No,I didn't test enough.
Both widgets til ldont work together.
I get this error :
[ 310] Giving 5 armfig to team 0
[ 468] <CustomFormations2> Conflict detected with Air Formation widget on MOVE command, expect anomalies
[ 552] <CustomFormations2> Conflict detected with Air Formation widget on MOVE command, expect anomalies
[ 624] <CustomFormations2> Conflict detected with Air Formation widget on MOVE command, expect anomalies
3rd message in this page seems 100% related to this problem.

Re: Custom Formations

Posted: 10 Apr 2010, 10:34
by Gota
My air formation widget does not use the mousepress function.
Should i add it just so that it would block the mouse detection in custom formations?
the layer in my widget is lower than in custom formations.

the widget

http://pastebin.com/uftHZHKq

Re: Custom Formations

Posted: 10 Apr 2010, 13:22
by Niobium
To stop the lines being drawn you would handle mousepress.

To handle single-click only, you would use CommandNotify (as you have), which would work fine except that custom formations likes to send out fake commandnotifies which screw it up nicely.

I'll be releasing a new custom formations within a few days which fixes quite a few things, mainly related to faked and incorrect CommandNotifys. It'll let your current widget as-is work fine with single-click, but you'll still need the mousepress part to prevent lines being drawn.

Re: Custom Formations

Posted: 10 Apr 2010, 13:33
by Gota
I dont mind the lines.