OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: joske on 06 Nov 2010, 14:15:08

Title: Using class to addaction
Post by: joske on 06 Nov 2010, 14:15:08
So what i am trying to accomplish is that i will be able to approach any empty vehicle in a certain class as defined in the cfgvehicles and an action menu entry will then show up giving me two new entries, one which will set the fuel level of the vehicle in question to zero and set the fuel level of my vehicle to 1 , the other entry will set the vechiclearmor of the vehicle in question to zero and the armor of my vehicle to 1.In other words i want to be able to salvage from other vehicles.

This is what i have so far:
Salvage_repair_action.sqf
Code: [Select]
_wreck = truck;

_wreck addaction ["Salvage for parts" , "salvage.sqf"];
_wreck addaction ["Salvage for fuel" , "fuel.sqf"];

salvage.sqf
Code: [Select]
truck setvehiclearmor 0;
heli setvehiclearmor 1;

fuel.sqf
Code: [Select]
truck setfuel 0;
heli setfuel 1;

The heli in question doesnt need to be defined using the class i just want to be able to set replace the truck in the first script with a class of the cfgvehicle thingy.

ps: if my explanation isnt clear just ask to clarify things.