Sign in to follow this  
Followers 0
.Doppelpoint

remove vehicle ammo (Y-32 Xi'an)

10 posts in this topic

Hey all,

i need some help to remove the ammo from the Xian.

i would like to remove ONLY the Xian ammo not of all vehicles ammo. im using also Virtuell garage so if  somone fetch it schould have also empty ammo.

i try this:

_vehicleArray = allMissionObjects "O_T_VTOL_02_infantry_hex_F";

{
 _x removeMagazinesTurret ["Rockets_Skyfire",[0]]    
} forEach _vehicleArray;

but still not working :/ anyone some ideas?

Share this post


Link to post
Share on other sites

found a better way to remove all the ammo from vehicle

_vehicleArray = allMissionObjects "O_T_VTOL_02_infantry_F";

{
 _x setVehicleAmmo 0;
 
} forEach _vehicleArray;

i think my problem is the code run to early if the server didnt spawn the vehicles so how can i put a delay like 25sec?

Share this post


Link to post
Share on other sites
Advertisement
8 hours ago, .Doppelpoint said:

found a better way to remove all the ammo from vehicle

_vehicleArray = allMissionObjects "O_T_VTOL_02_infantry_F";

{
 _x setVehicleAmmo 0;
 
} forEach _vehicleArray;

i think my problem is the code run to early if the server didnt spawn the vehicles so how can i put a delay like 25sec?

sleep 25;

I expect that will do it.

1 person likes this

Share this post


Link to post
Share on other sites

I use this (remove weapons and ammo script in the script section somewhere):
ExileServer_object_vehicle_createPersistantVehicle.sqf:

/**
 * ExileServer_object_vehicle_createPersistentVehicle
 *
 * 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","_usePositionATL","_pinCode","_vehicleObject"];
_className = _this select 0;
_position = _this select 1;
_direction = _this select 2;
_usePositionATL = _this select 3;
_pinCode = _this select 4;
_vehicleObject = [_className, _position, _direction, _usePositionATL] call ExileServer_object_vehicle_carefulCreateVehicle;

//Let's remove missiles!
_vehicleObject removeWeaponTurret ["missiles_DAR",[-1]];
_vehicleObject removeWeaponTurret ["missiles_DAGR",[-1]];
//Disable Weapons on VTOLs
_vehicleObject removeWeaponTurret ["missiles_SCALPEL",[0]];
_vehicleObject removeWeaponTurret ["rockets_Skyfire",[0]];

_vehicleObject setVariable ["ExileIsPersistent", true];
_vehicleObject setVariable ["ExileAccessCode", _pinCode];
_vehicleObject addEventHandler ["GetOut", {_this call ExileServer_object_vehicle_event_onGetOut}];
_vehicleObject addEventHandler ["GetIn", {_this call ExileServer_object_vehicle_event_onGetIn}];
_vehicleObject addMPEventHandler ["MPKilled", { if !(isServer) exitWith {}; _this call ExileServer_object_vehicle_event_onMPKilled;}];
_vehicleObject call ExileServer_system_simulationMonitor_addVehicle;
_vehicleObject

That works on any VTOL which is bought or spawned as persistent by admins. We still allow machine guns, so you'd need to find the reference for that.

Then, reference the above file in your config.cpp file:

class CfgExileCustomCode 
{
	/*
		You can overwrite every single file of our code without touching it.
		To do that, add the function name you want to overwrite plus the 
		path to your custom file here. If you wonder how this works, have a
		look at our bootstrap/fn_preInit.sqf function.

		Simply add the following scheme here:

		<Function Name of Exile> = "<New File Name>";

		Example:

		ExileClient_util_fusRoDah = "myaddon\myfunction.sqf";
	*/

	//Remove Weapons from vehicles
	ExileServer_object_vehicle_createPersistentVehicle = "addons\ExileServer_object_vehicle_createPersistentVehicle.sqf";
};

Hope that helps a bit if you dont use the other above methods

1 person likes this

Share this post


Link to post
Share on other sites
8 hours ago, Paul said:

I use this (remove weapons and ammo script in the script section somewhere):
ExileServer_object_vehicle_createPersistantVehicle.sqf:


