Skip to content

AI Control Keybinds#496

Merged
ampersand38 merged 59 commits intozen-mod:masterfrom
ampersand38:unit-control-keybinds
Mar 8, 2023
Merged

AI Control Keybinds#496
ampersand38 merged 59 commits intozen-mod:masterfrom
ampersand38:unit-control-keybinds

Conversation

@ampersand38
Copy link
Copy Markdown
Member

@ampersand38 ampersand38 commented Dec 28, 2020

When merged this pull request will:

  • Add keybinds for controlling AI near players
  • Watch Cursor: Makes all selected units watch the cursor location. Pressing this command with the cursor over a selected unit will cancel the watch target.
  • Move To Cursor: Makes all selected units move to the cursor location. Units will return to formation and waypoint afterward.
  • Toggle AI PATH: Makes all selected units start or stop moving. Does not affect aiming or shooting.
  • https://youtu.be/TcPfTkfiB9o
  • https://www.youtube.com/watch?v=ml0xGoXfGY4
  • https://youtu.be/-KCMRES5ii8

@mharis001 mharis001 added the feature Adds a new feature label Dec 29, 2020
@mharis001 mharis001 added this to the 1.10.0 milestone Dec 29, 2020
Copy link
Copy Markdown
Contributor

@neilzar neilzar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I nominate this for the best addition to Zeus award

Comment thread addons/common/functions/fnc_getCursorPosition.sqf Outdated
Comment thread addons/editor/initKeybinds.sqf
Comment thread addons/editor/initKeybinds.sqf Outdated
Comment thread addons/editor/initKeybinds.sqf Outdated
Comment thread addons/editor/initKeybinds.sqf Outdated
Comment thread addons/editor/initKeybinds.sqf Outdated
Comment thread addons/editor/initKeybinds.sqf Outdated
ampersand38 and others added 9 commits January 17, 2021 11:09
Co-authored-by: mharis001 <34453221+mharis001@users.noreply.github.com>
Watch Curator Camera
Makes selected units watch the current curator camera location. This keybind is useful when making units look at upper floors, or when you are near players inside buildings where geometry may make `getPosFromScreen` intersections a little tricky.

Force Fire
Hold to force all selected to fire their current weapon.
https://www.youtube.com/watch?v=ml0xGoXfGY4
Comment thread addons/editor/initKeybinds.sqf Outdated
Comment thread addons/editor/stringtable.xml Outdated
Comment thread addons/editor/initKeybinds.sqf Outdated
ampersand38 and others added 3 commits January 17, 2021 21:48
Co-authored-by: Neil Evers <neil.evers.1995@gmail.com>
Co-authored-by: Neil Evers <neil.evers.1995@gmail.com>
Co-authored-by: Neil Evers <neil.evers.1995@gmail.com>
@mharis001 mharis001 modified the milestones: 1.10.0, 1.11.0 Feb 3, 2021
@neilzar neilzar linked an issue Feb 25, 2021 that may be closed by this pull request
@ampersand38 ampersand38 changed the title Unit Control Keybinds AI Control Keybinds Jan 11, 2023
@ampersand38
Copy link
Copy Markdown
Member Author

Perhaps I should take the hints into a separate PR?

@mharis001
Copy link
Copy Markdown
Member

I pushed a drawHint common function that does 2D (map display) and 3D drawing and uses IDs to overwrite hints (so multiple hints are not shown for the same unit if the keybinds are used quickly - only the most recent one).

@ampersand38
Copy link
Copy Markdown
Member Author

Looks great! I think it works fine with successive inputs. There's immediate feedback for the first one(s), which is then replaced by the next.

@mharis001
Copy link
Copy Markdown
Member

The last thing I want to see done for this is remove the duplicated code between force fire and suppressive fire. Ideally, the common code would be extracted out to a separate function that both of these features can use.

Comment thread addons/common/functions/fnc_isUnitFFV.sqf Outdated
Comment thread addons/common/functions/fnc_canFire.sqf Outdated
Comment thread addons/common/functions/fnc_firstTurretUnit.sqf Outdated
@mharis001
Copy link
Copy Markdown
Member

I think this is finally good to go. I made the following changes and did some cleanup:

  • Added an is reloading check to the can fire function so that it can effectively be used to time when to fire the next shot.
  • Now using CBA_fnc_isTurnedOut for the turned out check in isUnitFFV.
  • Moved the force fire function back to common and simplified it a bit (we can look at reworking this later).
  • Finally, the keybind now uses a global event on trigger as well as release just to avoid any potential issues with different locality between a vehicle and its turret.

@ampersand38 Please look over my changes and merge when ready.

@ampersand38 ampersand38 merged commit 1679273 into zen-mod:master Mar 8, 2023
@ampersand38 ampersand38 deleted the unit-control-keybinds branch March 8, 2023 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Adds a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Manual Fire/Aim module

6 participants