RHS Feedback

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005784USAFGeneralpublic2020-07-08 13:232020-07-27 21:37
ReporterBrazzer 
Assigned Toreyhard 
PrioritynoneSeverityfeatureReproducibilityalways
StatusclosedResolutionno change required 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0005784: Adding a variable to M1085A1P2B (CBPS) when medical tent is deployed
DescriptionHello, having a variable set when the medical tent is deployed would be great.

The classname that "need" this are:
"rhsusf_M1085A1P2_B_D_Medical_fmtv_usarmy", "rhsusf_M1085A1P2_B_WD_Medical_fmtv_usarmy"


This way we can check whether the tent is deployed or not (for example this could be handy to dinamically assign the ace "medical vehicle" variable).

Thank you!
Steps To Reproducenone
Additional Informationconfig: configfile >> "CfgVehicles" >> CLASSNAME >> "UserActions" >> "open_tent" >> "statement";

change from: "this animateSource ['deploy_tent',1]";
to: "this animateSource ['deploy_tent',1]; this addVariable ["RHS_VAR", 1, true]";

and

config: configfile >> "CfgVehicles" >> CLASSNAME >> "UserActions" >> "close_tent" >> "statement";

change from: "this animateSource ['deploy_tent',0]";
to: "this animateSource ['deploy_tent',1]; this addVariable ["RHS_VAR", 0, true]";
TagsNo tags attached.
Is it a wish/request?Yes
RHS versionStable
Arma 3 version1.98
Did you used any other mod when the error occurred?No
Which mods?
Attached Files

- Relationships

-  Notes
(0010842)
reyhard (administrator)
2020-07-08 13:44

why cannot you just check animationSourcePhase?
(0010843)
Brazzer (reporter)
2020-07-08 14:20

Hello,
because I would like to have the ACE attribute applied only if the tent is *currently* deployed. If the tent is closed, I would like to have the possibility to "turn off" the medical vehicle feature.

animationSourcePhase is what I'm using now inside a loop as follows:

///
private _condition = _vehicle animationSourcePhase "deploy_tent" > 0;
private _value = [false, true] select _condition;
_vehicle setVariable ["ACE_medical_isMedicalFacility", _value, true];
///

But a variable set directly from the user action would be a much better way to handle this in my opinion!

Thank you.
(0010844)
reyhard (administrator)
2020-07-08 14:29
edited on: 2020-07-08 14:30

there is no such thing as "addVariable" variable in vanilla Arma?


private _condition = _vehicle animationSourcePhase "deploy_tent" > 0;
private _value = [false, true] select _condition;

that code doesn't make sense
"_vehicle animationSourcePhase "deploy_tent" > 0;" will return true or false


private _value = [false, true] select _condition; - there is no point in selecting boolean via boolean :D

(0010845)
Brazzer (reporter)
2020-07-08 14:36

You right, I modified my code to make an example and I made it dumb. Anyway I think you have understood how I'm using animationSourcePhase to determine whether the tent is opened or not!

Vanilla Arma can of course add a variable to the truck, the problem is in making it dynamic when opening/closing the tent. The cleanest way to do this would be to add a variable on your side, if to you this is not possible because useless you just need to say it :)
(0010846)
reyhard (administrator)
2020-07-08 14:40

I don't understand what kind of difference would make
_vehicle setVariable ["ACE_medical_isMedicalFacility", _vehicle getVariable ["something",false], true];

vs

_vehicle setVariable ["ACE_medical_isMedicalFacility", (_vehicle animationSourcePhase "deploy_tent") isEqualTo 1, true];

having that additional variable would be just waste of memory since you can already get same information from animationSourcePhase
(0010847)
Brazzer (reporter)
2020-07-08 14:56

This is not what I suggested to introduce. If you please see the opening post, I just asked to add a setVariable command on the open/close actions.

For example, now the open action statement is:
"this animateSource ['deploy_tent', 1]";

I suggested something like:
"this animateSource ['deploy_tent', 1]"; this addVariable ["someRhsVarName", 1, true]";

The last example you provided is not what I intended! animationSourcePhase is not reliable as a 0/1 variable in my opinion, because performance wise it is not so convenient to check every frame the state of the animation and an "asynchronous" check with animationSourcePhase can lead into problems such as the ACE attribute being applied/removed with a delay.

