KoffeinFlummi / AGM

Authentic Gameplay Modification for A3 | THIS PROJECT IS NO LONGER BEING WORKED ON. ALL ISSUES AND PULL REQUESTS WILL BE IGNORED.
Other
125 stars 84 forks source link

AGM Items can be equipped as launchers #1223

Closed bux closed 10 years ago

bux commented 10 years ago

Arma3: 1.30 Mods: CBA_A3, agm_dev agm_dev from: 2014-10-02 Tested on: Editor Zeus enabled: Yes Modules: No modules

agm_launchers

image

commy2 commented 10 years ago

Don't add them via addWeapon, but with addItem. Thats a side effect from them being available in the VA. Adding them via addItem doesn't have this side effect. The same happens when you add the MineDetector via addWeapon.

Repro: ammo_box addWeaponCargo ["MineDetector", 1] -> MineDetector has no weight and can be equipped as secondary weapon.

ammo_box addItemCargo ["MineDetector", 1] -> MineDetector has weight and cannot be equipped as weapon.

bux commented 10 years ago

The items were taken from the AGM Misc ammo box.— JD

On Thu, Oct 2, 2014 at 9:28 AM, commy2 notifications@github.com wrote:

Don't add them via addWeapon, but with addItem. Thats a side effect from them being available in the VA. Adding them via addItem doesn't have this side effect. The same happens when you add the MineDetector via addWeapon.

Reply to this email directly or view it on GitHub: https://github.com/KoffeinFlummi/AGM/issues/1223#issuecomment-57593249

commy2 commented 10 years ago

Can't reproduce then: http://i.imgur.com/Iy5uIBH.png

bux commented 10 years ago

:grin: Your favorite kind of bug:

It's a Zeus placed AGM Misc box

commy2 commented 10 years ago

Ah ffs.

bux commented 10 years ago

The same with the medical items, from the Medical box (Zeus placed). Obviously!

commy2 commented 10 years ago

Is there an ammo box from the vanilla game that has the mine detector? If so, can you check if the same happens to the mine detector?

commy2 commented 10 years ago

"Box_NATO_Support_F" has a mine detector ....

bux commented 10 years ago

It does. BIS's fault then?

commy2 commented 10 years ago

Yes. How did you place an ammo box with zeus anyways?

bux commented 10 years ago

2014-10-02_00004

commy2 commented 10 years ago

Got it. The same happens with a zeus placed "Box_NATO_Support_F" to the mine detector. Because the AGM items have to be the same kind of item the mine detector is, to show up in the VA, I can't fix this.

bux commented 10 years ago

I'll open an issue in the feedback tracker.— JD

On Thu, Oct 2, 2014 at 10:05 AM, commy2 notifications@github.com wrote:

Got it. The same happens with a zeus placed "Box_NATO_Support_F" to the mine detector. Because the AGM items have to be the same kind of item the mine detector is, to show up in the VA, I can't fix this.

Reply to this email directly or view it on GitHub: https://github.com/KoffeinFlummi/AGM/issues/1223#issuecomment-57595966

commy2 commented 10 years ago

Thx.

Edit: Make sure to also mention the addWeaponCargo vs. addItemCargo stuff

bux commented 10 years ago

http://feedback.arma3.com/view.php?id=20997

KoffeinFlummi commented 10 years ago

Can't this be closed? Nothing we can do about it...

bux commented 10 years ago

:+1: Close

commy2 commented 10 years ago

I'm working on an init script for the crate, that removes weapons and readds items.

commy2 commented 10 years ago

I wrote the function just to realize that they fixed this? Can anyone confirm? AFK for 2 hrs.

jonpas commented 10 years ago

Confirmed working, I can't put any item into launcher slot.

commy2 commented 10 years ago

Meh, the ticket is still open. http://feedback.arma3.com/view.php?id=20997

backup, you never know:

// by commy2

private ["_crate", "_weapons", "_items"];

_crate = _this select 0;

// get all weapons inside the crate
_weapons = weaponCargo _crate;
_items = [];

// if the "weapon" is supposed to be an item, move those from the weapon array to the item array
{
    if (getText (configFile >> "CfgWeapons" >> _x >> "simulation") == "ItemMineDetector") then {
        _weapons set [_forEachIndex, ""];
        _items pushBack _x;
    };
} forEach _weapons;

_weapons = _weapons - [""];

// exit now if everything is fine
if (count _items == 0) exitWith {};

// otherwise clear weapon cargo and re-add items and weapons
// this function is executed on every PC, so use local commands
clearWeaponCargo _crate;

{
    _crate addWeaponCargo [_x, 1];
} forEach _weapons;

{
    _crate addItemCargo [_x, 1];
} forEach _items;
bux commented 10 years ago

Not fixed!

Zeus placed AGM Misc box: 2014-10-19_00001

jonpas commented 10 years ago

Well that's weird, I did exactly the same test, not on dedicated though, but in multiplayer and I couldn't do that.

commy2 commented 10 years ago

: )

I'll do more testing. Atleast I can implement my script.

commy2 commented 10 years ago

It only happens if you press OK when the custom crate filling menu is open.

commy2 commented 10 years ago

So many curator eventhandlers, but none of these trigger after editing the cargo... Anyone know what control that is?

commy2 commented 10 years ago

Needs testing. Might lag now whenever you try to open a crate with thousands of weapons.

lubomirblazekcz commented 10 years ago

