Well here's a sample (simplified version) from a riflerange script I've made last year. I've used
these targets. They don't hit the ground when you hit them, but they are animated.
You'll need 2 scripts and 2 triggers.
The script will make your targets popup in a random sequence, they will stay there for 3 seconds when your play in veteran mode and 4 sec when you play in cadetmode.
At the end a hint shows up with a few statistics : (in my full mission there are a lot more)
- Name of the shooter
- Difficulty
- Targets missed
- Shots fired
First script
Targetseq.sqs#start
@startsession == 1
shots = 0
player addeventhandler ["fired",{_this exec "countshots.sqs"}]
trgts = [t1,t2,t3,t4,t5,t6]
~3
#resetalltargets
"_x animate [""backboard"",1]" foreach trgts
~2
titletext ["GET READY","PLAIN DOWN"]
~2
titletext ["START","PLAIN DOWN"]
;;====== SOME VARIABLES AND ARRAYS =============================================
_missedlist = []
_targetc = count trgts
_maxtime = 3
_mode = "Veteran mode"
?cadetmode : _mode = "Cadet mode";_maxtime = 4
;; ====== SELECT RANDOM TARGET =================================================
#reset
_r = random count trgts
_r = _r - _r %1
_target = trgts select _r
_target setdammage 0
_target animate ["backboard",0]
;; ====== CHECK IF TARGET IS HIT OR NOT AND REMOVE THE TARGETS FROM THE LIST.
_t = 0
#timeloop
if (_t > _maxtime) then {goto "missed";trgts = trgts - [_target]}
if (Getdammage _target > 0) then {goto "hit";trgts = trgts - [_target]}
_t = _t + 0.05
~0.05
goto "timeloop"
;;======TARGET MISSED ==========================================================
#missed
_target animate ["backboard",1]
_missedlist = _missedlist + [_target]
goto "check"
;;==============================================================================
;; =====TARGET HIT =============================================================
#hit
_target animate ["backboard",1]
goto "check"
;;==============================================================================
;;=======CHECK TARGET SEQUENCE =================================================
#check
?(count trgts == 0) : goto "CHECK2"
~0.5
goto "reset"
;;==============================================================================
#check2
player removeeventhandler ["fired",0]
~2
hintc format ["STATISTICS\n\nName shooter : %1\nUsed weapon : %2\nTargets Missed : %3\nShots fired : %4",Name player,primaryweapon player,count _missedlist,shots]
~5
goto "start"
exit
Second script
countshots.sqs_shooter = _this select 0
Shots = shots + 1
First triggerActivation : NONE - once
Condition : True
Onactivation : [] exec "targetseq.sqs"
Second triggerThe radio trigger to reset the targets.
Activation : Radio Alpha, Bravo, whatever..., repeatedly
Condition : this
Onactivation : startsession = 1
What's important?Check the 5th line in the targetseq script
trgts = [t1,t2,t3,t4,t5,t6]
Name every target you got and put those names in the array. I named my targets t1,t2,t3,etc...in the example
You can add as many targets as you want.
If this is too difficult for you, I can make you an example in no time