Jump to content

Recommended Posts

Hello,

In a mission I am editing, I have a support requester with some supply drop. And I was wondering if there is a way to edit the content of the crate like with normals crates or by putting something in init crate.

I can always put each things in init but if there is a simpler way, it would be good.

Thanks for your help

Share this post


Link to post
Share on other sites

If you look in the attributes of the support module there is a "crate init" you can edit.

Share this post


Link to post
Share on other sites

If you look in the attributes of the support module there is a "crate init" you can edit.

Yes I saw that but how do you modify it to use a existing crate.

Envoyé de mon SM-N910F en utilisant Tapatalk

Share this post


Link to post
Share on other sites

Yes I saw that but how do you modify it to use a existing crate.

Envoyé de mon SM-N910F en utilisant Tapatalk

 

You mean a crate you've edited the inventory in the editor? If so, I'm not sure you can.

What I've done when using the supply drop is using these:

https://community.bistudio.com/wiki/addItemCargoGlobal

https://community.bistudio.com/wiki/addWeaponCargoGlobal

https://community.bistudio.com/wiki/addMagazineCargoGlobal

https://community.bistudio.com/wiki/addBackpackCargoGlobal

 

It's tedious but works.

Though, I think there should be a interface like the ones on placed containers in the module to edit the contents of the crate.

Share this post


Link to post
Share on other sites

You mean a crate you've edited the inventory in the editor? If so, I'm not sure you can.

What I've done when using the supply drop is using these:

https://community.bistudio.com/wiki/addItemCargoGlobal

https://community.bistudio.com/wiki/addWeaponCargoGlobal

https://community.bistudio.com/wiki/addMagazineCargoGlobal

https://community.bistudio.com/wiki/addBackpackCargoGlobal

It's tedious but works.

Though, I think there should be a interface like the ones on placed containers in the module to edit the contents of the crate.

Yes I know how to add each item but I was a way to make it easier to do it and I totally agree the content edit should also be available on supply drop.

Thanks for your help

Envoyé de mon SM-N910F en utilisant Tapatalk

Share this post


Link to post
Share on other sites

In the module there is an Expression line, use that to add or remove items from the crate it drops. For example:

 

clearWeaponCargoglobal (_this select 0);
clearmagazinecargoglobal (_this select 0);
clearitemcargoglobal (_this select 0);
clearbackpackcargoglobal (_this select 0);
["AmmoboxInit",[(_this select 0),true,{true}]] call BIS_fnc_arsenal;
  • Like 1

Share this post


Link to post
Share on other sites

 

In the module there is an Expression line, use that to add or remove items from the crate it drops. For example:

 

clearWeaponCargoglobal (_this select 0);
clearmagazinecargoglobal (_this select 0);
clearitemcargoglobal (_this select 0);
clearbackpackcargoglobal (_this select 0);
["AmmoboxInit",[(_this select 0),true,{true}]] call BIS_fnc_arsenal;

 

Yes I know that I was asking if there is a way to call an exist crate or if a window like in the crate where you can chose what to put in without thoses lines..

Share this post


Link to post
Share on other sites

Oh, I see. You want to add items to a crate then drop it with the Supply Drop?

 

I don't that that's possible since the Supply Drop crate is created as it "leaves" the helicopter.

 

You could delete the "new" crate and swap it with the one you added items to. Or name your item crate and run a function to get crate contents and add them to the crate being dropped, but I don't have access to Arma at the moment to test.

Share this post


Link to post
Share on other sites

Oh, I see. You want to add items to a crate then drop it with the Supply Drop?

 

I don't that that's possible since the Supply Drop crate is created as it "leaves" the helicopter.

 

You could delete the "new" crate and swap it with the one you added items to. Or name your item crate and run a function to get crate contents and add them to the crate being dropped, but I don't have access to Arma at the moment to test.

yes but it would be simpler if there was the same interface or similar that the one in the crate interface

Share this post


Link to post
Share on other sites

Place a crate down in 3Den and edit its contents to your liking, be it default or virtual.

Give the crate a name for instance 'myCrate'.

Set it as hidden by unticking showModel option in Object: Special States.

Place this in its init.

fnc_get3DENLoadout = {
    params[ "_veh" ];

    _virtualCargo = [
        [ _veh call BIS_fnc_getVirtualWeaponCargo, [] ],
        [ _veh call BIS_fnc_getVirtualMagazineCargo, [] ],
        [ _veh call BIS_fnc_getVirtualItemCargo, [] ],
        [ _veh call BIS_fnc_getVirtualBackpackCargo, [] ]
    ];

    if ( _virtualCargo findIf{ count ( _x select 0 ) > 0 } > -1 ) then {
        _veh setVariable [ "loadout", [ _virtualCargo, true ] ];
    }else{
        _veh setVariable[ "loadout",
            [
                [
                    getWeaponCargo _veh,
                    getMagazineCargo _veh,
                    getItemCargo _veh,
                    getBackpackCargo _veh
                ],
                false
            ]
        ];
    };
};

