OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: penguinman on 26 Feb 2005, 06:00:32
-
?! _speed = [0,0,0] : goto "loop"
why does that line in my script bring up error,
o and speed is
_speed = velocity _man
and man is
_man = _this select 0
thanks penguin
-
You cant make a direct comparison with arrays, so you cant say array1==array2.
But there is a shorcut, you can subtract one lot of array elemts from another, so:
Count (_Speed-[0,0,0])
Will return 0 if the object your testing is not moving.
-
thx
-
hmm still geting an uknown operator error,
im using
Count (_Speed-[0,0,0]) : goto "loop"
the # is here
Count (_Speed-[0,0,0])|#| : goto "loop"
-
I think, to do what you are trying to do the construct should be something like:
if ({_x == 0} count _speed == 3) then {whatever}
This might get rid of the error, but will not really do what you want because the array elements returned by velocity are real numbers not integers. The chance of them being exactly 0 is very small indeed and cannot be relied on. Why not use:
_speed = speed man
if (_speed <0.1) then {whatever}
If you must use velocity then try:
_speed = velocity man
if ({abs(_x) < 0.1} count _speed == 3) then {whatever}
-
*smacks head against computer screen*
how stupid of me, "speed"
i wasted alot of time when all i had to use was speed, not set velocity.
thank you
-
ok but how do u get a script to wait at a certain point until somthing has happend,
like say i wanted a script to set dammage 1 one guy say m1
then make another guy m2 go prone "setunitpos"
then wait until a third guy m3 has started moving using speed.
and once the third guy has started moving the script will setdammage 1, one last man, m4
how and what would that look like
and it needs to be with out using loops
but if its not posible without loops then how with loops
thanks
-
As long as their are no enemy around then a doStop command sounds like it will do what you need.
-
you could try putting the following in your script:
@(speed m3 > 0.1)
-
ya, umm, isnt do stop for units, it wouldnt make a script wait???
say i were to script that simple example i gave, what would that look like
say i wanted a script to set dammage 1 one guy say m1
then make another guy m2 go prone "setunitpos"
then wait until a third guy m3 has started moving using speed.
and once the third guy has started moving the script will setdammage 1, one last man, m4
thanks
-
Sorry yes I misread your post.
-
lol yes,
but how would it be done,
if i must i will post the entire script but i would rather not as theres alot of stealers around here and i want to submit it
-
Did my suggestion at #8 above not work?
-
im not sure how to implement that
thanks
-
You put it in your script and you script will stop at that point until the speed of m3 is > 0.1 When that becomes true the script will continue to run.
-
ok, thanks, i have it like this
@ (speed _man >0.1) : goto "loop"
but i get a unknown operator error,
the # is here
@ (speed _man >0.1)# : goto "loop"
thanks
-
@ is not an if statement. It just stops the script until the condition is true. So the follwoing should not give you an error
@ (speed _man >0.1)
goto "loop"
The script will wait at the @ statement until the condition is true. Once it becomes true the script will continue running at the next line
-
or try;
?(speed _man) >0.1 : goto "loop"
-
?(speed _man) >0.1 : goto "loop"
It's not the same as an @ command. If/? won't hold the script, if speed _man < 0.1, the script will just continue, maybe exit, and the loop will break.
-
#loop
?(speed _man) >0.1 : goto "loop"
hint "The unit is stationary"
there you are, that wouldnt break
-
Er, yes...but we don't want to go to the original #loop until Speed _man > 0.1, so if we're insisting on a 'looped if'solution:
#checkloop
~1
?((speed _man) =< 0.1): Goto "checkloop"
hint "The unit is no longer substantially stationary"
goto "loop"It was also an unrestricted loop which is bad, lag-inducing practice; if we're trying to inform and educate (or be pedantic).
@ (speed _man >0.1)
goto "loop"does the job in a far simpler way.