Changing mouse order behavior. Single target vs area command
Moderator: Moderators
Changing mouse order behavior. Single target vs area command
It is hard to target a specific moving unit with an attack command because if I press the mouse button and move the mouse at the same time, I will get an attack circle.
How can I make it easier to target moving units?
Could a widget change the mouse order behavior?
How can I make it easier to target moving units?
Could a widget change the mouse order behavior?
- Silentwings
- Posts: 3720
- Joined: 25 Oct 2008, 00:23
Re: Changing mouse order behavior. Single target vs area com
I assume you're using CustomFormations2? That's the one that does the area command that way.
You could try to find an older version of CF2 that doesn't make attack + move an area command.
You could try to find an older version of CF2 that doesn't make attack + move an area command.
- Silentwings
- Posts: 3720
- Joined: 25 Oct 2008, 00:23
Re: Changing mouse order behavior. Single target vs area com
Area attack circles are drawn by the engine. Custom formations only deals with line commands.
Re: Changing mouse order behavior. Single target vs area com
That only works for "select", right?Silentwings wrote:Maybe this viewtopic.php?f=11&t=33173 ?
I tried:
bind z attack FromMouse_50++_ClearSelection_SelectNum_1+
but that only gave me a regular attack command.
- Silentwings
- Posts: 3720
- Joined: 25 Oct 2008, 00:23
Re: Changing mouse order behavior. Single target vs area com
I'm afraid I don't know, I've never messed with uikeys much. I think what I linked to is only for select, but maybe it can be modified.
If not, it's certainly possible (and might actually be easier) to write a widget that, when you click to attack ground, looks to see if there is a unit nearby within small radius and attacks that instead.
If not, it's certainly possible (and might actually be easier) to write a widget that, when you click to attack ground, looks to see if there is a unit nearby within small radius and attacks that instead.
Re: Changing mouse order behavior. Single target vs area com
viewtopic.php?f=11&t=33173 is about SelectionKeys.txt, it is only about selecting things.
https://github.com/spring/spring/blob/d ... onKeys.txt
---
You have some units selected and want to give an attack-order on enemy unit.
When you do the right-click on the enemy you drag the mouse a bit because clumsy fingers and it ends up as an area-attack around the unit? And that is bad because now too many enemy units are inside the attack-circle...?
One idea might be that area-attacks with very small radius get converted to attacks on single unit.
This widget test detects area-attacks and if radius is too small then it ignores the command and instead gives new single-unit attack cmd.
https://github.com/spring/spring/blob/d ... onKeys.txt
---
I understand like this:It is hard to target a specific moving unit with an attack command because if I press the mouse button and move the mouse at the same time, I will get an attack circle.
You have some units selected and want to give an attack-order on enemy unit.
When you do the right-click on the enemy you drag the mouse a bit because clumsy fingers and it ends up as an area-attack around the unit? And that is bad because now too many enemy units are inside the attack-circle...?
One idea might be that area-attacks with very small radius get converted to attacks on single unit.
This widget test detects area-attacks and if radius is too small then it ignores the command and instead gives new single-unit attack cmd.
Code: Select all
function widget:GetInfo()
return {
name = "no small area attack",
layer = 0,
enabled = true,
}
end
local minRadius = 200
function widget:CommandNotify(cmdId, cmdParams, cmdOpts)
if cmdId == CMD.ATTACK then
if #cmdParams==4 and cmdParams[4] < minRadius then --x,z,y,radius => it is area attack
local targets = Spring.GetUnitsInCylinder(cmdParams[1],cmdParams[3],cmdParams[4],Spring.ENEMY_UNITS)
for _,unitID in pairs(Spring.GetSelectedUnits()) do
Spring.GiveOrderToUnit (unitID, CMD.ATTACK, {targets[1]}, cmdOpts)
end
return true
end
end
return false
end
Re: Changing mouse order behavior. Single target vs area com
It doesn't work well on airplanes. Probably because the cylinder just extends upwards and if the camera is tilted, the plane might be missed completely.8611 wrote:This widget test detects area-attacks and if radius is too small then it ignores the command and instead gives new single-unit attack cmd.
Also if there is a group of enemies you might not get the intended target even if it is is closest to the mouse cursor.
Maybe it would work well if you could check which unit that is closest to the mouse cursor and ignore the cylinder entirely.
Re: Changing mouse order behavior. Single target vs area com
1) I think when dragging the area-circle the mouse would be at outside, far away from wanted target.which unit that is closest to the mouse cursor
Maybe instead: "which unit is clostest to center of circle"?
2) on aircraft: The mouse moves in 2D but aircraft move in 3D.
So "closest to the mouse cursor" is tricky and might not always give desired result.
Imo user needs a way to specify if the mouseclick are aimed on a high-flying bomber or at the unit underneath. On screen it might be five pixels difference, but in 3D world both units are maybe 500 elmos apart.
Perhaps instead you want something entirely different:
'Hold this key and area-attack will only target aircraft' ?
Re: Changing mouse order behavior. Single target vs area com
I think that people who tries to target a moving unit will naturally try to move the mouse cursor with the motion of the unit.8611 wrote:1) I think when dragging the area-circle the mouse would be at outside, far away from wanted target.
Maybe instead: "which unit is clostest to center of circle"?
There are 2 events that happen when you click the mouse:
Mouse button press and mouse button release.
Mouse press happens first and is where the center of the circle is.
Mouse release happens later and is how large the circle becomes.
This means that you have to first press the mouse infront of the unit and then release it as the unit passes the center of the circle. This is pretty hard to do on fast moving units.
Also the size of the circle is irrelevant as it is only matter how close the unit is to the middle of the circle if you are trying to target a specific unit out of many.
You don't really need to specify if you are aiming on a high flying bomber or at unit underneath because if you want to target the the bomber you just click on it which doesn't really work now. If you want to target the ground unit you can move the camera so that the bomber doesn't obscure the ground unit.8611 wrote:2) on aircraft: The mouse moves in 2D but aircraft move in 3D.
So "closest to the mouse cursor" is tricky and might not always give desired result.
Imo user needs a way to specify if the mouseclick are aimed on a high-flying bomber or at the unit underneath. On screen it might be five pixels difference, but in 3D world both units are maybe 500 elmos apart.
Useful but a tilted camera makes it a little hard to target airplanes with the default cylindrical area attacks. But it would still be really helpful to be able to only attack targets of either ground or air.8611 wrote:Perhaps instead you want something entirely different:
'Hold this key and area-attack will only target aircraft' ?
Basically I just wants the same functionality as this FromMouse_50++_FromMouse_50++_ClearSelection_SelectNum_1+
where FromMouse_50+ where is distance from the mouse visually in pixels or something like that.
Re: Changing mouse order behavior. Single target vs area com
What i never got is - why there are unused commands..
For example, i can click guard a unit and the folllow up commandos are what? commands to execute relative to the guarded unit when it is attacked?
Fallbacks when it is destroyed?
Why not be honest- by the time they get executed, they are outdated junk. And so- everything happening after a guard command is basically useless..
That is one of the reasons why i added TacZones in the first place..
For example, i can click guard a unit and the folllow up commandos are what? commands to execute relative to the guarded unit when it is attacked?
Fallbacks when it is destroyed?
Why not be honest- by the time they get executed, they are outdated junk. And so- everything happening after a guard command is basically useless..
That is one of the reasons why i added TacZones in the first place..
Re: Changing mouse order behavior. Single target vs area com
What is TacZones?PicassoCT wrote:That is one of the reasons why i added TacZones in the first place..
Re: Changing mouse order behavior. Single target vs area com
Yup.PicassoCT wrote:For example, i can click guard a unit and the folllow up commandos are what?
Fallbacks when it is destroyed?
Once the guarded unit is destroyed the guard will move on to next command.
My hate-favorite are constructors: give several buildorders, one order is guard the factory - but "guarding the factory" never ends and the constructor never moves on. Bit annoying but imo "user-error."
So basically instead of tiny precise pointer that needs to click directly on target want a big fat pointer that just needs to click near the target?Godde wrote:Basically I just wants the same functionality as this FromMouse_50++_FromMouse_50++_ClearSelection_SelectNum_1+
where FromMouse_50+ where is distance from the mouse visually in pixels or something like that.
The ground/air targeting thing sounds bit what "Area attack tweak" does in zero-K: automatically filter out ground target for AA units.
Re: Changing mouse order behavior. Single target vs area com
Maybe. Although I'd prefer if I could just not make an attack circle when clicking and moving the mouse and having the target get selected on mouse button release even if I move the mouse. Alternatively the target could be selected on mouse button press.8611 wrote:So basically instead of tiny precise pointer that needs to click directly on target want a big fat pointer that just needs to click near the target?Godde wrote:Basically I just wants the same functionality as this FromMouse_50++_FromMouse_50++_ClearSelection_SelectNum_1+
where FromMouse_50+ where is distance from the mouse visually in pixels or something like that.
Re: Changing mouse order behavior. Single target vs area com
Made a widget to target unit on mouse button release. viewtopic.php?f=23&t=33275&p=567663#p567663
I think I'm gonna use this in all the games i play.
I think I'm gonna use this in all the games i play.
Code: Select all
function widget:GetInfo()
return {
name = "Attack target on mouse release",
desc = "attacks specific target under mouse cursor on mouse button release",
author = "Godde",
date = "Mar 14, 2015",
license = "No license",
enabled = true
}
end
local TraceScreenRay = Spring.TraceScreenRay
local GetMouseState = Spring.GetMouseState
function widget:CommandNotify(cmdId, cmdParams, cmdOpts)
if cmdId == CMD.ATTACK then
if #cmdParams==4 then -- if area attack
local mx, my = GetMouseState()
local mouseTargetType, mouseTarget = TraceScreenRay(mx, my)
if mouseTargetType == "unit" then
for _,unitID in pairs(Spring.GetSelectedUnits()) do
Spring.GiveOrderToUnit (unitID, CMD.ATTACK, {mouseTarget}, cmdOpts)
end
return true
end
end
end
return false
end
Re: Changing mouse order behavior. Single target vs area com
Godde wrote:What is TacZones?PicassoCT wrote:That is one of the reasons why i added TacZones in the first place..
Basically - you can place three types of zones on the battlefield. Triggerzones, which activate actionzones connected to them, once a enemy steps inside. Actionzones, which store commands, just like a unit would. Finally Reservoirezones, which is the place where the units stand around that wait for the enemy to come.
It allows for example to make triggered patrolls, with a return to the reservoirzone.
Or automated counterattacks.
Its still pretty hacky (uses invisible units for the zones) but it works
Re: Changing mouse order behavior. Single target vs area com
I like that: like the Art of War with the different grounds.
Re: Changing mouse order behavior. Single target vs area com
TacZones sounds interesting. I have always wanted to do something similar. Mm... I searched for TacZones but couldn't find anything on the forum except for this thread. Do you have a link?
Is it a game? I searched on youtube but couldn't find anything specific. Do you have an example?Jools wrote:I like that: like the Art of War with the different grounds.
Re: Changing mouse order behavior. Single target vs area com
It's a book, I recommend it warmly. Here's the part covering the grounds:
http://suntzusaid.com/book/11
For example:
http://suntzusaid.com/book/11
For example:
7
When an army has penetrated into the heart of a hostile country, leaving a number of fortified cities in its rear, it is serious ground.
Re: Changing mouse order behavior. Single target vs area com
Lol, yeah. I know it is a book. But I thought it was some game that had a proper zone control UI.