Howdy folks.
I'm trying to have a vehicle respawn with certain items in its inventory. Specifically, I'd like to add a camping backpack to use as a respawn point.
This what I've tried...
Place the vehicle...place a VEHICLE RESPAWN MODULE...Sync them together and type this "this addItemCargo [b_Respawn_TentDome_F,1];" into the EDIT VEHICLE RESPAWN - SYSTEM SPECIFIC - VEHICLE RESPAWN EXPRESSION field found in the module attributes.
I'm VERY far from understanding scripting using code placed in .sqf files (or anywhere the script would be entered to be honest), so I'd appreciate answers that only use the modules features.
Or, if you feel that you must give your answer using a script, PLEASE...be generous with your directions. Like I said...I'm pretty damn ignorant when it comes to the stuff.
Thanks in advance.
Since you say you're not very familiar with scripting, once you have more than a few lines of code, it's usually much easier to put that code into its own file to make it easier to read (and therefore easier to spot mistakes), especially once you have things like if statements. So you could take your code and using something like Notepad (or Notepad++) make a file called "addVehicleCargo.sqf" that contains:
params ["_veh"]; // Since we're calling this code from a script file, we need to pass in the vehicle as an argument (the "_this select 0" part below)
_veh lock 0; // And you can put in comments after a double slash to remind you what each line does
if (bob == _veh) then {
_veh addBackpackCargoGlobal ["B_Respawn_TentDome_F", 1];
_veh addItemCargoGlobal ["itemgps", 1]; // It's good practice to end each line with a semicolon, even if it's the last line
}; // So another semicolon here too in case you add something after it later
and save that file in your mission's folder (so it appears alongside your mission.sqm file in the same directory). Then instead of calling those lines of code verbatim inside the module's Expression field, you'd put this instead:
[_this select 0] execVM 'addVehicleCargo.sqf'
and the contents of that file will be executed just like the code you had in that field was previously.