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

Player Events: "Loadout" event returns irrelevant data #1300

Closed
10Dozen opened this issue Mar 2, 2020 · 5 comments · Fixed by #1301
Closed

Player Events: "Loadout" event returns irrelevant data #1300

10Dozen opened this issue Mar 2, 2020 · 5 comments · Fixed by #1301
Labels
Milestone

Comments

@10Dozen
Copy link
Contributor

10Dozen commented Mar 2, 2020

Mods (complete and add to the following information):

  • Arma 3: 1.96.146114 stable
  • CBA: 3.14.0.200207

Description:
"Loadout" EH returns weird data. Right after adding EH - it returns empty array as _this # 1 (_newLoadout). Then each event return previous loadout for some reason.

Example:

  1. Initial loadout:
    [["arifle_MX_SW_pointer_F","","acc_pointer_IR","",["100Rnd_65x39_caseless_mag",100],[],"bipod_01_F_snd"],[],["hgun_P07_F","","","",["16Rnd_9x21_Mag",16],[],""],["U_B_CombatUniform_mcam_tshirt",[["FirstAidKit",1],["HandGrenade",1,1],["SmokeShell",1,1],["SmokeShellGreen",1,1],["Chemlight_green",1,1]]],["V_PlateCarrier2_rgr",[["100Rnd_65x39_caseless_mag",5,100],["16Rnd_9x21_Mag",2,16],["Chemlight_green",1,1]]],[],"H_HelmetB_grass","",[],["ItemMap","","ItemRadio","ItemCompass","ItemWatch","NVGoggles"]]

  2. Add EH :

["loadout", { 
    params ["_unit", "_newLoadout"]; 
     MY_LOADOUT = +_newLoadout;
}, true] call CBA_fnc_addPlayerEventHandler;
  1. MY_LOADOUT after EH added:
    []
  2. Drop rifle via inventory:

getUnitLoadout player
[[],[],["hgun_P07_F","","","",["16Rnd_9x21_Mag",16],[],""],["U_B_CombatUniform_mcam_tshirt",[["FirstAidKit",1],["HandGrenade",1,1],["SmokeShell",1,1],["SmokeShellGreen",1,1],["Chemlight_green",1,1]]],["V_PlateCarrier2_rgr",[["100Rnd_65x39_caseless_mag",5,100],["16Rnd_9x21_Mag",2,16],["Chemlight_green",1,1]]],[],"H_HelmetB_grass","",[],["ItemMap","","ItemRadio","ItemCompass","ItemWatch","NVGoggles"]]

MY_LOADOUT
[["arifle_MX_SW_pointer_F","","acc_pointer_IR","",["100Rnd_65x39_caseless_mag",100],[],"bipod_01_F_snd"],[],["hgun_P07_F","","","",["16Rnd_9x21_Mag",16],[],""],["U_B_CombatUniform_mcam_tshirt",[["FirstAidKit",1],["HandGrenade",1,1],["SmokeShell",1,1],["SmokeShellGreen",1,1],["Chemlight_green",1,1]]],["V_PlateCarrier2_rgr",[["100Rnd_65x39_caseless_mag",5,100],["16Rnd_9x21_Mag",2,16],["Chemlight_green",1,1]]],[],"H_HelmetB_grass","",[],["ItemMap","","ItemRadio","ItemCompass","ItemWatch","NVGoggles"]]

Expected behavior:
(_this # 1) should return changed loadout.

Where did the issue occur?

  • tested on Client-side only
@commy2
Copy link
Contributor

commy2 commented Mar 2, 2020

0: unit
1: old loadout
2: new loadout

The old loadout may be empty array for retroactive execution.

@commy2
Copy link
Contributor

commy2 commented Mar 2, 2020

Doc is here: #1289 (comment)

I forgot to update the wiki. Will do immediately.
Wiki

@10Dozen
Copy link
Contributor Author

10Dozen commented Mar 4, 2020

So what is expected solution - do i need to update scripts from my side to match new return values order or return values order will be restored (i mean that event data was [_unit, _newLoadout] for at least few months, so it's kinda weird that it was changed instead of just adding oldLoadout as _this # 2)

@PabstMirror
Copy link
Contributor

PabstMirror commented Mar 4, 2020

We should be eventually changing cba to return new as 2nd arg (_this # 1)
[_unit, _new, _old]

Until that version is released the safe way will be to manually get it
(as this will work with any cba vesion)

["loadout", { 
param ["_unit"];
MY_LOADOUT = getLoadout _unit;

@10Dozen
Copy link
Contributor Author

10Dozen commented Mar 4, 2020

Got it. Thanks!

@commy2 commy2 added this to the 3.15 milestone Mar 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants