Removing ammo from vehicles (Bliss)

J3T

Valued Member!
Hey Guys i have a little issue.
I want to remove the ammo from specific vehicle (not from every vehicle) like the T90. Everything i found for it yet was:
http://community.bistudio.com/wiki/removeMagazinesTurret
But i have no clue how to get it working. Can anybody explain it to me please? Or does anybody maybe have a script that removes specific vehicle ammunition?

sincerly J3T
 

Hangender

Valued Member!
example:
Code:
_a10 = "A10" createVehicle [(getMarkerPos "PlaneSpawn" select 0), (getMarkerPos "PlaneSpawn" select 1), 250];
_a10 setPos [(getPos _a10 select 0) + (_x * 40), getPos _a10 select 1, 250];
_a10 engineOn true;
_a10 setDir 290;
_dir = 290;
_speed = 500;
_a10 setVelocity [(sin _dir * _speed),(cos _dir * _speed), 0];
_a10 removeWeapon "MaverickLauncher"; _a10 removeMagazine "5Rnd_Maverick_A10"; _a10 addWeapon "BombLauncher"; _a10 addMagazine "6Rnd_GBU12_AV8B";
 

J3T

Valued Member!
Is it right if i put it in right there?

if (_damage < 1) then {
diag_log format["OBJ: %1 - %2", _idKey,_type];

//Create it
_object = createVehicle [_type, _pos, [], 0, "CAN_COLLIDE"];
_object setVariable ["lastUpdate",time];
_a10 = "A10" createVehicle [(getMarkerPos "PlaneSpawn" select 0), (getMarkerPos "PlaneSpawn" select 1), 250];
_a10 setPos [(getPos _a10 select 0) + (_x * 40), getPos _a10 select 1, 250];
_a10 engineOn true;
_a10 setDir 290;
_dir = 290;
_speed = 500;
_a10 setVelocity [(sin _dir * _speed),(cos _dir * _speed), 0];
_a10 removeWeapon "MaverickLauncher"; _a10 removeMagazine "5Rnd_Maverick_A10"; _a10 addWeapon "BombLauncher"; _a10 addMagazine "6Rnd_GBU12_AV8B";
if (_ownerID == "0") then {_object setVariable ["ObjectID", str(_idKey), true];} else {_object setVariable ["ObjectUID", str(_idKey),true];}; //_object setVariable ["ObjectID", _idKey, true];
_object setVariable ["CharacterID", _ownerID, true];

clearWeaponCargoGlobal _object;
clearMagazineCargoGlobal _object;
 

J3T

Valued Member!
K, i think this should be better... just think twice about it^^:

//Add Magazines
_objWpnTypes = (_intentory select 1) select 0;
_objWpnQty = (_intentory select 1) select 1;
_countr = 0;
_a10 = "A10" createVehicle [(getMarkerPos "PlaneSpawn" select 0), (getMarkerPos "PlaneSpawn" select 1), 250];
_a10 setPos [(getPos _a10 select 0) + (_x * 40), getPos _a10 select 1, 250];
_a10 engineOn true;
_a10 setDir 290;
_dir = 290;
_speed = 500;
_a10 setVelocity [(sin _dir * _speed),(cos _dir * _speed), 0];
_a10 removeWeapon "MaverickLauncher"; _a10 removeMagazine "5Rnd_Maverick_A10"; _a10 addWeapon "BombLauncher"; _a10 addMagazine "6Rnd_GBU12_AV8B";
{
if (_x == "BoltSteel") then { _x = "WoodenArrow" }; // Convert BoltSteel to WoodenArrow
_isOK =isClass(configFile >> "CfgMagazines" >> _x);
if (_isOK) then {
_block =getNumber(configFile >> "CfgMagazines" >> _x >> "stopThis") == 1;
if (!_block) then {
_object addMagazineCargoGlobal [_x,(_objWpnQty select _countr)];
};
};
_countr = _countr + 1;
} forEach _objWpnTypes;
 

Kind-Sir

OpenDayZ Rockstar!
I wrote a tutorial on adding an action to the pilot of an MV22 that will allow the pilot to open and close the back ramp.

This is done via your mission .pbo
You can, of course, implement this server-side if it would be based on vehicles and not on the players.

The code in this is fairly simple, and it will allow you to customize it in such a way that it will apply for any vehicle you entitle.

http://opendayz.net/threads/tutorial-mv22-ramp-door-animations.9009/

This type of code stems from the =BTC= Fast Rope:
http://opendayz.net/threads/tutorial-btc-fast-roping.9004/


So, if you wanted to manipulate it to get rid of ammo from a vehicle, you would do something along these lines:

Code:
VehiclesToBeStripped = ["A10","T90"]
A10Weapons = ["MaverickLauncher","BombLauncherA10","FFARLauncher_14","GAU8"];
A10Magazines = ["5Rnd_Maverick_A10","4Rnd_GBU12","14Rnd_FFAR","1350Rnd_30mmAP_A10"];
T90Weapons = ["PKT","SmokeLauncher","2A46M","2A46MRocket"];
T90Magazines = ["250Rnd_762x54_PKT_T90","SmokeLauncherMag","23Rnd_125mmSABOT_T72","22Rnd_125mmHE_T72","5Rnd_AT11_T90"];
{
    _veh = _this select 0;
    if (typeOf _veh == "A10") then {
        {
            _veh removeWeapon A10Weapons[_x];
        } foreach A10Weapons
        {
            _veh removeMagazine A10Magazines[_x];
        } foreach A10Magazines
    }
    if (typeOf _veh == "T90") then {
        {
            _veh removeWeapon T90Weapons[_x];
        } foreach T90Weapons
        {
            _veh removeMagazine T90Magazines[_x];
        } foreach T90Magazines
    }
} foreach (nearestObjects [[3000,3000,0], VehiclesToBeStripped, 50000]);
**THIS HAS NOT BEEN TESTED**
Weapon classnames obtained from - http://community.bistudio.com/wiki/ArmA_2:_Weapons#Vehicle_.26_Static_Weapons

This would be put into a .sqf file inside your mission.pbo, and run via the init.sqf.
 

J3T

Valued Member!
So that i get it right. This is what i have to do:
Create files called: removeammo.sqf
Insert your code into the removeammo.sqf.
But what do i have to insert into the init.sqf?


*edit*
I just update your code a bit. Hope got everything right.

VehiclesToBeStripped = ["A10","T90","T34"]
A10Weapons = ["MaverickLauncher","BombLauncherA10","FFARLauncher_14","GAU8"];
A10Magazines = ["5Rnd_Maverick_A10","4Rnd_GBU12","14Rnd_FFAR","1350Rnd_30mmAP_A10"];
T90Weapons = ["PKT","SmokeLauncher","2A46M","2A46MRocket"];
T90Magazines = ["250Rnd_762x54_PKT_T90","SmokeLauncherMag","23Rnd_125mmSABOT_T72","22Rnd_125mmHE_T72","5Rnd_AT11_T90"];
T34Weapons = ["DT_veh","ZiS_S_53"];
T34Magazines = ["60Rnd_762x54_DT","10Rnd_85mmAP","33Rnd_85mmHE"];
{
_veh = _this select 0;
if (typeOf _veh == "A10") then {
{
_veh removeWeapon A10Weapons[_x];
} foreach A10Weapons
{
_veh removeMagazine A10Magazines[_x];
} foreach A10Magazines
}
if (typeOf _veh == "T90") then {
{
_veh removeWeapon T90Weapons[_x];
} foreach T90Weapons
{
_veh removeMagazine T90Magazines[_x];
} foreach T90Magazines
}
if (typeOf _veh == "T34") then {
{
_veh removeWeapon T34Weapons[_x];
} foreach T34Weapons
{
_veh removeMagazine T34Magazines[_x];
} foreach T34Magazines
}
} foreach (nearestObjects [[3000,3000,0], VehiclesToBeStripped, 50000]);
 

J3T

Valued Member!
Just played it on our Server last night. Got more script restrictions than i've could count. We disabled around 40 but there were still more. So we just take it down and reactivate the restrictions. Anyone no why we've got so many? (Script restriction #239-#200...of course we added +2 in our script.txt).

I've anyone got a clue.... please let me know it.
 

Attachments

Kind-Sir

OpenDayZ Rockstar!
Just played it on our Server last night. Got more script restrictions than i've could count. We disabled around 40 but there were still more. So we just take it down and reactivate the restrictions. Anyone no why we've got so many? (Script restriction #239-#200...of course we added +2 in our script.txt).

I've anyone got a clue.... please let me know it.
It would probably be fit to change the code into your dayz_server.pbo.
Due to the code manipulating vehicles (removing weapons and magazines), it would probably fit best within the server's code.

I'll do some tests in a bit with this.
 

J3T

Valued Member!
Thanks for that. We really apriciate your help. And if we get it working I'm pretty sure it will be usefull for someone else.

How do i implement this into the dayz_server.pbo? Shall i put it into the compile ordner and/or just add a line to the server_functions.sqf? Or do i have to do something completly diffrent?
 

Kind-Sir

OpenDayZ Rockstar!
I'll set up my test server after work and send you the progress that I have made.

The script I posted was arranged a little bit in which it allowed me to remove specified weapons and magazines from vehicles in arma 2.

More tests to come.
 

J3T

Valued Member!
I'll set up my test server after work and send you the progress that I have made.

The script I posted was arranged a little bit in which it allowed me to remove specified weapons and magazines from vehicles in arma 2.

More tests to come.
Thank you very much :).
 
Top