Home   Help Search Login Register  

Author Topic: pop up targets /reset  (Read 3119 times)

0 Members and 1 Guest are viewing this topic.

Offline 22jacket

  • Members
  • *
  • I'm a llama!
pop up targets /reset
« on: 28 Mar 2005, 20:05:11 »
HELLLLPPPP
can anyone help..I need a script trigger etc to make pop up targets on a rifle range once shot down stay down ,then reset them via pressing a button etc
then again once there up they get shot down,reset etc just like a proper rifle range.... can u help..
cheers
jacket

Offline Blanco

  • Former Staff
  • ****
Re:pop up targets /reset
« Reply #1 on: 28 Mar 2005, 20:23:57 »
What are the popup targets you are talking about?


Search or search or search before you ask.

Offline 22jacket

  • Members
  • *
  • I'm a llama!
Re:pop up targets /reset
« Reply #2 on: 28 Mar 2005, 20:31:08 »
any range style targets like used on a military range..

DBR_ONIX

  • Guest
Re:pop up targets /reset
« Reply #3 on: 28 Mar 2005, 20:51:28 »
resettargets.sqs :
Code: [Select]
target1 setdammage 0
target2 setdammage 0

Then where ver you want the "button" to reset the targets..
Code: [Select]
this addaction ["Reset Range 1","resettargets.sqs"]

Most targets fall down when you shoot them, if not..
Code: [Select]
this addeventhandler ["hit","hitdown.sqs"]
hitdown.sqs:
Code: [Select]
_this select 1 setdammage 1

Good real target is... http://www.ofpec.com/addons_depot/index.php?ID=476

If you get any errors, let me know and I'll tell you how to fix the script (i've not tested it)
- Ben

Offline Blanco

  • Former Staff
  • ****
Re:pop up targets /reset
« Reply #4 on: 28 Mar 2005, 21:36:26 »
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
Code: [Select]
#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

Code: [Select]
_shooter = _this select 0
Shots = shots + 1

First trigger

Code: [Select]
Activation : NONE - once
Condition : True
Onactivation  : [] exec "targetseq.sqs"

Second trigger
The radio trigger to reset the targets.

Code: [Select]
Activation : Radio Alpha, Bravo, whatever..., repeatedly
Condition : this
Onactivation  : startsession = 1


What's important?

Check the 5th line in the targetseq script

Code: [Select]
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




 


Search or search or search before you ask.

Offline RujiK

  • Members
  • *
  • KoKo Puh-Fizzles!
Re:pop up targets /reset
« Reply #5 on: 28 Mar 2005, 22:23:17 »
Lol dude, you love confuzzling the new people don't you...   ;)
I would stick with what Onix said. Blanco is trying to make your head swim by turning somthing simple in tooooo something complex.  :P
« Last Edit: 28 Mar 2005, 22:24:09 by RujiK »
I like your approach, lets see your departure.
Download the New Flashlight Script!

Offline Blanco

  • Former Staff
  • ****
Re:pop up targets /reset
« Reply #6 on: 28 Mar 2005, 23:09:19 »
Ok whatever...
I just tried to help but I think I have too much free time last days.


Search or search or search before you ask.