this call fnc_get3DENLoadout;

Then in the SupplyDrop modules crate init line place..

[ _this, myCrate getvariable "loadout" ] call BIS_fnc_initAmmobox;

The first bit of code works out what was given to the hidden crate in the editor, then when the supplyDrop creates its crate the loadout is copied to it.

Its some code i wrote in another post for Fiddi last week when he asked a similar question on how to determine an editor loadout of a vehicle/container.

  • Like 4
  • Thanks 2

Share this post


Link to post
Share on other sites

Hi,

 

works also for me. But I would like to run a crate inventory script instead adding the stuff manually in the editor. Usually  I add the script to several crates and cars and I only want to change the inventory and amounts only once. How can I combine this with a supply drop as described above? Short: how to run the sqf from there?

 

This is my script:

//Add this into the init field: null = this execVM "Z_Crate.sqf";
//Settings:
_weaponAmount = 2;
_magAmount = 20;
_itemAmount = 10;
_atAmount = 5;
_drugAmount = 40;
_bandageAmount = 50;

                        clearBackpackCargoGlobal _this;
                        clearWeaponCargoGlobal _this;
                        clearMagazineCargoGlobal _this;
                        clearItemCargoGlobal _this;
                     
                        
                        _this addWeaponCargoGlobal ["UK3CB_BAF_L85A2", _weaponAmount];
                        _this addWeaponCargoGlobal ["UK3CB_BAF_NLAW_Launcher", _weaponAmount];
                        _this addWeaponCargoGlobal ["UK3CB_BAF_AT4_CS_AP_Launcher", _weaponAmount];
                        _this addWeaponCargoGlobal ["rhs_weap_fgm148", _weaponAmount];
                        _this addMagazineCargoGlobal ["UK3CB_BAF_762_100Rnd_T", _magAmount];
                        _this addMagazineCargoGlobal ["UK3CB_BAF_762_L42A1_20Rnd", _magAmount];
                        _this addMagazineCargoGlobal ["UK3CB_BAF_762_L42A1_20Rnd_T", _magAmount];
                        _this addMagazineCargoGlobal ["UK3CB_BAF_127_100Rnd", _magAmount];
                        _this addMagazineCargoGlobal ["UK3CB_BAF_556_30Rnd", _magAmount];
                        _this addMagazineCargoGlobal ["UK3CB_BAF_556_30Rnd_T", _magAmount];
                        _this addMagazineCargoGlobal ["13Rnd_mas_9x21_Mag", _magAmount];    
                        _this addMagazineCargoGlobal ["rhs_fgm148_magazine_AT", _atAmount];                            
                        _this additemcargoGlobal ["ACE_fieldDressing", _bandageAmount];
                        _this additemcargoGlobal ["Laserdesignator", _itemAmount];
                        _this additemcargoGlobal ["ACE_morphine", _drugAmount];
                 _this additemcargoGlobal ["ACE_bloodIV", _drugAmount];
                        _this additemcargoGlobal ["ACE_bloodIV_250", _drugAmount];
                        _this additemcargoGlobal ["ACE_CableTie", _itemAmount];
                        _this additemcargoGlobal ["ACE_epinephrine", _drugAmount];
                        _this additemcargoGlobal ["HandGrenade", _itemAmount];
                        _this additemcargoGlobal ["Laserbatteries", _itemAmount];


      
                  I have already another supply drop script but I have problems with locality on my dedicated server and I'd rather use the Arma supply module

 

Thx

Share this post


Link to post
Share on other sites

Larrow 2 years later and you made my day. I 've lost more than 3 hours on trying everything i found on my mission. Thank you so much for your code..

Share this post


Link to post
Share on other sites

@Larrow or anyone how will no how to make this work. Larrow's script above does not work errors massage something about virtual magazine undefined!!!

Share this post


Link to post
Share on other sites

Yes I know but want to keep as vanilla as I can. You know there are things that always go wrong when adding different scripts into a mission. Updates compatibility scripts interfering with other scripts ECT. there must be a simple way just to be able to edit to put the ammunition I need for my specific layouts of units in this mission.

 

I will keep looking. And I'm still need to look at your framework and feedback.

Share this post


Link to post
Share on other sites

Found a possible solution but a pain in the ass. It would be so much easier if @Larrow Solution code above still  worked by just adding the items you want in the supply box. My issue is I have a 18 man platoon and each unit uses a different weapon some will use the same caliber magazine but that is a lot editing. Lol.

 

 

Support Provider: Supply Drop (Virtual) {SupportProvider_Virtual_Drop}

Methodology

Place Player / Playable Unit(s) that you want to be able to call supports

Place Systems > Modules > Supports > Support Requester {SupportRequester} module

Set any support limits you require

Sync Player / Playable Unit(s) to Support Requester module

If you are using physical helicopters:

