acidcrash 0 Posted May 11, 2004 Right, I've been working on a little script for pop-up targets and keepting track of hits and misses. All works fine untill you miss a target, at this point the whole thing goes apeshit at me and makes it impossible for the person shooting to hit the target. I cant see whats wrong especially as it worked before i added the random time section (see below) and the "miss" section wasnt altered, the only thing altered is the loop section which is where i added the random-"gotos" anyway, the script in question <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">;------------------------------- ;Acidcrash ;Pop-Up targets, random timing ;------------------------------- ?!(local Server) : exit pistol = 0; publicvariable "pistol" missed = 0; Publicvariable "missed" _seconds = 0 #loop _rand = random 5 _num = _rand - (_rand mod 1) ?(pistol >= 16): goto "end" _pistol = _pistol + 1 _seconds = 0 target setdammage 0 ?_num == 1 : goto "one" ?_num == 2 : goto "two" ?_num == 3 : goto "three" ?_num == 4 : goto "four" #one _seconds = _seconds + 0.1 ;debug ;hint "one" ?(getdammage target > 0.5): goto "hit" ?(_seconds >= 5): goto "missed" ~0.1 goto "one" #two _seconds = _seconds + 0.1 ;debug ;hint "two" ?(getdammage target > 0.5): goto "hit" ?(_seconds >= 6): goto "missed" ~0.1 goto "two" #three _seconds = _seconds + 0.1 ;debug ;hint "three" ?(getdammage target > 0.5): goto "hit" ?(_seconds >= 4): goto "missed" ~0.1 goto "three" #four _seconds = _seconds + 0.1 ;debug ;hint "four" ?(getdammage target > 0.5): goto "hit" ?(_seconds >= 7): goto "missed" ~0.1 goto "four" #loop1 _seconds = _seconds + 0.1 ?(getdammage target > 0.1): goto "hit" ?(_seconds >= 5): goto "missed" ~0.1 goto "loop1" #hit target setdammage 1 pistol = pistol + 1;; publicvariable = "pistol" hint format ["Hits : %1 \n Missed : %2", pistol, missed] ~0.5 shooter addscore 1 ref addscore 1 ~5 goto "loop" #missed target setdammage 1 missed = missed + 1;; publicvariable = "missed" hint format ["Hits : %1 \n Missed : %2", pistol, missed] ~0.5 goto "loop" #end ref1 globalchat format ["The final results are: Hits : %1 Â Missed : %2", pistol, missed] exit would appreciate it if anyone could have a look and see where i screwed up Share this post Link to post Share on other sites
Blanco 0 Posted May 11, 2004 I've made a shooting range with the pop-up targets : http://www.flashpoint1985.com/cgi-bin....53;st=0 My script is totaly different tho... But maybe it could help. Share this post Link to post Share on other sites