Jump to content
Sign in to follow this  
Mickyleitor

Getting an 3DEN attributes from init unit

Recommended Posts

Hi guys,
I'm researching for a new way to manually configure a cargo vehicles configuration inside a ship (B.A.M). Now we have 3DEN Entity attributes I want to use this feature to let mission editor put its own cargo configuration.

 

a8daa1db492b02f459fec6423d6db75f.png

 

The idea is simple, with a GUI like this, the Mission Editor write into an array the vehicles he wants, then it's passed to a variable with setVariable "CustomCargoArray" to the unit and when vehicle gets spawned, the init of the vehicle take this array and load them with a custom script.

 

Config attributes

class Attributes
        {
            class DefaultCargo
            {
                control = "Checkbox";
                defaultValue = "false";
                displayName = "$STR_FFAA_BAM_DEFAULTCARGO_DISPLAYNAME";
                tooltip = "$STR_FFAA_BAM_DEFAULTCARGO_TOOLTIP";
                expression = "_this setVariable ['FFAA_ship_defaultCargo',!_value,true];";
                property = "DefaultCargo";
            };
            class CustomWinchCargo
            {
                control = "EditArray";
                defaultValue = "['ffaa_ar_zodiac_hurricane','ffaa_ar_zodiac_hurricane']";
                displayName = "$STR_FFAA_BAM_CUSTOMWINCHCARGO_DISPLAYNAME";
                tooltip = "$STR_FFAA_BAM_CUSTOMCARGO_TOOLTIP";
                expression = "_this setVariable ['CustomWinchCargo',_value,true];";
                property = "CustomWinchCargo";
                wikiType = "[[Array]]";
            };
            class CustomFlightDeckCargo
            {
                control = "EditArray";
                defaultValue = "['']";
                displayName = "$STR_FFAA_BAM_CUSTOMFLIGHTDECKCARGO_DISPLAYNAME";
                tooltip = "$STR_FFAA_BAM_CUSTOMCARGO_TOOLTIP";
                expression = "_this setVariable ['CustomFlightDeckCargo',_value,true];";
                property = "CustomFlightDeckCargo";
                wikiType = "[[Array]]";
            };
        };

Init of the vehicle

[_ship,"WinchCargo",_ship getVariable ["CustomWinchCargo",[]]] call FFAA_fnc_createVehicleCargo;
[_ship,"FlightDeckCargo",_ship getVariable ["CustomFlightDeckCargo",[]]] call FFAA_fnc_createVehicleCargo;

 

Where is the issue? Well, it's on the initialization order of Arma 3, the init of the vehicle is first called and there is no way to read the "CustomCargoArray" value because in fact it doesn't exist, YET.

What would be the best approach to get this working? I think there is more than the approach I'm trying but I'm running out of new ideas..

Share this post


Link to post
Share on other sites

You can call a function from the expression, implementing the spawning of the objects within Eden, so they are present at mission start. Only drawback is that multiple settings of your array will spawn multiple objects.

 

For this reason in the Nimitz I added two steps to 'populating' the carrier: First put the classnames in the Eden attribute list. Second use tools->Nimitz->Populate carrier to put the objects on the ship.

 

As an alternative you can check with is3den in your script if it's called from Eden or not and only add objects in the mission.

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
Sign in to follow this  

×