Schilly 10 Posted June 22, 2009 Hello All, I just had a couple questions I couldn't seem to find the answer to. I was wondering if anyone thus far has explored the ability to keep a running tally score of the targets being hit. For example same as they do with the bootcamp, is this something that is possible in a multiplayer gameset? If so, does anyone have any suggestions as to how I would go about acomplishing this? As you may have guessed, I am making a rifle range for my Arma unit training map and this would be a great addition seeing how right now we are counting them manually lol. Share this post Link to post Share on other sites
IndeedPete 1038 Posted June 22, 2009 Well, you might just open the Bootcamp missions and look how BIS did it. Share this post Link to post Share on other sites
Junker 0 Posted June 22, 2009 _popup animate["terc",0] = down _popup animate["terc",1] = up to detect if it has been shot : - ? (_popup animationPhase "terc") == 0 Share this post Link to post Share on other sites
Schilly 10 Posted June 22, 2009 Thanks for that info Junker, that works perfectly. One question you may be able to answer, or direct me to information where I can read about it would be the counting side of things... Say I have a range full of targets, and I want it to simply count the number of hits on a group of targets. Have any ideas as to how to do that? Share this post Link to post Share on other sites
Benny. 15 Posted June 22, 2009 add an eventHandler of "Hit" kind on each targets where you count each bullet from the player that hitted them. you can even do a ratio with the "Fire" eventHandler Ex: (init field of a target, for SP purpose.) this addEventHandler["Hit",{hint "Target hit"}]; Share this post Link to post Share on other sites
Schilly 10 Posted June 23, 2009 Am I right in assuming I can take that and turn it into a counter with a variable? For example: X=0; this addEventHandler["Hit", X+1]; So that i can do a: hint X; and have it display the total as its going along? Or am I nuts? Heh.. Share this post Link to post Share on other sites
Junker 0 Posted June 23, 2009 Am I right in assuming I can take that and turn it into a counter with a variable?For example: X=0; this addEventHandler["Hit", X+1]; So that i can do a: hint X; and have it display the total as its going along? Or am I nuts? Heh.. X = 0 needs to be activated at the start of the mission so put that in a trigger or your init.sqs then make the addeventhandler ["Hit", X = X + 1] << something like that anyway :) Share this post Link to post Share on other sites
Schilly 10 Posted June 23, 2009 Yea I gave that a try... only problem I am having now is getting it to hint a variable... doesnt want to work :| Share this post Link to post Share on other sites
Junker 0 Posted June 23, 2009 try this >> hint format ["Score = %1", X] but u might wanna change the X for something else :) Share this post Link to post Share on other sites
Schilly 10 Posted June 23, 2009 Perfect :) Now just to turn it into multiple targets and will need to test multiplayer... Thanks for all your help mate. Share this post Link to post Share on other sites
Two Dogs 12 Posted June 23, 2009 Chekout http://www.ofpec.com/ed_depot/index.php?action=details&id=599&game=ArmA Advanced Popup Target. Share this post Link to post Share on other sites
Schilly 10 Posted June 23, 2009 Yea I have see that as well... Not exactly what I am lookign for in this particular case. I have used that however and it works quite well. ---------- Post added at 08:01 PM ---------- Previous post was at 07:34 PM ---------- addeventhandler["Hit", {hint format["Range Session Begun, all hits counting towards final score.\n---------------------\nCurrent Score is: %1.", hc]}] foreach _target; Can anyone assist me with this... What I am trying to do is have a series of targets, each of which if they get hit will update the hint. Is there something wrong with my code? If so, any ideas? Share this post Link to post Share on other sites
Schilly 10 Posted July 7, 2009 I got the hint problem fixed... Lots of trial and error haha. I was however wondering if anyone had any incite they could provide as to how to get a somewhat random popup going... I have seen it done before, but I have not been able to figure out how they did it. Does anyone have any ideas as to how I could get this to work? I have tried to use the "sleep" command, but it does not want to work. Right now, I have a notice board with an action on it that runs the script that does the counting / hints... The same script also pops up all the targets, and then a seperate one that ends the counting / pops down the targets as well. That all works, but when I add the "sleep" in there, it does not work.. What I was goign to do is just manually add sleep values in to a big list of target pop ups and downs which is the long way around im sure... Any help would be greatly appreciated. Share this post Link to post Share on other sites
Schilly 10 Posted July 7, 2009 Anyone have any ideas? Share this post Link to post Share on other sites
kylania 568 Posted July 7, 2009 You could use _rNumber = random 1 to get a random number of which one to reset. http://community.bistudio.com/wiki/random By the way, how did you fix your problem? Posting the resolution could be helpful to others! Share this post Link to post Share on other sites
Schilly 10 Posted July 7, 2009 Oh yes... I ended up having to just use another "addeventhandler" for the hit, and make it so that when it is hit, it pops up a hint box with an updated value. Share this post Link to post Share on other sites
Soldat20 0 Posted July 10, 2009 (edited) Hey Schilly I have a code aswell that works perfectly for what your doing besides I just can't get the scores to post in the sideChat at the end of the target cycles like it did in arma1, if anyone knows any idea why it'd be useful! Here is a preview mission http://arma2.7thcavalry.us/BootCamp.utes.pbo _targetTime = _this select 0; if (not RangeRunning) then { rangeRunning = true; playSound "voice1"; Hits_Lane1 = 0; Hits_Lane2 = 0; Hits_Lane3 = 0; Hits_Lane4 = 0; Hits_Lane5 = 0; Hits_Lane6 = 0; if (isServer) then { sleep 5.5; _i = 0; while {_i < 10} do { _target = [1, 6] call CSL_GetRandomInteger; switch (_target) do { case 1: { _eh = t50_1 addeventhandler ["hit", {Hits_Lane1 = Hits_Lane1 + 1; _this select 0 setDamage 0;}]; _eh = t50_2 addeventhandler ["hit", {Hits_Lane2 = Hits_Lane2 + 1; _this select 0 setDamage 0;}]; _eh = t50_3 addeventhandler ["hit", {Hits_Lane3 = Hits_Lane3 + 1; _this select 0 setDamage 0;}]; _eh = t50_4 addeventhandler ["hit", {Hits_Lane4 = Hits_Lane4 + 1; _this select 0 setDamage 0;}]; _eh = t50_5 addeventhandler ["hit", {Hits_Lane5 = Hits_Lane5 + 1; _this select 0 setDamage 0;}]; _eh = t50_6 addeventhandler ["hit", {Hits_Lane6 = Hits_Lane6 + 1; _this select 0 setDamage 0;}]; t50_1 animate["terc",0]; t50_2 animate["terc",0]; t50_3 animate["terc",0]; t50_4 animate["terc",0]; t50_5 animate["terc",0]; t50_6 animate["terc",0]; }; case 2: { _eh = t75_1 addeventhandler ["hit", {Hits_Lane1 = Hits_Lane1 + 1; _this select 0 setDamage 0;}]; _eh = t75_2 addeventhandler ["hit", {Hits_Lane2 = Hits_Lane2 + 1; _this select 0 setDamage 0;}]; _eh = t75_3 addeventhandler ["hit", {Hits_Lane3 = Hits_Lane3 + 1; _this select 0 setDamage 0;}]; _eh = t75_4 addeventhandler ["hit", {Hits_Lane4 = Hits_Lane4 + 1; _this select 0 setDamage 0;}]; _eh = t75_5 addeventhandler ["hit", {Hits_Lane5 = Hits_Lane5 + 1; _this select 0 setDamage 0;}]; _eh = t75_6 addeventhandler ["hit", {Hits_Lane6 = Hits_Lane6 + 1; _this select 0 setDamage 0;}]; t75_1 animate["terc",0]; t75_2 animate["terc",0]; t75_3 animate["terc",0]; t75_4 animate["terc",0]; t75_5 animate["terc",0]; t75_6 animate["terc",0]; }; case 3: { _eh = t100_1 addeventhandler ["hit", {Hits_Lane1 = Hits_Lane1 + 1; _this select 0 setDamage 0;}]; _eh = t100_2 addeventhandler ["hit", {Hits_Lane2 = Hits_Lane2 + 1; _this select 0 setDamage 0;}]; _eh = t100_3 addeventhandler ["hit", {Hits_Lane3 = Hits_Lane3 + 1; _this select 0 setDamage 0;}]; _eh = t100_4 addeventhandler ["hit", {Hits_Lane4 = Hits_Lane4 + 1; _this select 0 setDamage 0;}]; _eh = t100_5 addeventhandler ["hit", {Hits_Lane5 = Hits_Lane5 + 1; _this select 0 setDamage 0;}]; _eh = t100_6 addeventhandler ["hit", {Hits_Lane6 = Hits_Lane6 + 1; _this select 0 setDamage 0;}]; t100_1 animate["terc",0]; t100_2 animate["terc",0]; t100_3 animate["terc",0]; t100_4 animate["terc",0]; t100_5 animate["terc",0]; t100_6 animate["terc",0]; }; case 4: { _eh = t125_1 addeventhandler ["hit", {Hits_Lane1 = Hits_Lane1 + 1; _this select 0 setDamage 0;}]; _eh = t125_2 addeventhandler ["hit", {Hits_Lane2 = Hits_Lane2 + 1; _this select 0 setDamage 0;}]; _eh = t125_3 addeventhandler ["hit", {Hits_Lane3 = Hits_Lane3 + 1; _this select 0 setDamage 0;}]; _eh = t125_4 addeventhandler ["hit", {Hits_Lane4 = Hits_Lane4 + 1; _this select 0 setDamage 0;}]; _eh = t125_5 addeventhandler ["hit", {Hits_Lane5 = Hits_Lane5 + 1; _this select 0 setDamage 0;}]; _eh = t125_6 addeventhandler ["hit", {Hits_Lane6 = Hits_Lane6 + 1; _this select 0 setDamage 0;}]; t125_1 animate["terc",0]; t125_2 animate["terc",0]; t125_3 animate["terc",0]; t125_4 animate["terc",0]; t125_5 animate["terc",0]; t125_6 animate["terc",0]; }; case 5: { _eh = t150_1 addeventhandler ["hit", {Hits_Lane1 = Hits_Lane1 + 1; _this select 0 setDamage 0;}]; _eh = t150_2 addeventhandler ["hit", {Hits_Lane2 = Hits_Lane2 + 1; _this select 0 setDamage 0;}]; _eh = t150_3 addeventhandler ["hit", {Hits_Lane3 = Hits_Lane3 + 1; _this select 0 setDamage 0;}]; _eh = t150_4 addeventhandler ["hit", {Hits_Lane4 = Hits_Lane4 + 1; _this select 0 setDamage 0;}]; _eh = t150_5 addeventhandler ["hit", {Hits_Lane5 = Hits_Lane5 + 1; _this select 0 setDamage 0;}]; _eh = t150_6 addeventhandler ["hit", {Hits_Lane6 = Hits_Lane6 + 1; _this select 0 setDamage 0;}]; t150_1 animate["terc",0]; t150_2 animate["terc",0]; t150_3 animate["terc",0]; t150_4 animate["terc",0]; t150_5 animate["terc",0]; t150_6 animate["terc",0]; }; case 6: { _eh = t200_1 addeventhandler ["hit", {Hits_Lane1 = Hits_Lane1 + 1; _this select 0 setDamage 0;}]; _eh = t200_2 addeventhandler ["hit", {Hits_Lane2 = Hits_Lane2 + 1; _this select 0 setDamage 0;}]; _eh = t200_3 addeventhandler ["hit", {Hits_Lane3 = Hits_Lane3 + 1; _this select 0 setDamage 0;}]; _eh = t200_4 addeventhandler ["hit", {Hits_Lane4 = Hits_Lane4 + 1; _this select 0 setDamage 0;}]; _eh = t200_5 addeventhandler ["hit", {Hits_Lane5 = Hits_Lane5 + 1; _this select 0 setDamage 0;}]; _eh = t200_6 addeventhandler ["hit", {Hits_Lane6 = Hits_Lane6 + 1; _this select 0 setDamage 0;}]; t200_1 animate["terc",0]; t200_2 animate["terc",0]; t200_3 animate["terc",0]; t200_4 animate["terc",0]; t200_5 animate["terc",0]; t200_6 animate["terc",0]; }; };//switch (_target) do sleep _targetTime; switch (_target) do { case 1: { t50_1 animate["terc",1]; t50_2 animate["terc",1]; t50_3 animate["terc",1]; t50_4 animate["terc",1]; t50_5 animate["terc",1]; t50_6 animate["terc",1]; }; case 2: { t75_1 animate["terc",1]; t75_2 animate["terc",1]; t75_3 animate["terc",1]; t75_4 animate["terc",1]; t75_5 animate["terc",1]; t75_6 animate["terc",1]; }; case 3: { t100_1 animate["terc",1]; t100_2 animate["terc",1]; t100_3 animate["terc",1]; t100_4 animate["terc",1]; t100_5 animate["terc",1]; t100_6 animate["terc",1]; }; case 4: { t125_1 animate["terc",1]; t125_2 animate["terc",1]; t125_3 animate["terc",1]; t125_4 animate["terc",1]; t125_5 animate["terc",1]; t125_6 animate["terc",1]; }; case 5: { t150_1 animate["terc",1]; t150_2 animate["terc",1]; t150_3 animate["terc",1]; t150_4 animate["terc",1]; t150_5 animate["terc",1]; t150_6 animate["terc",1]; }; case 6: { t200_1 animate["terc",1]; t200_2 animate["terc",1]; t200_3 animate["terc",1]; t200_4 animate["terc",1]; t200_5 animate["terc",1]; t200_6 animate["terc",1]; }; };//switch (_target) do sleep 1; t50_1 removeAllEventHandlers "hit"; t50_2 removeAllEventHandlers "hit"; t50_3 removeAllEventHandlers "hit"; t50_4 removeAllEventHandlers "hit"; t50_5 removeAllEventHandlers "hit"; t50_6 removeAllEventHandlers "hit"; t75_1 removeAllEventHandlers "hit"; t75_2 removeAllEventHandlers "hit"; t75_3 removeAllEventHandlers "hit"; t75_4 removeAllEventHandlers "hit"; t75_5 removeAllEventHandlers "hit"; t75_6 removeAllEventHandlers "hit"; t100_1 removeAllEventHandlers "hit"; t100_2 removeAllEventHandlers "hit"; t100_3 removeAllEventHandlers "hit"; t100_4 removeAllEventHandlers "hit"; t100_5 removeAllEventHandlers "hit"; t100_6 removeAllEventHandlers "hit"; t125_1 removeAllEventHandlers "hit"; t125_2 removeAllEventHandlers "hit"; t125_3 removeAllEventHandlers "hit"; t125_4 removeAllEventHandlers "hit"; t125_5 removeAllEventHandlers "hit"; t125_6 removeAllEventHandlers "hit"; t150_1 removeAllEventHandlers "hit"; t150_2 removeAllEventHandlers "hit"; t150_3 removeAllEventHandlers "hit"; t150_4 removeAllEventHandlers "hit"; t150_5 removeAllEventHandlers "hit"; t150_6 removeAllEventHandlers "hit"; t200_1 removeAllEventHandlers "hit"; t200_2 removeAllEventHandlers "hit"; t200_3 removeAllEventHandlers "hit"; t200_4 removeAllEventHandlers "hit"; t200_5 removeAllEventHandlers "hit"; t200_6 removeAllEventHandlers "hit"; _i = _i + 1; }; //while {_i < 10} do t50_1 animate["terc",1]; t50_2 animate["terc",1]; t50_3 animate["terc",1]; t50_4 animate["terc",1]; t50_5 animate["terc",1]; t50_6 animate["terc",1]; t75_1 animate["terc",1]; t75_2 animate["terc",1]; t75_3 animate["terc",1]; t75_4 animate["terc",1]; t75_5 animate["terc",1]; t75_6 animate["terc",1]; t100_1 animate["terc",1]; t100_2 animate["terc",1]; t100_3 animate["terc",1]; t100_4 animate["terc",1]; t100_5 animate["terc",1]; t100_6 animate["terc",1]; t125_1 animate["terc",1]; t125_2 animate["terc",1]; t125_3 animate["terc",1]; t125_4 animate["terc",1]; t125_5 animate["terc",1]; t125_6 animate["terc",1]; t150_1 animate["terc",1]; t150_2 animate["terc",1]; t150_3 animate["terc",1]; t150_4 animate["terc",1]; t150_5 animate["terc",1]; t150_6 animate["terc",1]; t200_1 animate["terc",1]; t200_2 animate["terc",1]; t200_3 animate["terc",1]; t200_4 animate["terc",1]; t200_5 animate["terc",1]; t200_6 animate["terc",1]; _scores = "player sideChat '"; if ((count list Lane1ShootingArea) > 0) then {_scores = format["%1Lane 1 %2 hits. ", _scores, Hits_Lane1];}; if ((count list Lane2ShootingArea) > 0) then {_scores = format["%1Lane 2 %2 hits. ", _scores, Hits_Lane2];}; if ((count list Lane3ShootingArea) > 0) then {_scores = format["%1Lane 3 %2 hits. ", _scores, Hits_Lane3];}; if ((count list Lane4ShootingArea) > 0) then {_scores = format["%1Lane 4 %2 hits. ", _scores, Hits_Lane4];}; if ((count list Lane5ShootingArea) > 0) then {_scores = format["%1Lane 5 %2 hits. ", _scores, Hits_Lane5];}; if ((count list Lane6ShootingArea) > 0) then {_scores = format["%1Lane 6 %2 hits. ", _scores, Hits_Lane6];}; _scores = format["%1';", _scores]; //player sideChat _scores; //Display chat in each group once ChatLogic = "Logic" createVehicle [random 100, random 100]; ChatLogic setVehicleInit _scores; processInitCommands; rangeRunning = false; publicVariable "rangeRunning"; };//if (isServer) then };//if (not rangeRunning) then sleep 30; deleteVehicle ChatLogic; Edited July 10, 2009 by Soldat20 Share this post Link to post Share on other sites
SteelSampson 1 Posted May 20, 2013 Yea I have see that as well... Not exactly what I am lookign for in this particular case. I have used that however and it works quite well.---------- Post added at 08:01 PM ---------- Previous post was at 07:34 PM ---------- addeventhandler["Hit", {hint format["Range Session Begun, all hits counting towards final score.\n---------------------\nCurrent Score is: %1.", hc]}] foreach _target; Can anyone assist me with this... What I am trying to do is have a series of targets, each of which if they get hit will update the hint. Is there something wrong with my code? If so, any ideas? Schilly, would you mind posting your final product... I having trouble with what is on the forum thanks! Share this post Link to post Share on other sites
bearbison 10 Posted May 20, 2013 Jump on to our server (search for [RIP]) and the default mission is a training one with scripts for popup targets and scoring lanes, also includes a moveable target range (currently only works correctly in local, just not got round to fixing it yet) along with various other scripts that you may find useful for training. A few of the other areas are broken at the moment as was in the process of updating prior to A3 release which has had me too busy creating something similar for it with a lot better optimised scripts. Share this post Link to post Share on other sites
Harzach 2516 Posted May 20, 2013 Schilly, would you mind posting your final product... I having trouble with what is on the forum thanks! This topic is four years dead, and Schilly hasn't posted since October 2010. Share this post Link to post Share on other sites
SteelSampson 1 Posted May 20, 2013 This topic is four years dead, and Schilly hasn't posted since October 2010. I've had success reviving old threads... and besides wouldn't you rather me revive an old thread than start a new one? It was worth a shot. No need to be grumpy. Share this post Link to post Share on other sites