Harvath.S 3 Posted March 22, 2019 I've been hitting my head against a wall for a few days trying to sort this issue. I have a script (see below) that I wrote for a firing range. It works perfectly in SP and on locally hosted servers. I am having issues with it on the dedicated server. I dug through the (recent) topic below and have attempted tweaks off of that to no avail. https://forums.bohemia.net/forums/topic/221167-addmpeventhandler-not-working-on-dedicated-server/?_fromLogin=1 I feel like my issue is lying somewhere in the eventHandler not updating the score variables for some reason. I am not sure why it would be working on a local host and not dedicated. Below is the first snippet of the script down to where I added the first check to see if the EHs were working. Spoiler if (isDedicated) then{}; _inc = 0; score1 = 0; score2 = 0; score3 = 0; score4 = 0; _targets = [p1,p2,p3,p4]; _group = 0; {_x animate["terc",1]} forEach _targets; p1 addEventHandler ["Hit", {score1 = score1 + 1; publicVariable "score1";}]; p2 addEventHandler ["Hit", {score2 = score2 + 1; publicVariable "score2";}]; p3 addEventHandler ["Hit", {score3 = score3 + 1; publicVariable "score3";}]; p4 addEventHandler ["Hit", {score4 = score4 + 1; publicVariable "score4";}]; nopop=true; sleep 3; p1 animate["terc", 0]; p2 animate["terc", 0]; p3 animate["terc", 0]; p4 animate["terc", 0]; sleep 75; p1 setDamage 0; p2 setDamage 0; p3 setDamage 0; p4 setDamage 0; p1 animate["terc", 1]; _inc = _inc +1; p2 animate["terc", 1]; _inc = _inc +1; p3 animate["terc", 1]; _inc = _inc +1; p4 animate["terc", 1]; _inc = _inc +1; if (score1 == 5) then {"Working" remoteExec ["systemChat"];} else {"Not working" remoteExec ["systemChat"];}; Any help offered would be greatly appreciated. My head hurts and I'm afraid I'll dent my wall if I keep hitting it. PS. I am using the targetHumanSimple because it does not fall when it gets shot. I did this so the shooter has to observe the bullet strike and does not have a visual aide. I don't think this would make any difference but full disclosure is full disclosure. Share this post Link to post Share on other sites
killzone_kid 1330 Posted March 22, 2019 Use addMPEventHandler with "MPHit" Share this post Link to post Share on other sites
Harvath.S 3 Posted March 22, 2019 Would you believe that I talked myself out of trying the MP versions after reading through that other thread? Stupid me. Side bar: I changed that in the script and tested it. However, now my check I added in is not working. I would say it is because I am a terrible shot, but that's not it. Could it be because I am setting the damage on the targets to '0'? The wiki says: Quote Does not fire when a unit is set to allowDamage false. However it will fire with "HandleDamage" EH added alongside stopping unit from taking damage (unit addEventHandler ["HandleDamage", {0}];. Could the "setDamage 0;" that I am using be causing it to not take effect somehow? Or did I just type out that if/then/else code that poorly? Share this post Link to post Share on other sites
killzone_kid 1330 Posted March 23, 2019 7 hours ago, Harvath.S said: if (isDedicated) then{}; That is doing precisely nothing 1 Share this post Link to post Share on other sites
Harvath.S 3 Posted March 23, 2019 *slaps self* I should be using if (hasInterface) then {script}; shouldn't I? Share this post Link to post Share on other sites
killzone_kid 1330 Posted March 23, 2019 I don’t know, depends Share this post Link to post Share on other sites
sarogahtyp 1108 Posted March 23, 2019 2 hours ago, Harvath.S said: *slaps self* I should be using if (hasInterface) then {script}; shouldn't I? As KK told it depends. hasInterface will hit all machines where someone is playing at or can see the game (listen server or player clients) !hasInterface hits only machines where nobody can play on like headless clients and dedicated servers. isDedicated hits dedicated servers !isDedicated hit all but a dedicated server Therefore its depends on your purpose.... Share this post Link to post Share on other sites
tanin69 17 Posted March 25, 2019 On 3/23/2019 at 12:02 AM, Harvath.S said: I've been hitting my head against a wall for a few days trying to sort this issue. I have a script (see below) that I wrote for a firing range. It works perfectly in SP and on locally hosted servers. I am having issues with it on the dedicated server. I dug through the (recent) topic below and have attempted tweaks off of that to no avail. Hi Harvath.s, I've made a kind of biathlon mission template, sort of mix of firing range and orienteering race. The code is highly documented, but sadly only in french (my bad, I knew it was an error...). If you really need it, I can translate my comments, it shoudn't be too much complicated (although my english is poor, unlike my taylor :-)). http://yabac.net/wiki/doku.php/arma_3:createurs_de_missions:template_biathlon I use the hitpart event handler on the target, much simpler than hit EH. Share this post Link to post Share on other sites
Harvath.S 3 Posted March 28, 2019 On 3/23/2019 at 6:33 PM, sarogahtyp said: As KK told it depends. hasInterface will hit all machines where someone is playing at or can see the game (listen server or player clients) !hasInterface hits only machines where nobody can play on like headless clients and dedicated servers. isDedicated hits dedicated servers !isDedicated hit all but a dedicated server Therefore its depends on your purpose.... And that is what always messes with my head. I am calling the script via an addAction through the init.sqf. It is a qualification range for four individuals at the same time, hence the four targets and four score variables. I am definitely getting caught on the *where* to run issue. I need it to run on whoever uses the addAction and the four players actually shooting. Is it best to have it run on all players on the server? The server itself? This is where I always run into issues with my scripts when it comes to putting them on a dedicated server. No matter how much I dig into the wiki and try to understand it it goes over my head in regard what to use where. Share this post Link to post Share on other sites
pierremgi 4853 Posted March 28, 2019 Why calling a Hit EH by an addAction? You can run your hit EHs on targets, then manage some variables from the addAction. Perhaps, you should tell what exactly you want to do. As example: this addEventHandler ["hit", {<code adding +1 on some variable; publicVariable it if necessary, or use MPEH MPHit>}]; on each target // server. then, player addAction ["reset target", {<code resetting targets} remoteExec ["call",2]}]; // addaction to server player addAction ["reset points", {<local code for points}]; // addAction for player You catch the idea. Share this post Link to post Share on other sites