OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: moritus on 15 Aug 2008, 05:15:03
-
I'm using 3 practice target in a shooting range...when you come to the shooting stand, i call this script from a trigger
#start
_targets = [targetc7l3_1,targetc7l3_2,targetc7l3_3]
? c7convl3check == 0 :goto "end"
_number= random 3
_number = _number - (_number % 1);
? _old == _number:goto "start"
_old = _number
hint format["%1",_number]
(_targets select _number) setDamage .7
~2
goto "start"
#end
exit
the problem is i always only 2 target working i can't have 3...what i'm doing wrong?
-
So your hint only displays zeroes or ones? I would check again that you have named your target objects the same as in the list. A typo is the most likely case.
-
I am puzzled. The code should give numbers 0 to 2. If your hint does give numbers in this range but you only get two targets working then my guess is that Mr P. is spot on. There is likely to be a misnaming of one of the targets.
I would say though that you could improve the script by putting the initialisation of the array above the loop label (why reinitialise the array every 2 seconds?) as follows:
_targets = [targetc7l3_1,targetc7l3_2,targetc7l3_3]
#start
You can also make the code more general by replacing
_number= random 3with
_number= random count _targetsThat way if you add a new target to the array you don't need to remember to change any other code further down.
-
THobson: originally the script was like you said...but i have try different way to check if something change...
I have already check my name but i will recheck just to be sure...
for the hint i see number 0 to 2 but, by exemple when i see 2 the target don'T raise....if i restart the map i can be the number 1 who won't raise...it's why i'm here
-
Change:
(_targets select _number) setDamage .7
to:
(_targets select _number) setDamage 0
-
na i need my target to 0.7...
i found something...if i run the mission from the editor i have strange things...but if i export to single mission my script work fine...