Brahma281 11 Posted March 30, 2020 Hello everyone! I need start script when you call support through the command menu. Is it possible to implement this? Share this post Link to post Share on other sites
gc8 977 Posted March 31, 2020 Should be possible via communication menu https://community.bistudio.com/wiki/Arma_3_Communication_Menu simplest to do would be by radio menu though.. Share this post Link to post Share on other sites
Brahma281 11 Posted March 31, 2020 4 hours ago, Larrow said: Thanks for the answer. I put this code in player's init to test, but I get an error every time. What am I doing wrong,how do I fix it? Can you write step by step what should I do?I'm just not that good at scripts yet. Share this post Link to post Share on other sites
opusfmspol 280 Posted March 31, 2020 1. Give better information. It was put in the local player init script, or in the player's init attribute field in editor? The discussion indicated the editor field inits wouldn't work. Should go in a local player init script. 2. The event handler is checking player and object variables, so the handler should not get added until player and the modules have initialized. 3. The handler doesn't check for the variables being nil. You want to include isNil checks to deal with when they come back nil. 3. Post the error given. Tough to guess when not given. But maybe the object variables are nil if they haven't yet been set. 4. Also should post the code as you have used it. We could assume you copy pasted accurately, but hey, sometimes not, it happens. 5. Pay attention to @Larrow's given description of the conditions. Third condition checks for a support being in progress. Is that what you want? 1 Share this post Link to post Share on other sites
Brahma281 11 Posted March 31, 2020 24 minutes ago, opusfmspol said: 1. Give better information. It was put in the local player init script, or in the player's init attribute field in editor? The discussion indicated the editor field inits wouldn't work. Should go in a local player init script. 2. The event handler is checking player and object variables, so the handler should not get added until player and the modules have initialized. 3. The handler doesn't check for the variables being nil. You want to include isNil checks to deal with when they come back nil. 3. Post the error given. Tough to guess when not given. But maybe the object variables are nil if they haven't yet been set. 4. Also should post the code as you have used it. We could assume you copy pasted accurately, but hey, sometimes not, it happens. 5. Pay attention to @Larrow's given description of the conditions. Third condition checks for a support being in progress. Is that what you want? Yes, I put the code in the player's inir attribute field in editor,but an error also occurs if use debugging console Here is the error I get when I run the code Spoiler here is the code I used Spoiler [ "supportCalled", "onEachFrame", { if ((player getVariable "BIS_SUPP_request") select 0 != "" && count ((player getVariable "BIS_SUPP_request") select 1) == 3 && (player getVariable "BIS_SUPP_selectedProvider") getVariable "BIS_SUPP_supporting") then { hint "support called"; //do what ever here }; } ] call BIS_fnc_addStackedEventHandler; I have artillery (a1), I have SupportProvider (arty1) and I have SupportRequester(req), they are all synchronized. I need to run my script when start calling the artillery or when marking a target on map. Share this post Link to post Share on other sites
Harzach 2517 Posted March 31, 2020 35 minutes ago, opusfmspol said: 1. Give better information. It was put in the local player init script, or in the player's init attribute field in editor? The discussion indicated the editor field inits wouldn't work. Should go in a local player init script. 12 minutes ago, Brahma281 said: Yes, I put the code in the player's inir attribute field in editor,but an error also occurs if use debugging console Neither of those locations are the local player init script (initPlayerLocal.sqf). //do what ever here This is where your code goes. Share this post Link to post Share on other sites
Brahma281 11 Posted March 31, 2020 @opusfmspol Do not regard my request as arrogance,but if you would be so kind,can you make an example mission where everything works? And will this code work in the co-op mission? Share this post Link to post Share on other sites
Brahma281 11 Posted March 31, 2020 13 minutes ago, Harzach said: Neither of those locations are the local player init script (initPlayerLocal.sqf). I created initPlayerLocal.sqf and put the code there, the error(line1) occurs as before. Share this post Link to post Share on other sites
Harzach 2517 Posted March 31, 2020 Works fine here, read the last part of my previous post. https://www.dropbox.com/s/s4o8aofeujzjzw7/supportTest.VR.pbo?dl=0 2 Share this post Link to post Share on other sites
Brahma281 11 Posted April 1, 2020 2 hours ago, Harzach said: Works fine here, read the last part of my previous post. https://www.dropbox.com/s/s4o8aofeujzjzw7/supportTest.VR.pbo?dl=0 Buddy, I really appreciate you posting this mission, because otherwise I would never have found out what the problem was. I don't know how to even describe it, because the problem was how the game recognizes BIS_fnc_addStackedEventHandler Spoiler Spoiler Share this post Link to post Share on other sites
Harzach 2517 Posted April 1, 2020 I've been seeing this a lot lately, people finding themselves with curled quotes or other "special" characters as a result of copy/pasting from ... I don't know exactly, some sort of formatted text from the forums or Reddit or something. Sometimes, it's worth it to just copy it out by hand if you are having weird issues like this. Good luck, have fun! 1 Share this post Link to post Share on other sites
Brahma281 11 Posted April 1, 2020 Folks, I couldn't solve the problem for a long time and I am very grateful to everyone who responded. Thanks. SOLVED. 1 Share this post Link to post Share on other sites
Twiznak 57 Posted April 1, 2020 15 hours ago, Larrow said: Hi Larrow! Thank you for helping. Your code works without a hitch. Calls whatever code when ANY support request is called. [ "supportCalled", "onEachFrame", { if ((player getVariable "BIS_SUPP_request") select 0 != "" && count ((player getVariable "BIS_SUPP_request") select 1) == 3 && (player getVariable "BIS_SUPP_selectedProvider") getVariable "BIS_SUPP_supporting") then { hint "support called"; //do what ever here }; } ] call BIS_fnc_addStackedEventHandler; Would you please so us how to do this with specific request modules? for example: requester module "req_1", artillery strike module(virtual) "arty_1". Please Sir. Share this post Link to post Share on other sites
Larrow 2820 Posted April 1, 2020 9 hours ago, Twiznak said: Would you please so us how to do this with specific request provider modules? [ "supportCalled", "onEachFrame", { if ( ( player getVariable "BIS_SUPP_request" ) select 0 == "Artillery" && ( player getVariable "bis_supp_selectedmodule" ) == arty_1 && ( player getVariable "BIS_SUPP_selectedProvider" ) getVariable[ "BIS_SUPP_supporting", false ] ) then { //do what ever here hint "Arty1 is providing support"; }; }] call BIS_fnc_addStackedEventHandler; Should really be changed to newer onEachFrame EH or some keyUp event for support menu open, but I'm feeling lazy and just editing old code. Some handy variables... Spoiler //player [ "bis_supp_allprovidermodules", "bis_supp_ammotype", "bis_supp_burst", "bis_supp_hq", "bis_supp_limit_artillery_total", "bis_supp_limit_cas_bombing_total", "bis_supp_limit_cas_heli_total", "bis_supp_limit_drop_total", "bis_supp_limit_transport_total", "bis_supp_limit_uav_total", "bis_supp_popup_id_artillery", "bis_supp_popup_pool", "bis_supp_providerspoolforpick", "bis_supp_request", "bis_supp_selectedmodule", "bis_supp_selectedprovider", "bis_supp_selectedproviderveh", "bis_supp_transmitting", "bis_supp_used_artillery", "bis_supp_used_cas_bombing", "bis_supp_used_cas_heli", "bis_supp_used_drop", "bis_supp_used_transport", "bis_supp_used_uav" ] //requester module [ "bis_supp_custom_hq", "bis_supp_limit_artillery", "bis_supp_limit_cas_bombing", "bis_supp_limit_cas_heli", "bis_supp_limit_drop", "bis_supp_limit_transport", "bis_supp_limit_uav" ] //provider module( virtual artillery ) [ "bis_supp_cooldown", "bis_supp_filter", "bis_supp_lastcall", "bis_supp_vehicleinit", "bis_supp_vehicles" ] //provider object( as per spawned virtual artilery operator (player getVariable "bis_supp_selectedprovider") ) [ "bis_supp_ammotype", "bis_supp_burst", "bis_supp_requester", "bis_supp_supporting", "bis_supp_supportruncoords", "bis_supp_supporttype", "bis_supp_virtual" ] Some of these are only available at specific times and some maybe limited to specific provider types. All the above where queried at the time of call to a virtual artillery. Messing around with support protocol... Spoiler [ "supportCalled", "onEachFrame", { if ( ( player getVariable "BIS_SUPP_request" ) select 0 == "Artillery" && ( player getVariable "bis_supp_selectedmodule" ) == arty_1 && ( player getVariable "BIS_SUPP_selectedProvider" ) getVariable[ "BIS_SUPP_supporting", false ] ) then { [] spawn { _person = ( player getVariable "BIS_SUPP_selectedProvider" ); _receiver = ( player getVariable "BIS_SUPP_selectedProvider" ) getVariable [ "bis_supp_requester", player ]; _topic = "BIS_SUPP_protocol"; _sentenceId_complete = "Artillery_Rounds_Complete"; _maxAge = 10; waitUntil{ _person kbWasSaid[ _receiver, _topic, _sentenceId_complete, _maxAge ] }; systemChat "Artilley: COMPLETED"; }; }; }] call BIS_fnc_addStackedEventHandler; 1 1 Share this post Link to post Share on other sites
Twiznak 57 Posted April 1, 2020 Spoiler 10 hours ago, Larrow said: [ "supportCalled", "onEachFrame", { if ( ( player getVariable "BIS_SUPP_request" ) select 0 == "Artillery" && ( player getVariable "bis_supp_selectedmodule" ) == arty_1 && ( player getVariable "BIS_SUPP_selectedProvider" ) getVariable[ "BIS_SUPP_supporting", false ] ) then { //do what ever here hint "Arty1 is providing support"; }; }] call BIS_fnc_addStackedEventHandler; Should really be changed to newer onEachFrame EH or some keyUp event for support menu open, but I'm feeling lazy and just editing old code. Some handy variables... Reveal hidden contents //player [ "bis_supp_allprovidermodules", "bis_supp_ammotype", "bis_supp_burst", "bis_supp_hq", "bis_supp_limit_artillery_total", "bis_supp_limit_cas_bombing_total", "bis_supp_limit_cas_heli_total", "bis_supp_limit_drop_total", "bis_supp_limit_transport_total", "bis_supp_limit_uav_total", "bis_supp_popup_id_artillery", "bis_supp_popup_pool", "bis_supp_providerspoolforpick", "bis_supp_request", "bis_supp_selectedmodule", "bis_supp_selectedprovider", "bis_supp_selectedproviderveh", "bis_supp_transmitting", "bis_supp_used_artillery", "bis_supp_used_cas_bombing", "bis_supp_used_cas_heli", "bis_supp_used_drop", "bis_supp_used_transport", "bis_supp_used_uav" ] //requester module [ "bis_supp_custom_hq", "bis_supp_limit_artillery", "bis_supp_limit_cas_bombing", "bis_supp_limit_cas_heli", "bis_supp_limit_drop", "bis_supp_limit_transport", "bis_supp_limit_uav" ] //provider module( virtual artillery ) [ "bis_supp_cooldown", "bis_supp_filter", "bis_supp_lastcall", "bis_supp_vehicleinit", "bis_supp_vehicles" ] //provider object( as per spawned virtual artilery operator (player getVariable "bis_supp_selectedprovider") ) [ "bis_supp_ammotype", "bis_supp_burst", "bis_supp_requester", "bis_supp_supporting", "bis_supp_supportruncoords", "bis_supp_supporttype", "bis_supp_virtual" ] Some of these are only available at specific times and some maybe limited to specific provider types. All the above where queried at the time of call to a virtual artillery. Messing around with support protocol... Reveal hidden contents [ "supportCalled", "onEachFrame", { if ( ( player getVariable "BIS_SUPP_request" ) select 0 == "Artillery" && ( player getVariable "bis_supp_selectedmodule" ) == arty_1 && ( player getVariable "BIS_SUPP_selectedProvider" ) getVariable[ "BIS_SUPP_supporting", false ] ) then { [] spawn { _person = ( player getVariable "BIS_SUPP_selectedProvider" ); _receiver = ( player getVariable "BIS_SUPP_selectedProvider" ) getVariable [ "bis_supp_requester", player ]; _topic = "BIS_SUPP_protocol"; _sentenceId_complete = "Artillery_Rounds_Complete"; _maxAge = 10; waitUntil{ _person kbWasSaid[ _receiver, _topic, _sentenceId_complete, _maxAge ] }; systemChat "Artilley: COMPLETED"; }; }; }] call BIS_fnc_addStackedEventHandler; Larrow, yes! Thank you dude! I going to get to work with this right now. Thank you! Share this post Link to post Share on other sites
Mahler_Chopin 0 Posted May 12, 2021 On 4/1/2020 at 3:30 PM, Larrow said: [ "supportCalled", "onEachFrame", { if ( ( player getVariable "BIS_SUPP_request" ) select 0 == "Artillery" && ( player getVariable "bis_supp_selectedmodule" ) == arty_1 && ( player getVariable "BIS_SUPP_selectedProvider" ) getVariable[ "BIS_SUPP_supporting", false ] ) then { //do what ever here hint "Arty1 is providing support"; }; }] call BIS_fnc_addStackedEventHandler; Should really be changed to newer onEachFrame EH or some keyUp event for support menu open, but I'm feeling lazy and just editing old code. Some handy variables... Reveal hidden contents //player [ "bis_supp_allprovidermodules", "bis_supp_ammotype", "bis_supp_burst", "bis_supp_hq", "bis_supp_limit_artillery_total", "bis_supp_limit_cas_bombing_total", "bis_supp_limit_cas_heli_total", "bis_supp_limit_drop_total", "bis_supp_limit_transport_total", "bis_supp_limit_uav_total", "bis_supp_popup_id_artillery", "bis_supp_popup_pool", "bis_supp_providerspoolforpick", "bis_supp_request", "bis_supp_selectedmodule", "bis_supp_selectedprovider", "bis_supp_selectedproviderveh", "bis_supp_transmitting", "bis_supp_used_artillery", "bis_supp_used_cas_bombing", "bis_supp_used_cas_heli", "bis_supp_used_drop", "bis_supp_used_transport", "bis_supp_used_uav" ] //requester module [ "bis_supp_custom_hq", "bis_supp_limit_artillery", "bis_supp_limit_cas_bombing", "bis_supp_limit_cas_heli", "bis_supp_limit_drop", "bis_supp_limit_transport", "bis_supp_limit_uav" ] //provider module( virtual artillery ) [ "bis_supp_cooldown", "bis_supp_filter", "bis_supp_lastcall", "bis_supp_vehicleinit", "bis_supp_vehicles" ] //provider object( as per spawned virtual artilery operator (player getVariable "bis_supp_selectedprovider") ) [ "bis_supp_ammotype", "bis_supp_burst", "bis_supp_requester", "bis_supp_supporting", "bis_supp_supportruncoords", "bis_supp_supporttype", "bis_supp_virtual" ] Some of these are only available at specific times and some maybe limited to specific provider types. All the above where queried at the time of call to a virtual artillery. Messing around with support protocol... Reveal hidden contents [ "supportCalled", "onEachFrame", { if ( ( player getVariable "BIS_SUPP_request" ) select 0 == "Artillery" && ( player getVariable "bis_supp_selectedmodule" ) == arty_1 && ( player getVariable "BIS_SUPP_selectedProvider" ) getVariable[ "BIS_SUPP_supporting", false ] ) then { [] spawn { _person = ( player getVariable "BIS_SUPP_selectedProvider" ); _receiver = ( player getVariable "BIS_SUPP_selectedProvider" ) getVariable [ "bis_supp_requester", player ]; _topic = "BIS_SUPP_protocol"; _sentenceId_complete = "Artillery_Rounds_Complete"; _maxAge = 10; waitUntil{ _person kbWasSaid[ _receiver, _topic, _sentenceId_complete, _maxAge ] }; systemChat "Artilley: COMPLETED"; }; }; }] call BIS_fnc_addStackedEventHandler; Can you explain how to make this work with other support modules? Because, except with the artillery module, this does not work, for example, I change arty_1 to heli1 while having a transport module with the same name, but it does not work. And how to make it in one so that for artillery I could enter one code, for transport heli another, for CAS another etc. Excuse me for my lack of education, I do not understand such things at all ===== UPD===== I made it work, but it works only with virtual modules, but how to do it with the usual ones to which arty/heli is synchronized? And the question about how to do all in one for each module, so that each support call will activate its specific script, is relevant Share this post Link to post Share on other sites