hmm.. interesting just tried this (@agm_dev build from 17. 10) and the agm ammoboxes indeed have this issue. But what is strange, that I also spawned my custom agm ammobox (https://github.com/evromalarkey/ASCZ-Mods/blob/master/Source/ascz_arsenal_box/config.cpp) via zeus and there was no problem. Maybe it has to do something with Box_NATO_Support_F which is AGM_Box_Misc inheriting?

commy2 commented 10 years ago

It only happens if you press OK when the custom crate filling menu is open.

When I close the meny by pressing Cancel or ESC, it's working fine.

lubomirblazekcz commented 10 years ago

nah, just found out myself. Never mind, it's because my agm ammobox is not recognized by zeus as an ammobox so there is no filling menu dialog.. :D

commy2 commented 10 years ago

not recognized by zeus as an ammobox so there is no filling menu dialog

Maybe that would be a better solution than my script? How does Zeus decide if it's an ammo box?

lubomirblazekcz commented 10 years ago

I think zeus recognize all inherited bis ammobox classes (eg. Land_PaperBox_open_full_F is not under ammoboxes). So if you use config stuff from the Box_NATO_Support_F and you will not inherit it, it should work.

nicolasbadano commented 10 years ago

I think zeus recognize all inherited bis ammobox classes (eg. Land_PaperBox_open_full_F is not under ammoboxes). So if you use config stuff from the Box_NATO_Support_F and you will not inherit it, it should work.

Interesting.

commy2 commented 10 years ago

Well, it's still possible to add the AGM items (or the MineDetector ....) with zeus to ammo boxes, so the script is necessary.

lubomirblazekcz commented 10 years ago

yeah that's true, btw think I know what have bis wrong. Mine detector and agm items have type = 4; and BI has condition (ui_f_curator\UI\RscCommon\RscAttributeInventory.sqf, row 374) that items from 4096 to 131072 are items, and since 4 is not in the range, it's added as weapon :D

nicolasbadano commented 10 years ago

Can we override that sqf and add the correction?

On Sun, Oct 19, 2014 at 6:29 PM, evromalarkey notifications@github.com wrote:

yeah that's true, btw think I know what have bis wrong. Mine detector and agm items have type = 4; and BI has condition (ui_f_curator\UI\RscCommon\RscAttributeInventory.sqf, row 374) that items from 4096 to 131072 are items, and since 4 is not in the range, it's added as weapon :D

— Reply to this email directly or view it on GitHub https://github.com/KoffeinFlummi/AGM/issues/1223#issuecomment-59666422.

commy2 commented 10 years ago

Don't think so, compileFinal

Where is that function called though?

Correction would be: if (type = 4 && simulation = "MineDetector") then { item }

lubomirblazekcz commented 10 years ago

in ui_f_curator.pbo config there is reference to BIS_fnc_initCuratorAttribute which it handles, if I understand it correctly.

commy2 commented 10 years ago

with uinamespace do {
private ["_params","_class","_path","_fncName","_control"];

_params = _this select 0;
_class = _this select 1;
_path = _this select 2;

_fncName = _class;
if (isnil _fncName || cheatsEnabled) then {
private ["_scriptPath","_fncFile"];

_scriptPath = gettext (configfile >> "cfgScriptPaths" >> _path);

_fncFile = preprocessfilelinenumbers format [_scriptPath + "%1.sqf",_class];
_fncFile = format ["scriptname '%1_%2'; _fnc_scriptName = '%1';",_class] + _fncFile;
uinamespace setvariable [_fncName,compileFinal _fncFile];
};

_control = _params select 0;
_control ctrlremovealleventhandlers "setFocus";

_display = ctrlparent _control;
_display displayaddeventhandler ["unload",format ["with uinamespace do {['onUnload',_this,missionnamespace getvariable ['BIS_fnc_initCuratorAttributes_target',objnull]] call %1};",_fncName]];

_ctrlButtonOK = _display displayctrl    1;
_ctrlButtonOK ctrladdeventhandler [
"buttonclick",
format ["with uinamespace do {['confirmed',[ctrlparent (_this select 0)],missionnamespace getvariable ['BIS_fnc_initCuratorAttributes_target',objnull]] call %1}; false",_fncName]
];

_target = missionnamespace getvariable ["BIS_fnc_initCuratorAttributes_target",objnull]; 
["onLoad",[ctrlparent (_params select 0)],_target] call (uinamespace getvariable _fncName);
};
commy2 commented 10 years ago

Thats BIS_fnc_initCuratorAttribute. I don't see a line with items though.

lubomirblazekcz commented 10 years ago

in config (row 3520) it's calling BIS_fnc_initCuratorAttribute which is then calling RscAttributeInventory.sqf

nicolasbadano commented 10 years ago

format [_scriptPath + "%1.sqf",_class];

Here it is composing RscAttributeInventory.sqf

commy2 commented 10 years ago
class RscAttributeInventory: RscControlsGroupNoScrollbars {
    onSetFocus = "[_this,""RscAttributeInventory"",'CuratorCommon'] call (uinamespace getvariable ""BIS_fnc_initCuratorAttribute"")";
    idc = 25168;
};
nicolasbadano commented 10 years ago

Great!

commy2 commented 10 years ago

I hacked something in without messing with bis' stuff too much. Needs testing.

bux commented 10 years ago

Looks good. Seems to work in Preview and self hosted MP.

commy2 commented 10 years ago

Why are mine detectors rocket launchers anyway... Who though that was a good idea!?

commy2 commented 10 years ago

I found a better solution. Needs testing again. The good thing now is, that the damn mine detector stays bugged.

bux commented 10 years ago

AGM Items aren't bugged anymore. They even work "splendid" (hehe) in Virtual Arsenal. -> Fixed