Jump to content
Sign in to follow this  
dave_beastttt

ExileMod - Script to end floating containers (safes etc)

Recommended Posts

What the script does is, it checks at server load, if the container object has floor below it within 3 metres. If not, it loads the item at ground level. If the player then returns the floor below the container, at next server restart it is automatically returned to it's original position

1 file to change in exile_server/code


ExileServer_object_container_createContainer.sqf

 

Spoiler

/**
 * ExileServer_object_container_createContainer
 *
 * 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["_className","_position","_direction","_containerObject","_flag","_xPosition","_yPosition","_zPosition","_newPos"];
_className = _this select 0;
_position = _this select 1;
_direction = _this select 2;
_containerObject = createVehicle [_className, _position, [], 0, "CAN_COLLIDE"];
clearBackpackCargoGlobal _containerObject;
clearItemCargoGlobal _containerObject;
clearMagazineCargoGlobal _containerObject;
clearWeaponCargoGlobal _containerObject;
_containerObject setDir _direction;
_flag = _containerObject call ExileClient_util_world_getTerritoryAtPosition;
if !(isNull _flag) then 
{
	if(getPos _containerObject select 2 > 3)then
	{
		_xPosition = _position select 0;
		_yPosition = _position select 1;
		_zPosition = 0.1;
		_newPos = [_xPosition,_yPosition,_zPosition];
		_containerObject setPos _newPos;
	}
	else
	{
		_containerObject setPosATL _position;
	};
}
else
{
	_containerObject setPosATL _position;
};
_containerObject setVariable ["ExileIsPersistent", true];
_containerObject setVariable ["ExileIsContainer", true];
if(getNumber(configFile >> "CfgVehicles" >> typeOf _containerObject >> "exileIsLockable") isEqualTo 1)then
{
	_containerObject setVariable ["ExileIsLocked", -1,true];
};
if (getNumber(missionConfigFile >> "CfgSimulation" >> "enableDynamicSimulation") isEqualTo 1) then 
{
	_containerObject enableDynamicSimulation true;
}
else
{
	_containerObject call ExileServer_system_simulationMonitor_addVehicle;
};
_containerObject

 


Here's the 3 stages

Floor in place below safes

iCwIKS5.jpg

Player removes floor below safes/containers

cWipRLJ.jpg

After next server restart, the safes/containers will be at ground level

XBkzrgX.jpg

If they then return the floor as per 1st image, the safes are automatically returned to their position next server restart

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites
Sign in to follow this  

×