Home   Help Search Login Register  

Author Topic: doMove with slightly random destination?  (Read 462 times)

0 Members and 3 Guests are viewing this topic.

Black Operative

  • Guest
doMove with slightly random destination?
« on: 14 Jun 2003, 12:32:28 »
Hi fellas! :)

How can I make a soldier move to another soldier using the doMove command (not waypoints!)- but I do not want to just make him move to the exact location of the other soldier, I'd rather have him move to a point that is set randomly in an area of about 50 meters AROUND the soldier.


JUST AN EXAMPLE, I ASSUME IT'S A ENTIRELY WRONG WAY OF DOING IT:  ;)
In my example, I want a soldier called "SS2" to move to a random position around a standing soldier called "SS1". So dere's da code:

SS2 doMove [(getPos SS1 select 0)+(random 20-random 30), (getPos SS1 select 1)+(random 20-random 30), getPos SS2 select 2]

But with this the unit SS2 always moves to a random position LEFT of the soldier SS1.


Thanks in advance for any help! :)

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:doMove with slightly random destination?
« Reply #1 on: 14 Jun 2003, 12:46:56 »
u r close ;D but i think more bout (not sure ;D)

Code: [Select]
SS2 doMove [(getPos SS1 select 0)-50+(random 100), (getPos SS1 select 1)-50+(random 100), getPos SS2 select 2]

but ur way is workin also ;D

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Black Operative

  • Guest
Re:doMove with slightly random destination?
« Reply #2 on: 14 Jun 2003, 12:53:16 »
u r close ;D but i think more bout (not sure ;D)

Code: [Select]
SS2 doMove [(getPos SS1 select 0)-50+(random 100), (getPos SS1 select 1)-50+(random 100), getPos SS2 select 2]

but ur way is workin also ;D

LCD OUT

Yes, this is working perfectly. Can't quite make out the difference between the two systems of calculating the pos  ;D but yours is working as I had it in mind.
I also tried my way again- REALLY isn't working.  :-\ Maybe it's da touch of your holy coding hand or somin' ;)

Thanks anyway, great master!  ;D