Home   Help Search Login Register  

Author Topic: target range - plz help  (Read 708 times)

0 Members and 2 Guests are viewing this topic.

wi77ard

  • Guest
target range - plz help
« 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

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

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


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

Offline Blanco

  • Former Staff
  • ****
Re:target range - plz help
« Reply #1 on: 13 Mar 2005, 01:14:25 »
Quote
? getdammage _t1 == 0: goto "next" else goto "exit"

Could be right, but I never did it that way...

I've learned it like this :

Quote
if (getdammage _t1 == 0) then {goto "next"} else {goto "exit"}
« Last Edit: 13 Mar 2005, 01:14:40 by Blanco »
Search or search or search before you ask.

wi77ard

  • Guest
Re:target range - plz help
« Reply #2 on: 13 Mar 2005, 01:24:53 »
thanks mate, i'll give it a blast so what happens

wi77ard

  • Guest
Re:target range - plz help
« Reply #3 on: 13 Mar 2005, 01:45:20 »
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?

Offline Blanco

  • Former Staff
  • ****
Re:target range - plz help
« Reply #4 on: 13 Mar 2005, 02:23:25 »
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)

 



Search or search or search before you ask.

wi77ard

  • Guest
Re:target range - plz help
« Reply #5 on: 14 Mar 2005, 17:36:28 »
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?


Offline Blanco

  • Former Staff
  • ****
Re:target range - plz help
« Reply #6 on: 14 Mar 2005, 19:26:47 »
You got in the hit_tgl.sqs

Code: [Select]
?hold1 = true : goto "wait"
and then...

Code: [Select]
;#wait
Remove the ; because your script skips that line!

Same bug with :

Code: [Select]
?hold1 = false : goto "wait3"
and...

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

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







« Last Edit: 14 Mar 2005, 19:31:14 by Blanco »
Search or search or search before you ask.