i stripped this out of a mission a while back a played around a bit with it any way to give a soldier the ability to build a sandbag wall just do the following
in the editor name your unit i.e sgt
in the editor create a trigger with Activation non and not present also Type None
in trigger have
Code:
Condition = alive sgt
On Act = sgt execVM "config_sgt.sqf";
now config_sgt.sqf
Code:
sgt exec "sgt_add_build_cover.sqf";
now sgt_add_build_cover.sqf
Code:
if (alive sgt) then {
_actionId = sgt addAction ["Build Cover", "build_cover.sqf", [], -1, false, true, "", "(_target == _this)"];
now build cover.sqf
Code:
_manall = _this select 0;
_idall = _this select 2;
if (alive _manall) then
{
_manall removeAction _idall;
_manall switchMove "AinvPknlMstpSlayWrflDnon_medic";
sleep 1.8;
_manall switchMove "amovpknlmstpsraswrfldnon_gear";
_cover1 = "Land_BagFenceRound" createVehicle [0,0,0];//<=======this is the object class name that you whish to build
_cover2 = "Land_BagFenceRound" createVehicle [0,0,0];//<=======this is the object class name that you whish to build
_cover1 setDir ((direction _manall) -180);
_cover1 setPosATL (_manall modelToWorld [0,1.4,((position _manall) select 2)]);
_cover2 setDir ((direction _manall) -180);
_cover2 setPosATL (_manall modelToWorld [0,1.4,((position _manall) select 2) -0.7]);
//_cover1 setVehicleInit "this allowDamage false";
//_cover2 setVehicleInit "this allowDamage false";
//processInitCommands;
//[] spawn L_Points;
sleep .2;
_manall addAction ["Build Cover", "build_cover.sqf", [], -1, false, true, "", "(_target == _this)"];
};
thats it now just repeat allsteps for every player unit on your mission just have them all point to the one build_cover.sqf file.
you can also use a point system so players cant do it unless they have say 2 points then they lose the 2 points to use it just let me know if you need to know how