Chaosnz82

[SOLVED] adding a weapon to a vehicle

5 posts in this topic

looking to add weapons to vehicles that normally dont come with any, ive been searching about and come up with this bit of code,.. not sure if i did it right as its pretty much the first time ive scripted anything for arma 3,..

I put it in ExileServer_object_vehicle_createPersistentVehicle.sqf

the line is if (typeOf _vehicleObject player == "Exile_Plane_Ceasar") then ...

Quote

/**
 * Exile Mod
 * exile.majormittens.co.uk
 * © 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 = createVehicle [_className, _position, [], 0, "CAN_COLLIDE"];

 

if (typeOf _vehicleObject player == "Exile_Plane_Ceasar") then

{

_vehicleObject addWeaponTurret ["missiles_DAR",[-1]};

};


clearBackpackCargoGlobal _vehicleObject;
clearItemCargoGlobal _vehicleObject;
clearMagazineCargoGlobal _vehicleObject;
clearWeaponCargoGlobal _vehicleObject;
_position set[2, (_position select 2) + 0.25];
_vehicleObject setDir _direction;        
if (_usePositionATL) then
{
    _vehicleObject setPosATL _position;
}
else
{
    _vehicleObject setPosASL _position;
};
_vehicleObject setVariable ["ExileIsPersistent", true];
_vehicleObject setVariable ["ExileAccessCode",_pinCode];
_vehicleObject addEventHandler ["GetOut", { _this call ExileServer_object_vehicle_event_onGetOut}];
_vehicleObject addMPEventHandler ["MPKilled", { _this call ExileServer_object_vehicle_event_onMPKilled}];
_vehicleObject call ExileServer_system_simulationMonitor_addVehicle;
_vehicleObject

is it going to work?

Edited by Chaosnz82

Share this post


Link to post
Share on other sites
Advertisement

Not quite sure whats happening as to why this doesn't work, but after doing a bit of research and coming across a few different posts about where it should go etc, this is the best i could come up with. Purchasing said vehicles from my traders ingame returns vehicles with no weapons on, even creating through infiSTAR has no effect. The RPT logs show no errors as they once did with my above code. Any ideas/help in this matter would be highly appreciated.

Thank you.

 

Quote

/**
 * ExileServer_object_vehicle_createPersistentVehicle
 *
 * Exile Mod
 * exile.majormittens.co.uk
 * © 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;
_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;}];


if(_className == "Exile_Bike_QuadBike_Black") then
{
    _vehicleObject addWeaponTurret              ["LMG_Minigun_Transport",[-1]];
    _vehicleObject addMagazineTurret            ["2000Rnd_65x39_Belt_Tracer_Red",[-1]];
    _vehicleObject addMagazineTurret            ["2000Rnd_65x39_Belt_Tracer_Red",[-1]];
};

if(_className == "Exile_Plane_AN2_Green") then
{
        _vehicleObject addWeaponTurret ["Gatling_30mm_Plane_CAS_01_F",[-1]];
        _vehicleObject addMagazineTurret ["1000Rnd_Gatling_30mm_Plane_CAS_01_F",[-1]];
        _vehicleObject addMagazineTurret ["1000Rnd_Gatling_30mm_Plane_CAS_01_F",[-1]];
};

_vehicleObject call ExileServer_system_simulationMonitor_addVehicle;

_vehicleObject

 

Share this post


Link to post
Share on other sites

I found the items list from Behemia and added the armed hunter, ifrit, strider and the slammer UP to my server. It was a simple addition to the pricing list and "trucks" list

That way you could have the regular ones but also (once you get top rep) you could buy the armed ones for a lot more.

Edited by cannibalmerk

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.