Home   Help Search Login Register  

Author Topic: velocity, and scripts  (Read 1358 times)

0 Members and 1 Guest are viewing this topic.

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
velocity, and scripts
« 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

UNN

  • Guest
Re:velocity, and scripts
« Reply #1 on: 26 Feb 2005, 06:09:33 »
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:

Code: [Select]
Count (_Speed-[0,0,0])
Will return 0 if the object your testing is not moving.

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
Re:velocity, and scripts
« Reply #2 on: 26 Feb 2005, 07:15:33 »
thx

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
Re:velocity, and scripts
« Reply #3 on: 26 Feb 2005, 07:19:40 »
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"

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:velocity, and scripts
« Reply #4 on: 26 Feb 2005, 07:56:11 »
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}

« Last Edit: 26 Feb 2005, 08:37:51 by THobson »

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
Re:velocity, and scripts
« Reply #5 on: 26 Feb 2005, 09:03:51 »
*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

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
Re:velocity, and scripts
« Reply #6 on: 26 Feb 2005, 09:30:13 »
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

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:velocity, and scripts
« Reply #7 on: 26 Feb 2005, 11:13:00 »
As long as their are no enemy around then a doStop command sounds like it will do what you need.
Plenty of reviewed ArmA missions for you to play

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:velocity, and scripts
« Reply #8 on: 26 Feb 2005, 11:54:50 »
you could try putting the following in your script:

@(speed m3 > 0.1)
« Last Edit: 27 Feb 2005, 09:30:55 by THobson »

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
Re:velocity, and scripts
« Reply #9 on: 26 Feb 2005, 20:17:18 »
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

Quote
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

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:velocity, and scripts
« Reply #10 on: 26 Feb 2005, 20:53:40 »
Sorry yes I misread your post.
Plenty of reviewed ArmA missions for you to play

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
Re:velocity, and scripts
« Reply #11 on: 27 Feb 2005, 02:05:02 »
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

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:velocity, and scripts
« Reply #12 on: 27 Feb 2005, 08:49:30 »
Did my suggestion at #8 above not work?

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
Re:velocity, and scripts
« Reply #13 on: 27 Feb 2005, 22:16:50 »
im not sure how to implement that

thanks

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:velocity, and scripts
« Reply #14 on: 27 Feb 2005, 23:27:07 »
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.

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
Re:velocity, and scripts
« Reply #15 on: 08 Mar 2005, 06:51:03 »
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

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:velocity, and scripts
« Reply #16 on: 08 Mar 2005, 10:57:16 »
@ 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

StonedSoldier

  • Guest
Re:velocity, and scripts
« Reply #17 on: 08 Mar 2005, 13:12:57 »
or try;

?(speed _man) >0.1 : goto "loop"

Offline ACF

  • Members
  • *
  • Llama?? Ain't that French for tanks?
Re:velocity, and scripts
« Reply #18 on: 08 Mar 2005, 13:52:40 »
?(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.

StonedSoldier

  • Guest
Re:velocity, and scripts
« Reply #19 on: 08 Mar 2005, 14:44:16 »
Code: [Select]
#loop
?(speed _man) >0.1 : goto "loop"
hint "The unit is stationary"

there you are, that wouldnt break

Offline ACF

  • Members
  • *
  • Llama?? Ain't that French for tanks?
Re:velocity, and scripts
« Reply #20 on: 08 Mar 2005, 18:16:14 »
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:

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

Code: [Select]
@ (speed _man >0.1)
goto "loop"
does the job in a far simpler way.