/**
 * ExileServer_object_vehicle_createPersistentVehicle
 *
 * 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","_usePositionATL","_pinCode","_vehicleObject"];
_className = _this select 0;
_position = _this select 1;
_direction = _this select 2;
_usePositionATL = _this select 3;
_pinCode = _this select 4;
_vehicleObject = [_className, _position, _direction, _usePositionATL] call ExileServer_object_vehicle_carefulCreateVehicle;

//Let's remove missiles!
_vehicleObject removeWeaponTurret ["missiles_DAR",[-1]];
_vehicleObject removeWeaponTurret ["missiles_DAGR",[-1]];
//Disable Weapons on VTOLs
_vehicleObject removeWeaponTurret ["missiles_SCALPEL",[0]];
_vehicleObject removeWeaponTurret ["rockets_Skyfire",[0]];

_vehicleObject setVariable ["ExileIsPersistent", true];
_vehicleObject setVariable ["ExileAccessCode", _pinCode];
_vehicleObject addEventHandler ["GetOut", {_this call ExileServer_object_vehicle_event_onGetOut}];
_vehicleObject addEventHandler ["GetIn", {_this call ExileServer_object_vehicle_event_onGetIn}];
_vehicleObject addMPEventHandler ["MPKilled", { if !(isServer) exitWith {}; _this call ExileServer_object_vehicle_event_onMPKilled;}];
_vehicleObject call ExileServer_system_simulationMonitor_addVehicle;
_vehicleObject

That works on any VTOL which is bought or spawned as persistent by admins. We still allow machine guns, so you'd need to find the reference for that.

Then, reference the above file in your config.cpp file:


class CfgExileCustomCode 
{
	/*
		You can overwrite every single file of our code without touching it.
		To do that, add the function name you want to overwrite plus the 
		path to your custom file here. If you wonder how this works, have a
		look at our bootstrap/fn_preInit.sqf function.

		Simply add the following scheme here:

		<Function Name of Exile> = "<New File Name>";

		Example:

		ExileClient_util_fusRoDah = "myaddon\myfunction.sqf";
	*/

	//Remove Weapons from vehicles
	ExileServer_object_vehicle_createPersistentVehicle = "addons\ExileServer_object_vehicle_createPersistentVehicle.sqf";
};

Hope that helps a bit if you dont use the other above methods

Thank you very much and it works like a charm. ;) but 1 question what does the -1 or 0 mean?

Edited by .Doppelpoint

Share this post


Link to post
Share on other sites
1 hour ago, .Doppelpoint said:

Thank you very much and it works like a charm. ;) but 1 question what does the -1 or 0 mean?

That's the position of the gun.

There is a bit of code you can run to find which gun is in each position (I just closed my game so can't get it right now). I think they're all in position 0 on the VTOLs

1 person likes this

Share this post


Link to post
Share on other sites
On 12.9.2016 at 1:04 PM, Paul said:

I use this (remove weapons and ammo script in the script section somewhere):
ExileServer_object_vehicle_createPersistantVehicle.sqf:


/**
 * ExileServer_object_vehicle_createPersistentVehicle
 *
 * 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","_usePositionATL","_pinCode","_vehicleObject"];
_className = _this select 0;
_position = _this select 1;
_direction = _this select 2;
_usePositionATL = _this select 3;
_pinCode = _this select 4;
_vehicleObject = [_className, _position, _direction, _usePositionATL] call ExileServer_object_vehicle_carefulCreateVehicle;

//Let's remove missiles!
_vehicleObject removeWeaponTurret ["missiles_DAR",[-1]];
_vehicleObject removeWeaponTurret ["missiles_DAGR",[-1]];
//Disable Weapons on VTOLs
_vehicleObject removeWeaponTurret ["missiles_SCALPEL",[0]];
_vehicleObject removeWeaponTurret ["rockets_Skyfire",[0]];

_vehicleObject setVariable ["ExileIsPersistent", true];
_vehicleObject setVariable ["ExileAccessCode", _pinCode];
_vehicleObject addEventHandler ["GetOut", {_this call ExileServer_object_vehicle_event_onGetOut}];
_vehicleObject addEventHandler ["GetIn", {_this call ExileServer_object_vehicle_event_onGetIn}];
_vehicleObject addMPEventHandler ["MPKilled", { if !(isServer) exitWith {}; _this call ExileServer_object_vehicle_event_onMPKilled;}];
_vehicleObject call ExileServer_system_simulationMonitor_addVehicle;
_vehicleObject

That works on any VTOL which is bought or spawned as persistent by admins. We still allow machine guns, so you'd need to find the reference for that.

Then, reference the above file in your config.cpp file:


class CfgExileCustomCode 
{
	/*
		You can overwrite every single file of our code without touching it.
		To do that, add the function name you want to overwrite plus the 
		path to your custom file here. If you wonder how this works, have a
		look at our bootstrap/fn_preInit.sqf function.

		Simply add the following scheme here:

		<Function Name of Exile> = "<New File Name>";

		Example:

		ExileClient_util_fusRoDah = "myaddon\myfunction.sqf";
	*/

	//Remove Weapons from vehicles
	ExileServer_object_vehicle_createPersistentVehicle = "addons\ExileServer_object_vehicle_createPersistentVehicle.sqf";
};