Place Systems > Modules > Supports > Support Provider: Supply Drop module

Sync the Support Provider: Supply Drop module to the Support Requester module

Place Physical Transport Heilcopter(s)

Sync Physical Transport Helicopter(s) to the Support Provider: Supply Drop module

If you are using virtual helicopters:

Place Systems > Modules > Supports > Support Provider: Supply Drop (Virtual) module

Sync the Support Provider: Supply Drop (Virtual) module to the Support Requester module

Variables:


System Specific - Support Provider: Supply Drop

Crate Init: Code executed upon crate spawn (Affected crate: _this)


System Specific - Support Provider: Supply Drop (Virtual)

System: Transformation > Position sets where virtual aircraft will spawn

Vehicle Types: Types of vehicles available (Empty array = defaults loaded)

UH-80 Ghost Hawk {B_Heli_Transport_01_F}

CH-67 Huron {B_Heli_Transport_03_F}

CH-67 Huron (Unarmed) {B_Heli_Transport_03_unarmed_F}

UH-80 Ghost Hawk (Sand) {B_Heli_Transport_01_sand_F}

UH-80 Ghost Hawk (Tropic) {B_Heli_Transport_01_tropic_F}

Vehicle Init: Code executed upon vehicle spawn (Affected vehicle: _this)

Crate Init: Code executed upon crate spawn (Affected crate: _this)

Flitered By: Default pool of vehicles to use

Side

Faction

Cooldown: Support availability delay in seconds

Crate Init

Removing existing items from the crate:

clearWeaponCargo _this; clearMagazineCargo _this; clearItemCargo _this; clearBackpackCargo _this;

Adding Weapons:

_this addWeaponCargo [weaponName, count]; _this addMagazineCargo [magazineName, count]; _this addItemCargo [item, count]; _this addBackpackCargo [packClassName, count];

You will need to look up the Class Names for the items you wish to add and use the appropriate addXXXCargo command for each. Links to lists of the most common Class Names you'll need are given below.
Add Smoke to Crate

_signal = "SmokeShellGreen" createVehicle (position _this); _signal attachTo [_this, [0,0,0]];

Adding Virtual Arsenal to a crate:

0 = ["AmmoboxInit", [_this, true]] spawn BIS_fnc_arsenal;

 

Now let my test to see if it still works.

 

  • Like 1

Share this post


Link to post
Share on other sites

Edited code in previous post, removed a lot of unnecessary code left in from quick edit of some previous functionality.

Only quickly tested both default and virtual loadout types. Usage remains the same.

Shout if you have any problems.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

@Larrow thank you sir! I will test play in a game situation to see if any bugs or issues using vanilla units weapons and a few chosen scripts/mod's that I have in the mission. MCC4 and JEBUS are a must for me in any mission I use GAIA for most of the AI logisticsband over site for the AI🥰. Zeus enhanced Eden enhanced Achilles and possibly VCOM AI driving because we all know that the AI pathfinding for driving sucks. 

Share this post


Link to post
Share on other sites

@Larrow it's still stays it's an error missing 

 

'...  False

           ]

|#| 

         ];

    ];

 ];

This call F...'

Error  missing ]

 

I have attempted to add and take away some stuff but no luck. Could you please look at the code again and see if you can adjust. Avibird! 

Share this post


Link to post
Share on other sites
5 hours ago, avibird 1 said:

'...  False

           ]

|#| 

         ];

    ];

 ];

This call F

Dont know what that is, but its not the same as the code in my post...

                false
            ]
        ];
    };
};

this call f

Notice the difference. First two are square brackets followed by two closing braces. Where yours are all square brackets.

Share this post


Link to post
Share on other sites

@Larrow

That is what comes up in the black debug box when I attempted to put your code into the init box of the ammo crate.

Share this post


Link to post
Share on other sites

@avibird 1,

Larrow's script is tight. It reminds me of how to make a merchant container in Bethesda games.
Check your setup is like this,

Spoiler

438077-1571529246.jpg

 

Have fun!

Share this post


Link to post
Share on other sites
21 hours ago, avibird 1 said:

when I attempted to put your code

Again what that error is showing is not my code, literally the code in the error is different as i explained in my last post. Check your brackets/braces.

Share this post


Link to post
Share on other sites

@Larrow ok got your script above to work somewhat now? Not getting the error anymore perhaps I did copy it wrong wouldn't be the first time in my life 😊. With that said there are some serious issues with the script. I attempted to use a DAP supply drop crate (red one). I edited the context to my needs with the type of ammo for my units. I put the appropriate codes in the crate and the module.

 

I can call the airdrop. The supply crate drops but it's not the red one halfway down the parachute cord cuts the crate falls to the ground starts smoking up and then disappears into the ground lol. 

I even set the damage false for the crate but still does not work.

 

If you get a chance could you test this out to see if this is correct or I am doing something incorrect again.  Avibird.

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

×