Jump to content
mattjb

[ACE] calling progressBar does not work in vehicles

Recommended Posts

I can't seem to wrap my head around why ace_common_fnc_progressBar starts and immediately quits (within a frame) when inside a vehicle, but works fine when outside a vehicle.

Could anyone shed some light on this?

 

I've simplified the non-working code down to being this as simple as this:

_target = _this select 0;
_player = _this select 1;
[
    3,
    [],
    {true},
    {true},
    "ProgressBar...",
    {true}
] call ace_common_fnc_progressBar;

Calling the script containing the above with:

_progressbartest = ["progress_bar_test", "<t color='#00ff00'>ProgressBar Test</t>","", {[_target,_player] execVM "wolfpak\scripts\wolfpak_progresbartest.sqf"},{true}] call ace_interact_menu_fnc_createAction;
[_unit, 1, ["ACE_SelfActions"], _progressbartest] call ace_interact_menu_fnc_addActionToObject;

 

Share this post


Link to post
Share on other sites

Additionally, the success code segment is never being hit here. 

Share this post


Link to post
Share on other sites
[_unit, 1, ["ACE_SelfActions"], _progressbartest] call ace_interact_menu_fnc_addActionToObject;

Where is _unit defined? You have:

_target = _this select 0;
_player = _this select 1;

 

Share this post


Link to post
Share on other sites

_unit = player;

 

Sorry if that seemed confusing, I'll provide the whole WolfPAKinit.sqf here.

The _progressbartest handle just calls a test script that I've temporarily embedded into the mod.

It is stripped down to just the essentials of calling an ACE progressBar at its most primitive functionality (returning true). 

_fullheal is the handle for the main script which is exhibiting the same progressBar behavior.

 

WolfPAKinit.sqf

[[], {
    if (isServer) exitWith {};

    waitUntil {
        !(isNull player) &&
        {(player == player)} &&
        {!isNil "BIS_fnc_init"}
    };

    _unit = player;

    if (hasInterface) then {
        if (isNil {_unit getVariable ["WolfPAKActive", nil]}) then {
            _unit setVariable ["WolfPAKActive", true];
            // WolfPAK v1.5 - initialization code
            _fullHeal = ["full_heal", "<t color='#00ff00'>WolfPAK (Full Heal)</t>","", {[_target,_player] execVM "wolfpak\scripts\wolfpak_aceaction.sqf"},{(('ACE_personalAidKit' in (items _player + assignedItems _player)) or ('ACE_personalAidKit' in (items _target + assignedItems _target))) and ( (!(_target getVariable ['ACE_medical_bodyPartStatus',[0,0,0,0,0,0]] isEqualTo [0,0,0,0,0,0])) or (_target getVariable ['ACE_medical_pain',0] > 0) or (_target getVariable ['ACE_isUnconscious',false] isEqualTo true))}] call ace_interact_menu_fnc_createAction;
            _progressbartest = ["progress_bar_test", "<t color='#00ff00'>ProgressBar Test</t>","", {[_target,_player] execVM "wolfpak\scripts\wolfpak_progresbartest.sqf"},{true}] call ace_interact_menu_fnc_createAction;
            [[_unit, 0, ["ACE_MainActions"], _fullHeal],ace_interact_menu_fnc_addActionToObject] remoteExec ["call", -2, true];
            [_unit, 1, ["ACE_SelfActions"], _fullHeal] call ace_interact_menu_fnc_addActionToObject;
            [_unit, 1, ["ACE_SelfActions"], _progressbartest] call ace_interact_menu_fnc_addActionToObject;
            systemChat "Initialized WolfPAK v1.5 (PBO)";
            // End of WolfPAK v1.5 - initialization code
        };
    };
}] remoteExec ["spawn", -2, true];

 

wolfpak_progressbartest.sqf

_target = _this select 0;
_player = _this select 1;
[
    3,
    [],
    {true},
    {true},
    "ProgressBar...",
    {true}
] call ace_common_fnc_progressBar;

 

Share this post


Link to post
Share on other sites

