Garmrr 8 Posted December 15, 2017 Hello, I'm in the process of building a mission where 3 vehicles will be assigned MHQ's which all have this in the init field: this addAction ["Teleport to HQ", {player setPos (getPos HQ1)}]; //Teleport to Main HQ 0 = ["AmmoboxInit",[MHQ1,true]] spawn BIS_fnc_arsenal; And it works fine, however upon respawn it resets and it doesn't work anymore. I'm very very new to scripting, in fact this is the first proper mission I'm building, thus I'd like to ask for some help to make it work after respawn. Preferably with some comments explaining what's happening and what the code is "saying" in practical terms. Share this post Link to post Share on other sites
Grumpy Old Man 3546 Posted December 15, 2017 Use the vehicle respawn module, sync it to the vehicle and paste the code into the proper field of the respawn module. Might need to adjust some parameters to fit the criteria ("this" might work though). Just hover your mouse above the fields in the module editing window, the tooltip basically tells you everything. Cheers Share this post Link to post Share on other sites
Garmrr 8 Posted December 15, 2017 3 hours ago, Grumpy Old Man said: Thanks for the answer, I tried entering this into the Expression field with no success: this addAction ["Teleport to HQ", {player setPos (getPos HQ1)}]; 0 = ["AmmoboxInit",[MHQ1,true]] spawn BIS_fnc_arsenal; Also tried: this execVM "MHQ1.sqf"; MHQ1.sqf: vehInit = { clearWeaponCargoGlobal _this; clearMagazineCargoGlobal _this; this addAction ["Teleport to HQ", {player setPos (getPos HQ1)}]; 0 = ["AmmoboxInit",[MHQ1,true]] spawn BIS_fnc_arsenal; }; But still no success, could you give an example if possible? (Should be noted this is for a dedicated server.) Share this post Link to post Share on other sites
pierremgi 4905 Posted December 16, 2017 As GOM said, you have to read and follow hints for each field of the module. About the expression field, you can read,hovering your cursor: [<new vehicle>,<old vehicle>] passed as parameters. So, _this can be used here for such array. If you need to refer to the respawned vehicle, just use (_this select 0): (_this select 0) addAction ["Teleport to HQ", {player setPos (getPos HQ1)}]; ["AmmoboxInit",[(_this select 0),true]] spawn BIS_fnc_arsenal; Note: <this>, without underscore, is a magic variable referring to the object, usually a unit or a vehicle which you refer in its own init field. Don't use it here. 2 Share this post Link to post Share on other sites
JIMMI DEE BILLY BOB 4 Posted October 18, 2019 On 12/16/2017 at 1:51 AM, pierremgi said: As GOM said, you have to read and follow hints for each field of the module. About the expression field, you can read,hovering your cursor: [<new vehicle>,<old vehicle>] passed as parameters. So, _this can be used here for such array. If you need to refer to the respawned vehicle, just use (_this select 0): (_this select 0) addAction ["Teleport to HQ", {player setPos (getPos HQ1)}]; ["AmmoboxInit",[(_this select 0),true]] spawn BIS_fnc_arsenal; Note: <this>, without underscore, is a magic variable referring to the object, usually a unit or a vehicle which you refer in its own init field. Don't use it here. 82/5000 hi, i have a problem repeating other than the first part of the script in the respawn module script, Original in the vehicle init, and i works. 0 = this setPylonLoadOut[3, "PylonRack_Missile_HARM_x1", true]; 0 = this setPylonLoadOut[4, "PylonRack_Missile_HARM_x1", true]; 0 = this setPylonLoadOut[1, "PylonMissile_Missile_BIM9X_x1", true]; 0 = this setPylonLoadOut[2, "PylonMissile_Missile_BIM9X_x1", true]; 0 = this setPylonLoadOut[5, "", true]; 0 = this setPylonLoadOut[6, "", true]; result = [this, "CamoGrey", []] call BIS_fnc_initVehicle; this addEventHandler ["Fired", {_this execVM "trackShell.sqf";}]; But in the expression field there I come _this select 0 setPylonLoadOut[3, "PylonRack_Missile_HARM_x1", true]; _this select 0 setPylonLoadOut[4, "PylonRack_Missile_HARM_x1", true]; _this select 0 setPylonLoadOut[1, "PylonMissile_Missile_BIM9X_x1", true]; _this select 0 setPylonLoadOut[2, "PylonMissile_Missile_BIM9X_x1", true]; _this select 0 setPylonLoadOut[5, "", true]; _this select 0 setPylonLoadOut[6, "", true]; result = [this, "CamoGrey", []] call BIS_fnc_initVehicle; _this select 0 addEventHandler ["Fired", {_this execVM "trackShell.sqf";}]; On respawn, only pylan 3 with a PylonRack_Missile_HARM_x1 has been changed, thus the first part of the script. Please help me pierremg, practically all the script I use comes from you 😄 I beg you Share this post Link to post Share on other sites
pierremgi 4905 Posted October 18, 2019 @JIMMI DEE BILLY BOB Thanks for your confidence. I'm using my own script or module to respawn vehicle with all the stuff (waypoints, textures, pylons, addActions, arsenal...) I don't know what your aircraft is. Anyway, your expression code should like this: _veh = _this #0; _veh setPylonLoadOut[3, "PylonRack_Missile_HARM_x1", true]; _veh setPylonLoadOut[4, "PylonRack_Missile_HARM_x1", true]; _veh setPylonLoadOut[1, "PylonMissile_Missile_BIM9X_x1", true]; _veh setPylonLoadOut[2, "PylonMissile_Missile_BIM9X_x1", true]; _veh setPylonLoadOut[5, "", true]; _veh setPylonLoadOut[6, "", true]; [_veh, "CamoGrey", []] call BIS_fnc_initVehicle; _veh addEventHandler ["Fired", {_this execVM "trackShell.sqf"}] 1 Share this post Link to post Share on other sites
JIMMI DEE BILLY BOB 4 Posted October 19, 2019 Thank you pierremgi you just solved hundreds of hours of headaches with no result ❤️ And of course it works. I've looked through the AI VEHICLE RESPAWN script many times, but I've never been able to figure it out, my feeble mind can't handle all the symbols, I get the feel of the vomit feeling after looking at the scripts for too long, I think that means I'm dyslexic too. feeble minded 😄 Share this post Link to post Share on other sites