Hope that helps a bit if you dont use the other above methods

Hey its me again^^

i had this code in exile version 1.0.1 it works without problems in sweet potato but now in Exile version 1.0.2 it seems not to work more.

if i add this script my whole server dont start, if i remove this script my server start up without any problems.

was there changes in the vehicle code?, i also checked the Code from exile 1.0.1 of the ExileServer_object_vehicle_createPersistentVehicle.sqf but in 1.0.2 is the code equal.

is there any fix for this script or a an alternative?

Edited by .Doppelpoint

Share this post


Link to post
Share on other sites
55 minutes ago, Paul said:

Mine works ok. Any errors in your log?

Sorry forgot to paste the error:

_vehicleObject setVariable ["ExileOwnerUID", (getPlayer>
  Error position: <setVariable ["ExileOwnerUID", (getPlayer>
  Error Generic error in expression
 File exile_server\code\ExileServer_system_trading_network_purchaseVehicleRequest.sqf, line 65

my remove.sqf

Spoiler

 /**
 * ExileServer_object_vehicle_createPersistentVehicle
 *
 * 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","_usePositionATL","_pinCode","_vehicleObject"];
_className = _this select 0;
_position = _this select 1;
_direction = _this select 2;
_usePositionATL = _this select 3;
_pinCode = _this select 4;
_vehicleObject = [_className, _position, _direction, _usePositionATL] call ExileServer_object_vehicle_carefulCreateVehicle;

//REMOVE XIAN AMMO
_vehicleObject removeWeaponTurret ["gatling_30mm_VTOL_02",[0]];
_vehicleObject removeWeaponTurret ["missiles_SCALPEL",[0]];
_vehicleObject removeWeaponTurret ["rockets_Skyfire",[0]];

//REMOVE JET AMMO | Jet "Twin_Cannon_20mm","missiles_zephyr","missiles_ASRAAM" **alles -1
_vehicleObject removeWeaponTurret ["Twin_Cannon_20mm",[-1]];
_vehicleObject removeWeaponTurret ["missiles_zephyr",[-1]];

_vehicleObject setVariable ["ExileIsPersistent", true];
_vehicleObject setVariable ["ExileAccessCode", _pinCode];
_vehicleObject addEventHandler ["GetOut", {_this call ExileServer_object_vehicle_event_onGetOut}];
_vehicleObject addEventHandler ["GetIn", {_this call ExileServer_object_vehicle_event_onGetIn}];
_vehicleObject addMPEventHandler ["MPKilled", { if !(isServer) exitWith {}; _this call ExileServer_object_vehicle_event_onMPKilled;}];
_vehicleObject call ExileServer_system_simulationMonitor_addVehicle;
_vehicleObject

added this code in customcode class

       ExileServer_object_vehicle_createPersistentVehicle = "scripts\vammo\remove.sqf";

 

Share this post


Link to post
Share on other sites

You're referencing 2 different files in your post. We changed ExileServer_object_vehicle_createPersistentVehicle, not  exile_server\code\ExileServer_system_trading_network_purchaseVehicleRequest.sqf

1 person likes this

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

  • Recently Browsing   0 members

    No registered users viewing this page.