So the progress bar isn't working or...? What exactly is the issue? I'm a bit confused. If so. Try the default example which is:

[5, [], {Hint "Finished!"}, {hint "Failure!"}, "My Title"] call ace_common_fnc_progressBar

According to GitHub at least.

Share this post


Link to post
Share on other sites

Progress bar works outside of vehicles, but not when inside.

I've made a quick video showing the behavior, with the github example:

 

Share this post


Link to post
Share on other sites

Try to pass vehicle?

vehicle player
            [[(vehicle _unit), 0, ["ACE_MainActions"], _fullHeal],ace_interact_menu_fnc_addActionToObject] remoteExec ["call", -2, true];

 

Share this post


Link to post
Share on other sites

Still the same behavior

Using:

            [[(vehicle _unit), 0, ["ACE_MainActions"], _progressbartest],ace_interact_menu_fnc_addActionToObject] remoteExec ["call", -2, true];
            [[(vehicle _unit), 1, ["ACE_SelfActions"], _progressbartest],ace_interact_menu_fnc_addActionToObject] remoteExec ["call", -2, true];

 

Share this post


Link to post
Share on other sites

Hmm... Not sure, I don't use ACE. Maybe it is something in the progress bar function?

private _player = ACE_player;

@commy2

Share this post


Link to post
Share on other sites
 * 0: Total Time (in game "time" seconds) <NUMBER>
 * 1: Arguments, passed to condition, fail and finish <ARRAY>
 * 2: On Finish: Code called or STRING raised as event. <CODE, STRING>
 * 3: On Failure: Code called or STRING raised as event. <CODE, STRING>
 * 4: (Optional) Localized Title <STRING>
 * 5: Code to check each frame (Optional) <CODE>
 * 6: Exceptions for checking EFUNC(common,canInteractWith) (Optional)<ARRAY>

in parameter 6 try: ["isNotInside"], I know that for self interact you have to do this to make it available in vehicles, so maybe it's the same for the progressbar

  • Like 2

Share this post


Link to post
Share on other sites

I think ["isNotInside"] may very well be the key to the solution! Did some initial testing this morning (the best I can do through a VNC connection from work here), and at least self-interact seems to be working inside the driver seat of a vehicle. 

I was looking through the ace common & medical functions last night and saw that "isNotInside" being passed from I think the treatment function (as well as "isNotSwimming") but I couldn't find exactly what those keywords were doing.

Will do some more testing with that, as well as seeing if I should tag on "isNotSwimming" too, for the situations when trying to use a progressBar function while in the water.

I will report back with my findings. :)

 

Thanks for the suggestion, Mr H.!

Also to you, HazJ, for your suggestions!

Share this post


Link to post
Share on other sites

Finally got around to doing some thorough testing of this.

The ACE_SelfAction progressBar is working fine, but I'm now having difficulty getting the action to show up for other players in a vehicle.

It is very similar to what the OP in this thread was trying to achieve: 

 

I've tried so many combinations now, and derived at the conclusion that str _unit isn't creating the action under a "vehicularized" playername's action menu, but creating actions that target the vehicle directly seem to be working, i.e. ["ACE_MainActions"] or ["ACE_MainActions","ACE_Passengers"] - for instance the "Check Fuel" example provided by the examples page: https://ace3mod.com/wiki/framework/interactionMenu-framework.html#25-examples

 

Just an FYI, I have the {true} condition for _fullHealVehicle just to make testing easier and quicker -- for now I'm just trying get the action appearing and targeting the unit correctly...

 

20180715103708_1.jpg

if (isServer) exitWith {};

