lawlessbaron 1 Posted December 3, 2013 Ok hey guys i am working on a mod and i am wondering without the vehicle being deadly with weapons whats a script or line i can add to my init.sqf or seperate file for all vehicles that get spawned to remove the ammo from the weapons on it? would this work in the init? player setVehicleAmmo 0; Share this post Link to post Share on other sites
mad_cheese 593 Posted December 3, 2013 (edited) I am not sure what you want to achieve, but player setvehicleammo 0 is not the right command since it refers to a player and not a spawned vehicle. if you want to spawn a vehicle without ammo, for whatever reasons you might have, you can add this function to your init.sqf: NoAmmoVehicle = { private ["_position","_type","_side"]; _position = _this select 0; _type = _this select 1; _side = _this select 2; _vehicle = [_position, 0, _type, _side] call BIS_fnc_spawnVehicle; (_vehicle select 0) setvehicleammo 0; }; and then later call it with: [someposition,"somevehicletype",side] call NoAmmoVehicle; Another option btw, if you just don't want the vehicle to fire, is to set the crew's combatmode to "blue" instead of removing their ammo. disableAI for "target" and "autotarget" could be an extra addition. Edited December 3, 2013 by Mad_Cheese syntax mistake Share this post Link to post Share on other sites
lawlessbaron 1 Posted December 3, 2013 Mad_Cheese said: I am not sure what you want to achieve, but player setvehicleammo 0 is not the right command since it refers to a player and not a spawned vehicle.if you want to spawn a vehicle without ammo, for whatever reasons you might have, you can add this function to your init.sqf: NoAmmoVehicle = { private ["_position","_type","_side"]; _position = _this select 0; _type = _this select 1; _side = _this select 2; _vehicle = [_position, 0, _type, _side] call BIS_fnc_spawnVehicle; (_vehicle select 0) setvehicleammo 0; }; and then later call it with: [someposition,"somevehicletype",side] call NoAmmoVehicle; Another option btw, if you just don't want the vehicle to fire, is to set the crew's combatmode to "blue" instead of removing their ammo. disableAI for "target" and "autotarget" could be an extra addition. I want to apply it some vehicles people use Share this post Link to post Share on other sites
mad_cheese 593 Posted December 3, 2013 LawlessBaron said: I want to apply it some vehicles people use ok... unfortunately I am only somewhat experienced in SP scriping... but this should not be a big problem to fix. you just have to make sure that the script is only executed on the computer that the vehicle is local to (most likely the server/dedi in this case) and you actually execute it on the vehicle. I hope somebody else with MP experience will help you out. If this is for a respawning vehicle, you might just have to add an eventhandler to the vehicle so that it has it's ammo removed on respawn. If you spawn the vehicles somewhere in the open, try this unless someone more qualified answers you: init.sqf: NoAmmoVehicle = { private ["_position","_type","_vehicle"]; _position = _this select 0; _type = _this select 1; _vehicle = createVehicle [_type, _position, [], 0, "None"]; _vehicle setvehicleammo 0; clearWeaponCargoGlobal _vehicle; }; and then later use it with if (isdedicated OR isserver) then { [position,vehicletype] call NoAmmoVehicle; }; Jeez I hope this is correct :D like I said I have only been scripting for SP missions. I'm kinda curious why you don't just use an unarmed vehicle.. If I would board a vehicle with a weapon but no ammo, I'd probably not be too pleased unless it's my task to rearm somewhere... Share this post Link to post Share on other sites
lawlessbaron 1 Posted December 5, 2013 Mad_Cheese said: ok... unfortunately I am only somewhat experienced in SP scriping... but this should not be a big problem to fix. you just have to make sure that the script is only executed on the computer that the vehicle is local to (most likely the server/dedi in this case) and you actually execute it on the vehicle. I hope somebody else with MP experience will help you out. If this is for a respawning vehicle, you might just have to add an eventhandler to the vehicle so that it has it's ammo removed on respawn. If you spawn the vehicles somewhere in the open, try this unless someone more qualified answers you:init.sqf: NoAmmoVehicle = { private ["_position","_type","_vehicle"]; _position = _this select 0; _type = _this select 1; _vehicle = createVehicle [_type, _position, [], 0, "None"]; _vehicle setvehicleammo 0; clearWeaponCargoGlobal _vehicle; }; and then later use it with if (isdedicated OR isserver) then { [position,vehicletype] call NoAmmoVehicle; }; Jeez I hope this is correct :D like I said I have only been scripting for SP missions. I'm kinda curious why you don't just use an unarmed vehicle.. If I would board a vehicle with a weapon but no ammo, I'd probably not be too pleased unless it's my task to rearm somewhere... Its for an RPG mod so that when and if the SWAT need to use a LAV that it doesn't have ammo im also looking for indestructible building script Share this post Link to post Share on other sites