Jump to content

Recommended Posts

Hi everyone, after playing around with mission making and looking to add a bit more immersion is there a way to combine placed loot piles in the Eden Editor? I.e. you lay out weapons, magazines, etc and instead of them all being individual loot piles is there a way to combine them into one and still retain the individual item placement?

Share this post


Link to post
Share on other sites

Depends on how the loot piles are created. If players drop loot then one method would be to use manipulate the dropped loot using InventoryClosed EH. Something like:

player addEventHandler ["InventoryClosed",
{
	params ["_unit", "_container"];
	// Search within 200 m radius for nearby loot holders
	_nearbyLoot = nearestObjects [_unit, ["WeaponHolder", "GroundWeaponHolder", "WeaponHolderSimulated"], 200] - [_container];
	hintSilent str _nearbyLoot;
	if (count _nearbyLoot isEqualTo 0) exitWith {};
	{
		_itemType = _x call BIS_fnc_itemType;
		switch (_itemType select 0) do
		{
			case "Weapon" :
			{
					(_nearbyLoot select 0) addWeaponCargoGlobal [_x, 1];
			};
			case "Magazine" :
			{
					(_nearbyLoot select 0) addMagazineCargoGlobal [_x, 1];
			};
			case "Item" :
			{
					(_nearbyLoot select 0) addItemCargoGlobal [_x, 1];
			};
			case "Equipment" :
			{
				if ((_itemType select 1) isEqualTo "Backpack") then
				{
					(_nearbyLoot select 0) addBackpackCargoGlobal [_x, 1];
				} else
				{
					(_nearbyLoot select 0) addItemCargoGlobal [_x, 1];
				};
			};
		};
	} forEach (weaponCargo _container) + (magazineCargo _container) + (itemCargo _container) + (backpackCargo _container);
	// Delete the old loot pile
	deleteVehicle _container;
}];

It is kinda sloppy but was trying to keep it all in one without using external functions that I have to get the item much easier, etc... However, more than enough to get you started (hopefully). My brain hurts when coming back to SQF after doing a ton of web development programming. lol

 

EDIT: TESTED AND WORKING!

Still can be improved though. Not sure if objectParent is needed here (for this specific example) so didn't bother.

  • Like 1

Share this post


Link to post
Share on other sites

You can combine loot piles ("GroundWeaponHolder"/"WeaponHolderSimulated") just fine, but you cannot specify the orientation of what's in it.

Everything in a single container will be a single pile.

Share this post


Link to post
Share on other sites
16 hours ago, Sgt. Dennenboom said:

but you cannot specify the orientation of what's in it.

You could by making your own custom weapon holder 3D Model. But that's probably out of scope for you.

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

×