OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: wi77ard on 12 Mar 2005, 18:01:21
-
ok heres the deal
i'm trying to create a target range for multiplayer.
the problem seems to be with my wait_tg1.sqs i think?
basicly this script should popup a target for 3 seconds, if it gets hit then it should count that as 1 to the hit_tg1 score and if it isnt hit it should add 1 to the missed_tg1 score.
this is what i have so far
hit_tg1.sqs
#loop
_i = random 15
total = total + 1
?hold1 = true : goto "wait"
?hold1 = false : goto "wait3"
;#wait3
[] exec "wait_tg1.sqs"
;goto "loop"
;#wait
@ getdammage _this >.0001
_this animate ["target_hit",1]
hit_tg1 = hit_tg1 + 1
? getdammage _this >=.8 : hint "You broke the target. dumb ass!" ; exit
~_i
_this animate ["target_hit",0]
_this setdammage 0
goto "loop"
exit
wait_tg1.sqs
_t1 = tg1
? getdammage _t1 == 0: goto "next" else goto "exit"
~1
#next
? getdammage _t1 == 0: goto "next2" else goto "exit"
~1
#next2
? getdammage _t1 == 0: goto "next3" else goto "exit"
#next3
_t1 animate ["target_hit",1]
_t1 setdammage 0.3
missed_tg1 = missed_tg1 + 1
goto "exit"
#exit
exit
Begin.sqs
missed_tg1 = 0
publicvariable "missed_tg1"
hit_tg1 = 0
publicvariable "hit_tg1"
total = 0
publicvariable "total"
player removeaction 1
hold1 = true
officer1 sidechat "Move to the danger signs, you have five seconds to begin. Your first round will be in the kneeling position"
~7
officer1 sidechat "begin"
hold1 = false
~90
officer1 sidechat "Hold fire"
hold1 = true
officer1 sidechat "Go prone, second round begins in five seconds"
~7
officer1 sidechat "begin"
hold1 = false
~90
officer1 sidechat "Hold fire"
titletext [format ["50m hit = %1 50m missed %2", hit_tg1, missed_tg1],"PLAIN DOWN"]
~10
titletext [format ["total targets = %1", total],"PLAIN DOWN"]
-
? getdammage _t1 == 0: goto "next" else goto "exit"
Could be right, but I never did it that way...
I've learned it like this :
if (getdammage _t1 == 0) then {goto "next"} else {goto "exit"}
-
thanks mate, i'll give it a blast so what happens
-
ok there seems to be a problem with this bit of the script hit_tg1.sqs
?hold1 = true : goto "wait"
?hold1 = false : goto "wait3"
any ideas?
-
Sorry, I can't follow you, what script runs first?
Are you using those new targets?
Nway, I've made a shootingrange Betamission about a year ago, also with an animated target addon and some statistics, maybe it could help (or not :P ) if you check my code. (in the "shootingrange.sqs")
The zip includes the opensource and the pbo version and all the addons you'll need.
http://users.telenet.be/blanco/Scripts/Shooting-range1.0.zip (682kb)
-
the hit_tg1.sqs runs from the init box of the target
and the begin.sqs runs from a user action from menu
i tried your mission, looks great but doesnt work in multiplayer
is it something to do with variables about the player?
-
You got in the hit_tgl.sqs
?hold1 = true : goto "wait"
and then...
;#wait
Remove the ; because your script skips that line!
Same bug with :
?hold1 = false : goto "wait3"
and...
;#wait3
There is a constant loop in your hit_tgl.sqs (and that for every target)
As long as hold1 = true the scripts runs constantly.
Why don't you just use:
@hold1
PS : I know it doesn't work in MP, I'm bad with MP scripting and I don't know how to make it work that way.