Hi all,
How to change an already defined script or an existing GUI class from a *mission* (not from an addon)? I am quite beginner, so probably the answer is perhaps simple.
I am modifying the warfare mission and I have to change a script which is called through the onLoad definition of an existing GUI class. I un-binned the CA UI's config.bin and looked into the class definitions. Unfortunately, the script looks like wired in by BIS using the 'ca\Warfare2\Scripts\Client\GUI\GUI_BuyGearMenu.sqf' absolute path in the 'RscDisplayBuyGear' class.
#1 idea: replace the existing script by some trick from the mission. I do not know whether it is possible at all, so I moved on.
#2 idea: as I can change which dialog class is used (in GUI_buyPrepareMenu.sqf), so lets modify the 'RscDisplayBuyGear' class to have my custom script named in the 'onLoad' part.
1. proposal for #2: inherit from the original RscDisplayBuyGear into a new RscDisplayBuyGearCustom class and use that. I tried to use the following:
////////////////////
class RscDisplayBuyUnits;
class RscDisplayBuyUnitsCustom : RscDisplayBuyUnits {
onLoad = "[findDisplay 106, _buyType] execVM 'Scripts\Client\GUI\GUI_buyUnitsMenu.sqf'";
idd = 5088;
class Filters;
class controlsBackground;
class controls;
};
//////////////////
and I replace the following line in GUI_buyPrepareMenu.sqf:
...
case 'units': {CreateGearDialog [player,"RscDisplayBuyUnitsCustom"];};
...
Then when the above script is called then it complains about
"Warning Message: No entry 'bin\config.bin.RscDisplayBuyUnitsCustom'."
and the dialog is dead.
2. proposal for #2: try to replace the original class partially and use the original GUI_buyPrepareMenu.sqf. I have seen a a way to do this in the stra_debug2.pbo addon.
/////////////
class RscDisplayGear;
class RscDisplayBuyUnits : RscDisplayGear {
onLoad = "[findDisplay 106, _buyType] execVM 'Scripts\Client\GUI\GUI_buyUnitsMenu.sqf'";
idd = 5088;
class Filters {
class All;
class Primary;
class Secondary;
class HandGun;
class Items;
};
class controlsBackground
{
class Mainback;
};
class controls {
class CA_Filter_Arrow_Left_L;
class CA_Filter_Arrow_Left_R;
class CA_Filter_Left_Icont_L;
class CA_Filter_Right_Icon_R;
class Gear_Title;
class Unit_Title;
class Available_items_Text;
class CA_Filter_IconUnits;
class CA_Filter_Icon1Units;
class CA_ItemName;
class CA_Money;
class CA_Money_Value;
class ListboxArrows {
class VScrollbar;
class HScrollbar;
class controls {
class Available_units;
class Queued_units;
class CA_B_Add;
};
};
class ButtonFilters;
class ButtonContinue;
class ButtonClose;
};
};
/////////////
Again, no effect - buy menu stays the same. The stra_debug2 addon uses its definition in a config.cpp, so probably I could do the same with making an addon and its config.cpp. My problem is I would like to have a mission without addons. I have tried to create a config.cpp in the mission folder and repeat in it what I had above, but it looks like being not used at all.
3. proposal for #2: Copy the entire class. Again, no effect.
#3 idea: perhaps the problem is with the new, ArmA2-introduced CreateGearDialog command, and it cannot read classes from description.ext, only from config.bins. Replaced it with CreateDialog and tried the solutions above again. Now the problem is that the class definition cannot see the base classes. So how to make description.ext aware of the classes defined in the UI's config.bin? Tried to look around the files, but no .hpp's to include.
Any ideas welcome...