Page 1 of 1

formation movement

Posted: 30 Nov 2009, 17:02
by Gota
http://pastebin.com/md777a1

This is the CustomFormations widget.
Can anyone please modify it so that when air units are selected they would always move in formation(ATM this is done by pressing the right mouse button with ctrl) instead of moving regularly.
Basically switch the right click with the right click+ctrl for air units.

when you draw a line for them they shoul just move to it and on it as usual.

Re: formation movement

Posted: 30 Nov 2009, 18:27
by CarRepairer
Gota wrote:http://pastebin.com/md777a1

This is the CustomFormations widget.
Can anyone please modify it so that when air units are selected they would always move in formation(ATM this is done by pressing the right mouse button with ctrl) instead of moving regularly.
Basically switch the right click with the right click+ctrl for air units.

when you draw a line for them they shoul just move to it and on it as usual.
What you're asking for has nothing to do with the customformations widget, however it's very simple to do as its own widget.

I'll write it for you in exchange for the following task:

I want you to create for me 65 spring maps. The first map will have 2^0 islands (1 island). The second will have 2^1 islands (2 islands). The third will have 2^2 islands (4 islands). The fourth will have 2^3 islands (8 islands). The fifth will have 2^4 islands (16 islands). And so on until you reach a map with 2^64 islands for the greatest FFA experience ever.

Re: formation movement

Posted: 30 Nov 2009, 18:31
by Gota
Oo

Re: formation movement

Posted: 30 Nov 2009, 21:12
by Argh
I think you should ask him to double that rice grain a few more times, myself. Ooh, obscure math joke!

Re: formation movement

Posted: 30 Nov 2009, 22:57
by CarRepairer
Argh wrote:I think you should ask him to double that rice grain a few more times, myself. Ooh, obscure math joke!
Yay, you caught it!

(The other joke referenced here is an exchange between OP and I that I'd write him a gadget and he'd make me a map. The gadget I made for him didn't function properly in the end and the map he made me was nothing like I asked for.)

Re: formation movement

Posted: 01 Dec 2009, 01:25
by Tribulex
* cough * cough * cough *

Image

* cough * cough * cough *

Re: formation movement

Posted: 01 Dec 2009, 06:01
by AF
No be messin with ma colour scheme!

Re: formation movement

Posted: 01 Dec 2009, 06:19
by Niobium
Just a note that the link to custom formations 2 in original post is terribly out of date.
"Basically switch the right click with the right click+ctrl for air units."
But what if you wanted them to move onto that spot? To keep this functionality you would need a way to toggle between the two options, for example the control key.. Oh hey that's how it is already, problem solved.

Re: formation movement

Posted: 01 Dec 2009, 15:35
by Gota
Niobium wrote:Just a note that the link to custom formations 2 in original post is terribly out of date.
"Basically switch the right click with the right click+ctrl for air units."
But what if you wanted them to move onto that spot? To keep this functionality you would need a way to toggle between the two options, for example the control key.. Oh hey that's how it is already, problem solved.
If you will try you will notice it is very frustrating to give multiple way point commands in the heat of battle when you have to press both shift and ctrl.
To make it convenient i need the default one to be formation move.
Even if there is no way to switch between the 2,and the default is formation move you can always draw a tiny line instead of right clicking.

Re: formation movement

Posted: 02 Dec 2009, 00:27
by lurker
Is it that obscure? Anyway, Car, I'll make those maps if you promise you'll use them.

Re: formation movement

Posted: 02 Dec 2009, 01:10
by CarRepairer
No need. I'll make this widget, it's not a bad idea.

Re: formation movement

Posted: 02 Dec 2009, 04:03
by Tribulex
Gota wrote:If you will try you will notice it is very frustrating to give multiple way point commands in the heat of battle when you have to press both shift and ctrl.

When have your battles been seeing any heat?

Also, shift and ctrl are right next to eachother on pretty much every keyboard layout.

Re: formation movement

Posted: 02 Dec 2009, 05:03
by CarRepairer
Not sure if you wanted it to apply only if all the selected units are air, or if some of them are. This works only if they all are.

Code: Select all

function widget:GetInfo()
  return {
    name      = "Air Formation",
    desc      = " v0.01 If all selected units fly, move order assigns formation by default.",
    author    = "CarRepairer",
    date      = "2009-12-01",
    license   = "GNU GPL, v2 or later",
    layer     = 0,
    enabled   = true
  }
end

local echo = Spring.Echo

local function AllFlying()
	local selectedUnits = Spring.GetSelectedUnits()
	for _, unitID in ipairs(selectedUnits) do

		local unitDefID = Spring.GetUnitDefID(unitID)
		local ud = UnitDefs[unitDefID]

		if not ud.canFly then
			return false
		end
	end
	return true
end

function widget:CommandNotify(cmdID, cmdParams, cmdOptions)
	
	if cmdID == CMD.MOVE then
		if not AllFlying() then
			return false
		end
		
		local opts = {'ctrl'}
		if (cmdOptions.alt)   then table.insert(opts, "alt")   end
		if (cmdOptions.shift)  then table.insert(opts, "shift")  end
		if (cmdOptions.right) then table.insert(opts, "right") end
		Spring.GiveOrder(CMD.MOVE, cmdParams, opts)
		return true
	end
	return false
	
end

Re: formation movement

Posted: 02 Dec 2009, 09:05
by Gota
Will try as soon as i get back home.thx.

Re: formation movement

Posted: 02 Dec 2009, 09:14
by Gota
Would this work fine with a large number of aircraft?by the way what if they are given a patrol command and fight command?will they move in formation?cause patrol and fight commands are used a lot with air maybe even more than move.

Re: formation movement

Posted: 02 Dec 2009, 16:59
by CarRepairer
Gota wrote:Would this work fine with a large number of aircraft?by the way what if they are given a patrol command and fight command?will they move in formation?cause patrol and fight commands are used a lot with air maybe even more than move.
Message me on the lobby with how you want this to work exactly. It can work with whatever commands you choose.

Re: formation movement

Posted: 02 Dec 2009, 22:24
by Gota
Ill try to catch you online but in general id like them to move in formation in as many occasions and commands as possible.