I'm conscious that this is a particular use case, but please have a try with this:

["rhsusf_M1085A1P2_B_Medical_fmtv_usarmy", "InitPost", {
  params ["_vehicle"];

  if !(local _vehicle) exitWith {};

  [{
    params ["_params", "_handle"];
    _params params ["_vehicle"];

    if (!alive _vehicle) exitWith {
      [_handle] call CBA_fnc_removePerFrameHandler;
    };

    private _value = _vehicle animationSourcePhase "deploy_tent" > 0;
    _vehicle setVariable ["ACE_medical_isMedicalFacility", _value, true];
  }, 3, _vehicle] call CBA_fnc_addPerFrameHandler;
}] call CBA_fnc_addClassEventHandler;

The code above will not always assign and remove the variable at the right moment because of the animation phase. A simpler 0/1 variable would be better, in my opinion. If you have any suggestion I'll listen to that gladly!

The problem at the base are the animation related EH that don't fire, or the ACE attribute switch would be really easy.

Thank you for your time.
(0010848)
reyhard (administrator)
2020-07-08 19:05

1. There is no such thing as "addVariable". No idea what you are talking about.
2. I would recommend using isEqualTo 1 - It's faster than >0 and I don't think it makes sense adding medical ability when vehicle is still deploying.
3. If variable would be introduced, then you would get above issue (medical ability is added in wrong moment = when vehicle is being deployed)
4. Performance wise the difference is minimal + variable is obviously occupying additional space in memory
Result:
0.0015 ms

Cycles:
10000/10000

Code:
cameraon animationSourcePhase "deploy_tent" isEqualTo 1

vs


Result:
0.0014 ms

Cycles:
10000/10000

Code:
cameraon getVariable ["rhs_something",false]

5. I think you are more looking for something close to what GAZ-69 with R142 has

/*
to add new deploy EH:
_fnc = (_v getVariable ["rhs_eh_gaz66_deploy",[]]) append ["yourfunctionName"];
_v setVariable ["rhs_eh_gaz66_deploy",_fnc];
*/
_fnc = _v getVariable ["rhs_eh_gaz66_deploy",[]];
{_this call (call (compile _x))}foreach _fnc;
(0010889)
reyhard (administrator)
2020-07-27 21:37

aand lol, I've checked code and there is already event handler for it.
/*
to add new deploy EH:
_fnc = (_v getVariable ["rhs_eh_fmtv_deploy",[]]) append ["yourfunctionName"];
_v setVariable ["rhs_eh_fmtv_deploy",_fnc];
*/
_fnc = _v getVariable ["rhs_eh_fmtv_deploy",[]];
{_this call (call (compile _x))}foreach _fnc;

- Issue History
Date Modified Username Field Change
2020-07-08 13:23 Brazzer New Issue
2020-07-08 13:44 reyhard Note Added: 0010842
2020-07-08 13:44 reyhard Assigned To => reyhard
2020-07-08 13:44 reyhard Status new => feedback
2020-07-08 14:20 Brazzer Note Added: 0010843
2020-07-08 14:20 Brazzer Status feedback => new
2020-07-08 14:29 reyhard Note Added: 0010844
2020-07-08 14:29 reyhard Status new => feedback
2020-07-08 14:30 reyhard Note Edited: 0010844 View Revisions
2020-07-08 14:36 Brazzer Note Added: 0010845
2020-07-08 14:36 Brazzer Status feedback => new
2020-07-08 14:40 reyhard Note Added: 0010846
2020-07-08 14:40 reyhard Status new => feedback
2020-07-08 14:56 Brazzer Note Added: 0010847
2020-07-08 14:56 Brazzer Status feedback => new
2020-07-08 19:05 reyhard Note Added: 0010848
2020-07-08 19:05 reyhard Status new => feedback
2020-07-27 21:37 reyhard Note Added: 0010889
2020-07-27 21:37 reyhard Status feedback => closed
2020-07-27 21:37 reyhard Resolution open => no change required


Copyright © 2000 - 2024 MantisBT Team
Powered by Mantis Bugtracker