[[], {
    waitUntil {
        !(isNull player) &&
        {(player == player)} &&
        {!isNil "BIS_fnc_init"}
    };

    _unit = player;

    if (hasInterface) then {
        if (isNil {_unit getVariable ["WolfPAKActive", nil]}) then {
            _unit setVariable ["WolfPAKActive", true];
            // WolfPAK v1.5 - initialization code
            _fullHeal = ["full_heal", "<t color='#00ff00'>WolfPAK (Full Heal)</t>","", {[_target,_player] execVM "wolfpak\scripts\wolfpak_aceaction.sqf"},{(('ACE_personalAidKit' in (items _player + assignedItems _player)) or ('ACE_personalAidKit' in (items _target + assignedItems _target))) and ( (!(_target getVariable ['ACE_medical_bodyPartStatus',[0,0,0,0,0,0]] isEqualTo [0,0,0,0,0,0])) or (_target getVariable ['ACE_medical_pain',0] > 0) or (_target getVariable ['ACE_isUnconscious',false] isEqualTo true))}] call ace_interact_menu_fnc_createAction;
            _fullHealVehicle = ["full_heal_vic", "<t color='#00ff00'>WolfPAK (Full Heal) Vic</t>","", {[_target,_player] execVM "wolfpak\scripts\wolfpak_aceaction.sqf"},{true}] call ace_interact_menu_fnc_createAction;
            [[_unit, 0, ["ACE_MainActions"], _fullHeal],ace_interact_menu_fnc_addActionToObject] remoteExec ["call", -2, true];
            //[["LandVehicle", 0, ["ACE_MainActions"], _fullHealVehicle, true],ace_interact_menu_fnc_addActionToClass] remoteExec ["call", -2, true];
            //[["LandVehicle", 0, ["ACE_MainActions","ACE_Passengers"], _fullHealVehicle, true],ace_interact_menu_fnc_addActionToClass] remoteExec ["call", -2, true];
            //[["LandVehicle", 0, ["ACE_MainActions","ACE_Passengers",(str _unit)], _fullHealVehicle, true],ace_interact_menu_fnc_addActionToClass] remoteExec ["call", -2, true];
            //[["LandVehicle", 0, ["ACE_MainActions","ACE_Passengers",_unit], _fullHealVehicle, true],ace_interact_menu_fnc_addActionToClass] remoteExec ["call", -2, true];
            [[vehicle _unit, 0, ["ACE_MainActions","ACE_Passengers"], _fullHealVehicle],ace_interact_menu_fnc_addActionToObject] remoteExec ["call", -2, true];
            [[vehicle _unit, 0, ["ACE_Passengers"], _fullHealVehicle],ace_interact_menu_fnc_addActionToObject] remoteExec ["call", -2, true];
            [[vehicle _unit, 0, ["ACE_MainActions", str _unit], _fullHealVehicle],ace_interact_menu_fnc_addActionToObject] remoteExec ["call", -2, true];
            [[vehicle _unit, 0, [str _unit], _fullHealVehicle],ace_interact_menu_fnc_addActionToObject] remoteExec ["call", -2, true];
            //[["LandVehicle", 0, ["ACE_MainActions", "ACE_Passengers", name _unit], _fullHealVehicle, true],ace_interact_menu_fnc_addActionToClass] remoteExec ["call", -2, true];
            //[["LandVehicle", 0, ["ACE_Passengers", str _unit], _fullHealVehicle, true],ace_interact_menu_fnc_addActionToClass] remoteExec ["call", -2, true];
            //[["LandVehicle", 0, ["ACE_Passengers", name _unit], _fullHealVehicle, true],ace_interact_menu_fnc_addActionToClass] remoteExec ["call", -2, true];

            // Adds action to check fuel levels for all land vehicles
            _action = ["CheckFuel", "Check Fuel", "", {hint format ["Fuel: %1", fuel _target]}, {true}] call ace_interact_menu_fnc_createAction;
            ["LandVehicle", 0, ["ACE_MainActions"], _action, true] call ace_interact_menu_fnc_addActionToClass;

            [_unit, 1, ["ACE_SelfActions"], _fullHeal] call ace_interact_menu_fnc_addActionToObject;

            systemChat "Initialized WolfPAK v1.5 (PBO)";
            // End of WolfPAK v1.5 - initialization code
        };
    };
}] remoteExec ["spawn", -2, true];

 

Share this post


Link to post
Share on other sites

Just found fnc_addPassengerActions.sqf and fnc_addPassengersActions.sqf inside ace_interaction.pbo - going to see if I can leverage those functions...

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×