VHFluffy 1 Posted September 21, 2019 Hello I have been trying a few days to figure this out but no luck. I want my helicopter to respawn with the following INIT field: player addAction ["Heal Tail Rotor", "vehicle player setHitPointDamage ['hitVRotor', 0]"]; player addAction ["Heal Engine", "vehicle player setHitPointDamage ['hitEngine', 0]"]; player addAction ["Break Engine", "vehicle player setHitPointDamage ['hitEngine', 1]"]; player addAction ["Break Tail Rotor", "vehicle player setHitPointDamage ['hitVRotor', 1]"]; player removeAction DCON_Eject Share this post Link to post Share on other sites
zagor64bz 1225 Posted September 22, 2019 Are you using the respawn module or script to respawn the heli? Also, I'm a little confused here. The subject of your add action is the player and not the heli, so why you need the heli to have the add action running? You could add that to the player. Anyway, if you're using the module, the way I would handle it is this: in the expression field of the module: (_this select 0) execVM "add_action.sqf" add_action.sqf player addAction ["Heal Tail Rotor", "vehicle player setHitPointDamage ['hitVRotor', 0]"]; player addAction ["Heal Engine", "vehicle player setHitPointDamage ['hitEngine', 0]"]; player addAction ["Break Engine", "vehicle player setHitPointDamage ['hitEngine', 1]"]; player addAction ["Break Tail Rotor", "vehicle player setHitPointDamage ['hitVRotor', 1]"]; player removeAction DCON_Eject So anytime the heli respawn it runs the add action script..... 1 Share this post Link to post Share on other sites
VHFluffy 1 Posted September 22, 2019 2 hours ago, zagor64bz said: Are you using the respawn module or script to respawn the heli? Also, I'm a little confused here. The subject of your add action is the player and not the heli, so why you need the heli to have the add action running? You could add that to the player. Anyway, if you're using the module, the way I would handle it is this: in the expression field of the module: (this select 0) = [] execVM "add_action.sqf" add_action.sqf player addAction ["Heal Tail Rotor", "vehicle player setHitPointDamage ['hitVRotor', 0]"]; player addAction ["Heal Engine", "vehicle player setHitPointDamage ['hitEngine', 0]"]; player addAction ["Break Engine", "vehicle player setHitPointDamage ['hitEngine', 1]"]; player addAction ["Break Tail Rotor", "vehicle player setHitPointDamage ['hitVRotor', 1]"]; player removeAction DCON_Eject So anytime the heli respawn it runs the add action script..... Thank you for your effort. Please bare with me here as I have never worked with scripts before. I use the Vehicle respawn module. Edit the code as much as you want as long as I can scroll wheel to Break and Heal the specific parts. As I said I am new and I do not know where to paste in the code you gave me. Do I need to make a sqf file and put it in the mission folder or? Share this post Link to post Share on other sites
zagor64bz 1225 Posted September 22, 2019 1 hour ago, VHFluffy said: As I said I am new and I do not know where to paste in the code you gave me. Do I need to make a sqf file and put it in the mission folder or? Don't worry man, we ALL walked there..in the shadow's valley of scripts usage... In the respawn module, look for " Expression" field: write : (_this select 0) execVM "add_action.sqf"; Open notepad++ or any text editor and copy-paste your script: player addAction ["Heal Tail Rotor", "vehicle player setHitPointDamage ['hitVRotor', 0]"]; player addAction ["Heal Engine", "vehicle player setHitPointDamage ['hitEngine', 0]"]; player addAction ["Break Engine", "vehicle player setHitPointDamage ['hitEngine', 1]"]; player addAction ["Break Tail Rotor", "vehicle player setHitPointDamage ['hitVRotor', 1]"]; player removeAction DCON_Eject save as: add_action.sqf in your mission folder (note: be sure to choose "all type" under the save prompt). If it is not already there, move the file "add_action.sqf" in the mission folder, and you're done. 2 1 Share this post Link to post Share on other sites
VHFluffy 1 Posted September 22, 2019 Error message that comes up: "Init: Local variable in global space." If that means anything? Share this post Link to post Share on other sites
VHFluffy 1 Posted September 22, 2019 2 hours ago, zagor64bz said: Don't worry man, we ALL walked there..in the shadow's valley of scripts usage... In the respawn module, look for " Expression" field: write : (_this select 0) execVM "add_action.sqf"; Open notepad++ or any text editor and copy-paste your script: player addAction ["Heal Tail Rotor", "vehicle player setHitPointDamage ['hitVRotor', 0]"]; player addAction ["Heal Engine", "vehicle player setHitPointDamage ['hitEngine', 0]"]; player addAction ["Break Engine", "vehicle player setHitPointDamage ['hitEngine', 1]"]; player addAction ["Break Tail Rotor", "vehicle player setHitPointDamage ['hitVRotor', 1]"]; player removeAction DCON_Eject save as: add_action.sqf in your mission folder (note: be sure to choose "all type" under the save prompt). If it is not already there, move the file "add_action.sqf" in the mission folder, and you're done. Do I have to put in anything in the helicopters's init? Share this post Link to post Share on other sites
zagor64bz 1225 Posted September 22, 2019 1 hour ago, VHFluffy said: Do I have to put in anything in the helicopters's init? Yap..... player addAction ["Heal Tail Rotor", "vehicle player setHitPointDamage ['hitVRotor', 0]"]; player addAction ["Heal Engine", "vehicle player setHitPointDamage ['hitEngine', 0]"]; player addAction ["Break Engine", "vehicle player setHitPointDamage ['hitEngine', 1]"]; player addAction ["Break Tail Rotor", "vehicle player setHitPointDamage ['hitVRotor', 1]"]; player removeAction DCON_Eject In your OP you asked how to RESPAWN the choppa with the above addAction...so I figured you already have that in his init. Enjoy!! 1 Share this post Link to post Share on other sites
VHFluffy 1 Posted September 23, 2019 15 hours ago, zagor64bz said: Yap..... player addAction ["Heal Tail Rotor", "vehicle player setHitPointDamage ['hitVRotor', 0]"]; player addAction ["Heal Engine", "vehicle player setHitPointDamage ['hitEngine', 0]"]; player addAction ["Break Engine", "vehicle player setHitPointDamage ['hitEngine', 1]"]; player addAction ["Break Tail Rotor", "vehicle player setHitPointDamage ['hitVRotor', 1]"]; player removeAction DCON_Eject In your OP you asked how to RESPAWN the choppa with the above addAction...so I figured you already have that in his init. Enjoy!! OK great. IT works in singleplayer but not multiplayer. There is no error message it just does not give me the option when I go multiplayer. Share this post Link to post Share on other sites
zagor64bz 1225 Posted September 23, 2019 6 hours ago, VHFluffy said: OK great. IT works in singleplayer but not multiplayer. There is no error message it just does not give me the option when I go multiplayer. Glad it worked in SP....as far as MP goes, sorry mate, cannot help ya there. MP is a whole new world for me.... 1 Share this post Link to post Share on other sites
VHFluffy 1 Posted September 23, 2019 13 minutes ago, zagor64bz said: Glad it worked in SP....as far as MP goes, sorry mate, cannot help ya there. MP is a whole new world for me.... Thanks for helping me with the SP bud 🙂 1 Share this post Link to post Share on other sites
Mr H. 402 Posted September 23, 2019 Don't put your code in the helicopters init. Put it in your initplayerlocal.sqf Share this post Link to post Share on other sites
VHFluffy 1 Posted September 23, 2019 26 minutes ago, Mr H. said: Don't put your code in the helicopters init. Put it in your initplayerlocal.sqf Nothing hapend 😞 Share this post Link to post Share on other sites
Mr H. 402 Posted September 23, 2019 Are you using this with mods or a mission like DCG? Share this post Link to post Share on other sites
VHFluffy 1 Posted September 23, 2019 1 hour ago, Mr H. said: Are you using this with mods or a mission like DCG? No mods complete Arma 3 Vanilla Share this post Link to post Share on other sites
gokitty1199 225 Posted September 23, 2019 put this in initPlayerLocal.sqf. this should only display the action when the player is inside of a helicopter and should allow anybody to perform these actions(if their in a helicopter) player addAction ["Heal Tail Rotor", { vehicle player setHitPointDamage ["hitVRotor", 0]; }, [], 1.5, true, false, "", "(vehicle player) isKindOf 'helicopter'"]; player addAction ["Heal Engine", { vehicle player setHitPointDamage ["hitEngine", 0]; }, [], 1.5, true, false, "", "(vehicle player) isKindOf 'helicopter'"]; player addAction ["Break Engine", { vehicle player setHitPointDamage ["hitEngine", 1]; }, [], 1.5, true, false, "", "(vehicle player) isKindOf 'helicopter'"]; player addAction ["Break Tail Rotor", { vehicle player setHitPointDamage ["hitVRotor", 1]; }, [], 1.5, true, false, "", "(vehicle player) isKindOf 'helicopter'"]; player removeAction DCON_Eject; Share this post Link to post Share on other sites
VHFluffy 1 Posted September 23, 2019 46 minutes ago, gokitty1199 said: put this in initPlayerLocal.sqf. this should only display the action when the player is inside of a helicopter and should allow anybody to perform these actions(if their in a helicopter) player addAction ["Heal Tail Rotor", { vehicle player setHitPointDamage ["hitVRotor", 0]; }, [], 1.5, true, false, "", "(vehicle player) isKindOf 'helicopter'"]; player addAction ["Heal Engine", { vehicle player setHitPointDamage ["hitEngine", 0]; }, [], 1.5, true, false, "", "(vehicle player) isKindOf 'helicopter'"]; player addAction ["Break Engine", { vehicle player setHitPointDamage ["hitEngine", 1]; }, [], 1.5, true, false, "", "(vehicle player) isKindOf 'helicopter'"]; player addAction ["Break Tail Rotor", { vehicle player setHitPointDamage ["hitVRotor", 1]; }, [], 1.5, true, false, "", "(vehicle player) isKindOf 'helicopter'"]; player removeAction DCON_Eject; When in singeplayer it only shows the Heal tail Rotor option. When in multiplayer it does not show anything. In both cases this error message is displayed: Error Invalid number in expression. Line 8 Anything I'm missing you assume is common sense :)? Share this post Link to post Share on other sites
gokitty1199 225 Posted September 23, 2019 1 hour ago, VHFluffy said: When in singeplayer it only shows the Heal tail Rotor option. When in multiplayer it does not show anything. In both cases this error message is displayed: Error Invalid number in expression. Line 8 Anything I'm missing you assume is common sense :)? weird typo or something as i simply rewrote the line and it decided to no longer have the error eventhough it looked the same. this does work in multiplayer and shows all options(just tested) if you put it in initPlayerLocal.sqf player addAction ["Heal Tail Rotor", { vehicle player setHitPointDamage ["hitVRotor", 0]; }, [], 1.5, true, false, "", "(vehicle player) isKindOf 'helicopter'"]; player addAction ["Heal Engine", { vehicle player setHitPointDamage ["Engine", 0]; }, [], 1.5, true, false, "", "(vehicle player) isKindOf 'helicopter'"]; player addAction ["Break Engine", { vehicle player setHitPointDamage ["hitEngine", 1]; vehicle player setHitPointDamage ["hitEngine2", 1]; vehicle player setHitPointDamage ["hitEngine3", 1]; }, [], 1.5, true, false, "", "(vehicle player) isKindOf 'helicopter'"]; player addAction ["Break Tail Rotor", { vehicle player setHitPointDamage ["hitVRotor", 1]; }, [], 1.5, true, false, "", "(vehicle player) isKindOf 'helicopter'"]; player removeAction DCON_Eject;//no clue what this is but you had it in your original post 1 Share this post Link to post Share on other sites
zagor64bz 1225 Posted September 24, 2019 13 hours ago, gokitty1199 said: weird typo or something as i simply rewrote the line and it decided to no longer have the error eventhough it looked the same. this does work in multiplayer and shows all options(just tested) if you put it in initPlayerLocal.sqf Not your fault man. It's the infamous "invisible forum bug". if you copy-paste your snippet (the first one you wrote) into the "code" tab you'll see plenty of RED DOTS which will trow errors once used in any script.... Try..you'll see. @VHFluffy I suggest you verify EVERY script you copy in the forum by copy-paste it in the code box on the reply field. You'll be surprised how many time scripts don't work because of unwanted "red-dots". Cheers. EDIT: even the second one has the dots.....HAHAHAHAHA...damn little bugs... 2 Share this post Link to post Share on other sites
gokitty1199 225 Posted September 24, 2019 3 hours ago, zagor64bz said: Not your fault man. It's the infamous "invisible forum bug". if you copy-paste your snippet (the first one you wrote) into the "code" tab you'll see plenty of RED DOTS which will trow errors once used in any script.... Try..you'll see. @VHFluffy I suggest you verify EVERY script you copy in the forum by copy-paste it in the code box on the reply field. You'll be surprised how many time scripts don't work because of unwanted "red-dots". Cheers. EDIT: even the second one has the dots.....HAHAHAHAHA...damn little bugs... well thats fun -_- hopefully this is good then https://paste.ofcode.org/39ZRzDa3fMMVNmQ9k2rUrxV 1 Share this post Link to post Share on other sites
VHFluffy 1 Posted September 25, 2019 8 hours ago, gokitty1199 said: well thats fun -_- hopefully this is good then https://paste.ofcode.org/39ZRzDa3fMMVNmQ9k2rUrxV Okay this is completely screwing with my mind. This time no error message appears but it only works in singleplayer not multiplayer (This is if I remove line 21). Break Engine does not work at all. I tried retyping the entire script twice without copy and paste, no luck. Don't know what line 21 does but so far the only difference I have seen is that it does not give an error message. When you tried this in multiplayer did you change any attributes? Share this post Link to post Share on other sites
gokitty1199 225 Posted September 25, 2019 56 minutes ago, VHFluffy said: Okay this is completely screwing with my mind. This time no error message appears but it only works in singleplayer not multiplayer (This is if I remove line 21). Break Engine does not work at all. I tried retyping the entire script twice without copy and paste, no luck. Don't know what line 21 does but so far the only difference I have seen is that it does not give an error message. When you tried this in multiplayer did you change any attributes? it will work in multiplayer, its in the initPlayerLocal, any player that joins the server will get these actions. simply setting damage for the engine isnt enough with the helicopters(afaik) to damage the engine, im not sure what else you need to do though. no i did not, you probably have something removing the actions. Share this post Link to post Share on other sites
VHFluffy 1 Posted September 25, 2019 Thanks for the help guys 🙂 @zagor64bz @gokitty1199 Share this post Link to post Share on other sites