Home   Help Search Login Register  

Author Topic: random x and y=one point???  (Read 551 times)

0 Members and 2 Guests are viewing this topic.

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
random x and y=one point???
« on: 16 Jun 2003, 15:02:30 »
I dunno really how IÂ'm gonna explain this but IÂ'm makin a random walkin script where u(me ;)) can set how big the area the guy(s) are goin to walk in x and y. Now, the random command now randomly spawns a pos in that area I choose but how the f*ck do I get my guys to walk there? IÂ've tried some ways like _x + _y = _thepoint and stuff but it doesnÂ't work.
I donÂ't want to use GLs and this have to be done someway since then those arty scripts wouldnÂ't work :-\. Plz help.

Thx in advance. :-*

EDIT: I made a little pic in MS Paint that can help u understand cause my english sux. ;D

*REMOVED*
« Last Edit: 16 Jun 2003, 17:46:04 by The real Armstrong »

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:random x and y=one point???
« Reply #1 on: 16 Jun 2003, 15:14:04 »
hmm - shouldn't it be:

xxx doMove [_x,_y]

soz, can't test it here at work to ensure it's correct

~S~ CD
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:random x and y=one point???
« Reply #2 on: 16 Jun 2003, 15:17:57 »
yea, tried that but it wouldnt work...  :-\

Komuna

  • Guest
Re:random x and y=one point???
« Reply #3 on: 16 Jun 2003, 15:27:08 »
[Chris Death]: Unit doMove [_x,_y,_z] - I belive _z is not mandatory, but try it, could be just a syntax error...

Unit Move [_x,_y] - This works fine... As doMove should work fine, to.

[Komuna]: ['Group','N'] SetWPPos [_x,_y,_z] - I'm not sure if the syntax is right... besides, i've never tested it ;D. But it could solve your problem, by conditioning a certain waypoint [Number='N'] of a certain 'Group' and activate it (or switch through trigger) when tha coordinates are given. #Edit: the command would set a new position for your WP (Waypoint)

Good luck, mate! :-* *



*sexual pervert... AhAhAh! ;)

« Last Edit: 16 Jun 2003, 15:30:39 by Komuna »

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:random x and y=one point???
« Reply #4 on: 16 Jun 2003, 16:05:05 »
u put point @ da westouthest (or da botom n left) of da area u want ;D name it startpoint

n point @ da eastnorthest (top right) of da area u want nd name it endinpoint

da script wil look like dat

_x = random ((getpos endinpoint select 0)-(getpos startpoint select 0))
_y = random ((getpos endinpoint select 1)-(getpos startpoint select 1))

unitname move [(getpos startpoint select 0)+_x,(getpos startpoint select 1)+_y,0]

shud work - if not ill find somin - cuz i know i did it in 1 of ma scripts

LCD OUT

[edit] or did i got da answer wrong ::)



« Last Edit: 16 Jun 2003, 16:06:35 by LCD »
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:random x and y=one point???
« Reply #5 on: 16 Jun 2003, 16:15:08 »
Thx guys, IÂ'll try that when I get home, right now I am at the library in shorts and the rain is pissin down so I canÂ't get home :'( :P

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re:random x and y=one point???
« Reply #6 on: 16 Jun 2003, 16:20:52 »
Huhm. Alright, in a script I'm not sure at this particular second. Not entirely sure what exactly it is that you need it for either. Might help if you'd enlighten us on that.

I mean, you can always make the "placement radius" of the waypoint huge to create some randomness...  ::)

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:random x and y=one point???
« Reply #7 on: 16 Jun 2003, 17:45:46 »
Code: [Select]
_center = _this select 0

_x = GetPos _Center select 0
_y = GetPos _Center select 1

_x = _x + Random(200) - 100
_y = _y + Random(200) - 100

Unit doMove [_x,_y]

Worked like a charm. Cheers.

*Topic solved and picture removed(need da space for more files ;D)*