Forum Jump :

Author Message


Posts: 3
Rank:


Level: Member

Country: 00
Location:
Occupation:
Age:
In-game name:

 
#1 Posted at 2019-10-08 18:02        
     
So, I've got a delicate problem. I started working on survival system. Used the NoMods Survival System by V0RT3X_SL4Y3R. After all, I used it only as an inspiration, both with ravage survival system. Everything works, besides the eating and drinking functions.

The use of items like food and drinks is controlled by handler:

handle = [] spawn {
	dx_gearLBDblClick = {
		_idc = ctrlIDC (_this select 0);
		_selectedIndex = _this select 1;
		_classname = format ["%1",lbData [_idc, _selectedIndex]];
		_lbData = lbData [_idc, _selectedIndex];
		_lbText = lbText [_idc, _selectedIndex];
			systemchat str _idc; 
			systemchat str _selectedIndex;
			systemchat str _classname;
			systemchat str _lbData; //this returns empty string. But only for items defined by myself. WHY?!?
			systemChat str _lbText; //This returns item's displayName, both for mine items and atock items. WHY?!?
		_container = [uniformContainer player, vestContainer player, backpackContainer player] select ([633, 638, 619] find _idc);
		
		
		false
	};
	while {true} do {
		waituntil {!(isnull (finddisplay 602))};
		showCommandingMenu "";
		{
			((findDisplay 602) displayCtrl _x) ctrlSetEventHandler ["LBDblClick", "_this call dx_gearLBDblClick"];
		} count [633, 638, 619];
		while {!(isnull (finddisplay 602))} do {
			
			if (vehicle player isEqualTo player) then {
				{
					if (abs (velocity player select _x) > 1) exitWith {
						closeDialog 602;
					};
				} forEach [0, 1];
			};
		};
		
	};
};
The food and drinks are defined in this array with some variables to be used by the survival system (not important here).
dx_food = [
	["dx_beans", 30, 0, 0.075, true],//classname, nutr., rad., health, canned
	["dx_beans_cooked", 40, 0, 0.085, true],
	["dx_lunchmeat", 35, 0, 0.075, true],
	["dx_lunchmeat_cooked", 45, 0, 0.085, true],
	["dx_tacbacon", 35, 0, 0.075, true],
	["dx_tacbacon_cooked", 45, 0, 0.085, true],
	["dx_mrebeef", 50, 0, 0.09, true],
	["dx_mrechicken", 50, 0, 0.09, true]
];
dx_drink = [
	["dx_canteen", 25, 0, 0],//classname, hydr., rad., health
	["dx_canteen_pure", 50, 0, 0.055],
	["dx_waterbottle", 35, 0, 0],
	["dx_waterbottle_pure", 70, 0, 0.075],
	["dx_franta", 50, 0, 0.04],
	["dx_spirit", 50, 0, 0.04],
	["dx_redgull", 50, 0, 0.04]
];
dx_containers = [
	"dx_beans_empty",
	"dx_lunchmeat_empty",
	"dx_tacbacon_empty",
	"dx_canteen_empty",
	"dx_waterbottle_empty",
	"dx_franta_empty",
	"dx_spirit_empty",
	"dx_redgull_empty"
];

And the items itself are defined like this:
class dx_beans : ItemCore {
        scope = 2;  
        scopeArsenal = 2;
        scopeCurator = 2;
        simulation= "ItemMineDetector";	
		displayName = "$STR_dx_beans";
		descriptionShort = "$STR_descriptionShort_dx_beans";
		model = "\A3\Structures_F_EPA\Items\Food\BakedBeans_F.p3d";
		picture = "\dexterSRC\dx_images\dx_f_beans_ca.paa";
        editorPreview = "\dexterSRC\dx_images\dx_f_beans_ca.paa";	
		count = 1;

		class ItemInfo: InventoryItem_Base_F
        {
            mass = 8;
        };
    };

and so on. The only thing that changes are the pictures, model and name. Everything else is the same.
Now, the problem is that the handler identifies these mine items as "" empty string. It just cant find the items classname. Stock items or ravage items work fine. And also, it really doesn't matter if its the food, or my customized helmet:

class dx_H_powerHelmet : H_PilotHelmetFighter_O {
		scope = 2;
		author = "r.dexter & Bohemia Interactive";
		weaponPoolAvailable = 1;
		displayName = "$STR_dx_H_powerHelmet";
		descriptionShort = "$STR_descriptionShort_dx_H_powerHelmet";
		subItems[] = { "Integrated_NVG_TI_1_F" };
		model = "A3\Characters_F\Common\headgear_helmet_pilot";
		hiddenSelections[] = {"camo"};
		hiddenSelectionsTextures[] = {"\A3\Characters_F\Common\Data\pilot_helmet_iran_co.paa"};

		class ItemInfo : HeadgearItem {
			_generalMacro = "HeadgearItem";
			allowedSlots[] = {901,605};
			author = "Bohemia Interactive";
			hiddenSelections[] = {"camo"};
			mass = 30;
			uniformModel = "A3\Characters_F\Common\headgear_helmet_pilot";

			class HitpointsProtectionInfo {
				class Face {
					armor = 8;
					hitpointName = "HitFace";
					passThrough = 0.5;
				};
				class Head {
					armor = 16;
					hitpointName = "HitHead";
					passThrough = 0.5;
				};
			};

		};
	};

So the problem really is not in inheriting ItemCore. As you can see, the helmet inherits normal arma helmet, and is returned by the handler as "". So, now I'm really wondering what is going on. What have I done incorrect? What is wrong with my code and definitions?
Also, I need to note that the items work normally, I can add them via eden, arsenal and scripts. The items could be dropped and then picked up. The items could be checked by 'xx' in items/headgear/weapons player. So now I just can't figure out what is wrong with my code.
Tested with direct access to lbData and lbText.

lbData returns empty string, but only for items defined by myself. WHY, for god's sake?

lbText returns item's displayName. I could use this, but since I'm using stringtable.xml for translation, it would need lots of additional scripting to cover item names in different languages. Simply, I don't want to use this way. I want to use classnames.

Edit: Okay, found out that when I define the item in cfgMagazines, it works. But I want to avoid that, because magazines are hard to work with in editor. I want the items to be actually items, not masked mags.

This post was edited by ramon.dexter (2019-10-08 20:12, 44 days ago)