Jump to content
BriCro

Vehicle AddAction change loadout?

Recommended Posts

Hey everyone,

 

This may seem simple, but I've been trying to lately get more into scripting so I've been trying to do some basic things. I'm looking for some help to wrap my brain around this to add to a mission.

I'm trying to have a vehicle that when you approach it  you can scrollwheel and change your loadout:  "Get loadout Team Leader", "Get Rifleman (AT)", "Get Automatic Rifleman".

 

So would I addAction to the Vehicle as?
 

    _myvehicle addAction [call teamleader.sqf  "Get Team Leader loadout"]



or would I...

 

 _myvehicle addAction [call "teamleader.sqf"  "Get Team Leader loadout"]

 

Then I would put the loadout SQF in the mission folder?

waitUntil {!isNull player};

_unit = _this select 0;

null = [_unit] execVM  "TeamLeader.sqf";


removeAllWeapons this;
removeallassigneditems this;
removeallcontainers this;
removeuniform this;
removevest this;
removebackpack this;

_unit  addVest "rhsusf_spc_teamleader";
_unit  addUniform "rhs_uniform_FROG01_wd";
_unit  addBackPack "rhsusf_falconii_coy";
_unit  addHeadgear "rhsusf_lwh_helmet_marpatwd_headset_blk";
 
_unit addWeapon 'Binocular';

_unit additem 'ItemWatch';
_unit additem 'ItemMap';
_unit additem 'ItemCompass';
_unit additem 'tf_anprc152_2';

_unit assignitem 'ItemMap';
_unit assignitem 'ItemWatch';
_unit assignitem 'ItemCompass';
_unit assignitem 'tf_anprc152_2';

_unit  addWeapon "rhs_weap_m4a1_carryhandle_m203S";
_unit  addPrimaryWeaponItem "rhsusf_acc_ACOG2_USMC";
_unit  addPrimaryWeaponItem "acc_pointer_IR";

_unit addMagazines ["rhs_mag_30Rnd_556x45_M855_Stanag", 10,"vest"];
        
_unit addItemToUniform ["ACE_morphine",5,];
_unit addItemToUniform ["ACE_fieldDressing",5,"uniform"];
_unit addItemToUniform ["ACE_elasticBandage",7,"uniform"];
_unit addItemToUniform ["ACE_quikclot",7,"uniform"];
_unit additem ["ACE_epinephrine",1,"uniform"];
_unit additem ["ACE_packingBandage",8,"uniform"];
_unit additem ["ACE_tourniquet",1,"uniform"];
_unit additem ["ACE_CableTie",1,"vest"];
_unit additem ["ACE_Flashlight_XL50",1,"vest"];
_unit additem ["SmokeShellGreen",1,"vest"];
_unit additem ["SmokeShell",1,"vest"];
_unit additem ["Chemlight_green",2,"vest"];
_unit additem ["rhs_mag_M433_HEDP",3,"vest"];
_unit additem ["HandGrenade",2,"vest"];
_unit addmagazine ["rhsusf_mag_17Rnd_9x19_JHP",2,"vest"];
_unit additem

_unit addmagazine ["rhs_mag_m714_White",3,"vest"];
_unit addmagazine ["rhs_mag_M433_HEDP",2,"backpack"];
_unit addmagazine ["rhs_mag_m714_White",4,"backpack"];
_unit addmagazine ["rhs_mag_30Rnd_556x45_M855_Stanag",4,"backpack"];

_unit addweapon "rhsusf_weap_glock17g4";
_unit addHandgunItem "acc_flashlight_pistol";


if(true) exitWith{};



I know some of this is going to seem like "wtf are you doing" but im trying here. Please help! Thank you!

Share this post


Link to post
Share on other sites

Your idea is fine. Just a few points on your approach.

 

Read through the biki page for addAction, and that should address your question (and very clear formatting issue) regarding your use of the command.

 

I am assuming that large code block is teamleader.sqf. If so, why are you execVM'ing it again? That is what the addAction is accomplishing, or so I thought. Either way, you don't need the "null" when using execVM in a script file. 

 

Try to be consistent about use of single or double quotes. Which one to use is a whole different question and, arguably, personal preference, but you should still pick just one. 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×