OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: 22jacket 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
-
What are the popup targets you are talking about?
-
any range style targets like used on a military range..
-
resettargets.sqs :
target1 setdammage 0
target2 setdammage 0
Then where ver you want the "button" to reset the targets..
this addaction ["Reset Range 1","resettargets.sqs"]
Most targets fall down when you shoot them, if not..
this addeventhandler ["hit","hitdown.sqs"]
hitdown.sqs:_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
-
Well here's a sample (simplified version) from a riflerange script I've made last year. I've used these (http://ofp.gamezone.cz/index.php?showthis=2614) 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 trigger
Activation : NONE - once
Condition : True
Onactivation : [] exec "targetseq.sqs"
Second trigger
The 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
-
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
-
Ok whatever...
I just tried to help but I think I have too much free time last days.