swampfox87 0 Posted October 18, 2018 Hello guys, i hope you can help me with this? look i have this code for an helicopter rotor fail trainning: _vehicle = vehicle player; if (_vehicle isKindOf "Air") then { _vehicle addAction["<t color='#ff0000'>DESTROY: MAIN ROTOR</t>","(vehicle player) setHitPointDamage ['HitHRotor', 1.0]; hint 'ROTOR DESTROYED';",[],-98,false,false,"",'']; But i want it to run on every helicopter for everyone inside so it fails for every player inside the helicopter, i tested yesterday but i only saw the dmg the copilot didnt, he was still flying as normal, but in my pc the engine was damaged and stopped, but as my friend was copilot he continued flying as normal. I was testing this into the debug console on a dedicated server in nitrado, i excecuted it as global and local, without results Thanks guys i hope u understand my description. Share this post Link to post Share on other sites
pierremgi 4905 Posted October 18, 2018 Welcome Don't use this ugly yelling font, prefer the code and or spoiler options in the edition bar of your text You can use some search for addAction in the search field upper right of the section you can also read the whole BIKI page about addAction and seHitPointDamage It's always better to explain where you're firing your code. For example here, you start with a local variable: _vehicle which can be forbidden in some cases (like in unscheduled scope of triggers or init fields...) Tell us also in what circumstance you want that code. At start? After some completed task?... For edited + spawned helo(s)? Well, at first step: { _x addAction ["<t color='#ff0000'>DESTROY: MAIN ROTOR</t>",{ params ["_target", "_caller", "_id"]; [_target, ["HitHRotor", 1.0] ] remoteExec ["setHitPointDamage",_target]; "ROTOR DESTROYED" remoteExec ["hint",crew _target]; [_target,_id] remoteExec ["removeAction"] },[],-98,false,false,"","_target == vehicle _this && alive _target"] } foreach (vehicles select {_x isKindOf "helicopter"}); should work if added for all clients, in init.sqf for example. Not tested EDITED Share this post Link to post Share on other sites
swampfox87 0 Posted October 18, 2018 Just now, pierremgi said: Welcome Don't use this ugly yelling font, prefer the code and or spoiler options in the edition bar of your text You can use some search for addAction in the search field upper right of the section you can also read the whole BIKI page about addAction and seHitPointDamage It's always better to explain where you're firing your code. For example here, you start with a local variable: _vehicle which can be forbidden in some cases (like in unscheduled scope of triggers or init fields...) Tell us also in what circumstance you want that code. At start? After some completed task?... For edited + spawned helo(s)? Well, at first step: { _x addAction ["<t color='#ff0000'>DESTROY: MAIN ROTOR</t>",{ params ["_target", "_caller", "_id"]; [ ["HitHRotor", 1.0] ] remoteExec ["setHitPointDamage",_target]; "ROTOR DESTROYED" remoteExec ["hint",crew _target]; _target removeAction _id },[],-98,false,false,"","_target == vehicle _this && alive _target"] } foreach (vehicles select {_x isKindOf "helicopter"}); should work if added for all clients, in init.sqf for example. Not tested Im new to this forum sorry for using those big words :), and i need that code permanently active in the server because we hace an academy base for trainning so the helis are parked in the spots for the pilots to use them and with the scroll they can dmg the machine on air. So i need the failures can be activated anytime while in helicopters, that is why i was trying to use the debug to activate when flying the helis. Share this post Link to post Share on other sites
pierremgi 4905 Posted October 18, 2018 Modified a line to make it work on rotor. Testing.... Corrected the remove Action for all players also. As you know, some parts are dependable (see the config viewer for the Huron). You can hit the other parts with this hardcoded dependence, replacing: [_target, ["HitHRotor", 1.0] ] remoteExec ["setHitPointDamage",_target]; by: [_target,"HitHRotor", 1.0] remoteExec ["BIS_fnc_setHitPointDamage",_target]; Tested on Huron. The consequences are not the same of course. Make your choice! Share this post Link to post Share on other sites
swampfox87 0 Posted October 19, 2018 So the complete code Will be like this? { _x addAction ["<t color='#ff0000'>DESTROY: MAIN ROTOR</t>",{ params ["_target", "_caller", "_id"]; [_target,"HitHRotor", 1.0] remoteExec ["BIS_fnc_setHitPointDamage",_target]; "ROTOR DESTROYED" remoteExec ["hint",crew _target]; _target removeAction _id },[],-98,false,false,"","_target == vehicle _this && alive _target"] } foreach (vehicles select {_x isKindOf "helicopter"}); with the new modified line? and should i put this into the init of each helicopter? or debug console? By the way thanks in advance for helping me out :) Share this post Link to post Share on other sites
pierremgi 4905 Posted October 19, 2018 This code (my FIRST post, updated) works for all helicopters. So place it in init.sqf. Please stop copying/pasting anything, anywhere! Your code above misses the correct removeAction (remote executed). You can choose the setHitPointDamage command or the bis_fnc_setHitPointDamage function which extend the damage of the described part (here horizontal rotor) to dependable parts like vertical rotor or other parts. The command strikes one part, the function strikes this part + calculated dependable parts (see the class and sub-class hitparts of your helicopter in config viewer). Share this post Link to post Share on other sites
swampfox87 0 Posted October 29, 2018 Thank you very much, and sorry for being copying the text, i will try as you said. Thanks a lot Share this post Link to post Share on other sites