• 1
Razzmatazz

Easy Fix for Harvesting Shipping Containers

Question

I know with the latest Arma update, shipping containers are no longer destructable. However, harvesting them with a sledgehammer technically still works. When you hit them enough times, the junk metal still spawns underneath the container. Sometimes you can still reach it if the container is on uneven ground. Why not just make the metal spawn at the player's feet rather than under the container? Would be consistent with how chopping wood works.

Share this post


Link to post
Share on other sites

7 answers to this question

  • 0

Agreed.  Would like to get an answer on this.  Shouldn't the code be similar to chopping wood, only the item drop wouldn't be a 1:1 ratio of hit to metal drop?  Maybe 5:1 or 4:1

Share this post


Link to post
Share on other sites
Advertisement
  • 0

And here's the easy fix
ExileServer_object_shippingContainer_network_smashShippingContainerRequest.sqf

 

Spoiler

/**
 * ExileServer_object_shippingContainer_network_smashShippingContainerRequest
 *
 * Exile Mod
 * www.exilemod.com
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. 
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_sessionId","_parameters","_shippingContainer","_player","_shippingContainerVolume","_damagePerHit","_newDamage","_shippingContainerPosition","_numberOfItems","_weaponHolder"];
_sessionId = _this select 0;
_parameters = _this select 1;
_shippingContainer = _parameters select 0;
try 
{
	if (isNull _shippingContainer) then 
	{
		throw format ["Cannot smash unknown shipping container!"];
	};
	if !(alive _shippingContainer) then 
	{
		throw "Cannot smash destroyed shipping container!";
	};
	if !([_shippingContainer, "ShippingContainerSource"] call ExileClient_util_model_isInteraction) then 
	{
		throw "Can only smash shipping containers!";
	};
	_player = _sessionId call ExileServer_system_session_getPlayerObject;
	if (isNull _player) then 
	{
		throw "Unknown players cannot smash shipping containers!";
	};
	if !(alive _player) then 
	{
		throw "The dead cannot smash shipping containers!";
	};
	if ((_player distance _shippingContainer) > 30) then 
	{
		throw "No long distance shipping container smashing! Nope!";
	};
	_shippingContainerVolume = _shippingContainer call ExileClient_util_model_getBoundingBoxVolume;
	if (_shippingContainerVolume < 1) then 
	{
		_shippingContainerVolume = 1;
	};
	_damagePerHit = (1 / (_shippingContainerVolume * 0.5)) min 0.2; 
	_newDamage = ((damage _shippingContainer) + _damagePerHit) min 1;
	if (_newDamage isEqualTo 1) then 
	{
		_shippingContainerPosition = getPosATL _shippingContainer;
		_shippingContainerPosition set[2, 0];
		_shippingContainer setDamage 999;
		_spawnRadius = 3;
		_numberOfItems = (ceil (_shippingContainerVolume / 10)) max 1;
		_weaponHolders = nearestObjects[_shippingContainerPosition, ["GroundWeaponHolder"], _spawnRadius];
		_weaponHolder = objNull;
		if (_weaponHolders isEqualTo []) then
		{	
			_weaponHolderPosition = getPosATL _player;
			_weaponHolder = createVehicle ["GroundWeaponHolder", _weaponHolderPosition, [], 0, "CAN_COLLIDE"];
			_weaponHolder setPosATL _weaponHolderPosition;
		}
		else 
		{
			_weaponHolder = _weaponHolders select 0;
		};
	}
	else 
	{
		_shippingContainer setDamage _newDamage; 
	};
	_weaponHolder addMagazineCargoGlobal ["Exile_Item_JunkMetal", _numberOfItems];
}
catch 
{
	_exception call ExileServer_util_log;
};
true

 

 

Edited by MGTDB
  • Like 4

Share this post


Link to post
Share on other sites
  • 0
3 hours ago, MetalHead said:

@MGTDB This didn't appear to do anything I'm afraid. Any ideas ?

Wierd, as just that changed file caused the loot pile to spawn here next to me

NP7UwNr.jpg

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.