Custom Formations

Custom Formations

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

Moderator: Moderators

Post Reply
User avatar
Gota
Posts: 7151
Joined: 11 Jan 2008, 16:55

Custom Formations

Post 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.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: Custom Formations

Post 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
User avatar
Niobium
Posts: 456
Joined: 07 Dec 2008, 02:35

Re: Custom Formations

Post 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.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Custom Formations

Post by zwzsg »

No, because when both planes and kbots are selected, you probably still want kbots to use custom formation.
User avatar
Gota
Posts: 7151
Joined: 11 Jan 2008, 16:55

Re: Custom Formations

Post by Gota »

Problem Solved due to some other advice niobium game me,thx all.
User avatar
manolo_
Posts: 1370
Joined: 01 Jul 2008, 00:08

Re: Custom Formations

Post by manolo_ »

release your widget version please, i think it might be very usefull
User avatar
Gota
Posts: 7151
Joined: 11 Jan 2008, 16:55

Re: Custom Formations

Post by Gota »

nothing special my CF was outdated and the newest version works fine.
User avatar
Gota
Posts: 7151
Joined: 11 Jan 2008, 16:55

Re: Custom Formations

Post 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
Pako
Posts: 174
Joined: 12 Jul 2009, 18:57

Re: Custom Formations

Post 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.
User avatar
Gota
Posts: 7151
Joined: 11 Jan 2008, 16:55

Re: Custom Formations

Post 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
User avatar
Niobium
Posts: 456
Joined: 07 Dec 2008, 02:35

Re: Custom Formations

Post 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.
User avatar
Gota
Posts: 7151
Joined: 11 Jan 2008, 16:55

Re: Custom Formations

Post by Gota »

I dont mind the lines.
Post Reply

Return to “Lua Scripts”