Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to set aiming coefficient for mission scripting. #5828

Merged
merged 6 commits into from May 16, 2018

Conversation

xrufix
Copy link
Contributor

@xrufix xrufix commented Nov 29, 2017

When merged this pull request will:

  • Add function ace_common_fnc_setAimCoef. This is a partial copy of the setHearingCapability function and allows for scripts to raise the aiming coefficient (weapon sway) above the current value. The highest value set will be applied. It is designed so that scripts can simulate stress, fear, suppression and other mental or physical conditions that will likely reduce a soldier's ability to aim correctly.
  • Make ace_advanced_fatigue_fnc_handleEffects use the above-mentioned function instead of setCustomAimCoef.

I would however prefer a framework for similar functionality (having a max/min setting that can be set by different functions/scripts).

*/
#include "script_component.hpp"

params ["_unit","_id", "_setting", ["_add", true]];
Copy link
Contributor

Choose a reason for hiding this comment

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

Space after ["_unit",.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@PabstMirror
Copy link
Contributor

@jlillis @xrufix any thoughts on this PR and #5773

They both do similar but different things to the same system.
Do we need both or would just adding the linear scaling factor in 5773 be enough?

I don't think it's a problem to add both (will be some minor merge conficts but should be easy to resolve)

@PabstMirror PabstMirror added the kind/enhancement Release Notes: **IMPROVED:** label Nov 30, 2017
@PabstMirror PabstMirror added this to the Ongoing milestone Nov 30, 2017
@jlillis
Copy link
Contributor

jlillis commented Dec 1, 2017

I think it would be better to modify #5773 so that when swayFactor is 0, advanced fatigue does not update setCustomAimCoef anymore. This would allow mission makers to customize the aiming coefficient in their own scripts.

@xrufix
Copy link
Contributor Author

xrufix commented Dec 1, 2017

I think #5773 does something different. It will enable mission editors to change the impact of fatigue on weapon sway, not weapon sway itself (at least, not directly). It adds a factor which is multiplied with fatigues current setting. E.g. when you want to setCustomAimCoef 6, while standing still with no fatigue you would use a factor of 4. But when the player runs a bit this high factor will produce ridiculy high values.

My proposed solution does instead affect weapon sway directly. By checking for the highest set weapon sway, it produces more reliable and predictable results if a certain AimCoef is desired.

Merging and keeping both could be easily done and would imho be the best solution.

* Handle set AimCoef calls. Will use highest available setting.
*
* Arguments:
* 0: unit <OBJECT>
Copy link
Member

Choose a reason for hiding this comment

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

Unit

*
* Arguments:
* 0: unit <OBJECT>
* 1: id <STRING>
Copy link
Member

Choose a reason for hiding this comment

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

ID

* Arguments:
* 0: unit <OBJECT>
* 1: id <STRING>
* 2: settings <NUMBER>
Copy link
Member

Choose a reason for hiding this comment

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

Settings and maybe add a note in () describing what exactly is meant.

* 0: unit <OBJECT>
* 1: id <STRING>
* 2: settings <NUMBER>
* 3: add [true] OR remove [false] (default: true) <BOOL>
Copy link
Member

Choose a reason for hiding this comment

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

Add (true) or remove (false) <BOOL> (default: true)

@xrufix
Copy link
Contributor Author

xrufix commented Apr 10, 2018

@jonpas Requested changes addressed. I also changed the file where i copy-pasted from.

@commy2 commy2 modified the milestones: Ongoing, 3.13.0 May 16, 2018
@commy2 commy2 merged commit d6a88ac into acemod:master May 16, 2018
@xrufix
Copy link
Contributor Author

xrufix commented May 18, 2018

@commy2 This really needs #5773 to be merged (keeping my changes to fnc_handleEffects.sqf), otherwise GVAR(swayFactor) is undefined.

@commy2
Copy link
Contributor

commy2 commented May 19, 2018

Easy fix :)

@PabstMirror PabstMirror modified the milestones: 3.13.0, 3.12.3 Jul 5, 2018
@Tee-ee-ee
Copy link

Tee-ee-ee commented Dec 27, 2018

Sorry for digging the old post, but has this issue been solved? If so, what is currently the correct way to set the custom aim coefficient?
I pull the "Sway Factor" in ACE advanced fatigue all the way down to 0; then in the editor I put this in my player's init:
this setCustomAimCoef 0;
But I still get sway. The only valid way for the time being seems to completely disable the advanced fatigue to get no sway. Wondering if this is supposed to be the way to do it?

Update:
The problem seems to be in the fnc_setAimCoef.sqf line 24
it seems to make the lowest CustomAimCoef to be 1. Anything set lower than 1 using setCustomAimCoef will be overwritten to 1 cuz the script chooses the maximal value between the given number and 1.
It will be great if this minimum value can be adjusted via CBA settings such that mission makers can set custom sway values such as 50% sway, 25% sway, etc

@xrufix
Copy link
Contributor Author

xrufix commented Jan 2, 2019

@Tee-ee-ee Please open a new issue to adress this.

BaerMitUmlaut pushed a commit that referenced this pull request Aug 5, 2019
Add ability to set aiming coefficient for mission scripting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Release Notes: **IMPROVED:**
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants