Home   Help Search Login Register  

Author Topic: Random positions for a vehicle  (Read 596 times)

0 Members and 1 Guest are viewing this topic.

Milwot

  • Guest
Random positions for a vehicle
« on: 01 May 2004, 19:40:15 »
In the same way the hostage in "Operation Lojack" is at one of six random locations, I want to place a fuel truck in the same way...what would the script look like to do this?

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:Random positions for a vehicle
« Reply #1 on: 01 May 2004, 19:52:17 »
Put this in a script:

Code: [Select]
_truck = _this select 0

_random = random 6

? _random =< 1 : _truck setpos getpos pos1
? _random =< 2 : _truck setpos getpos pos2
? _random =< 3 : _truck setpos getpos pos3
? _random =< 4 : _truck setpos getpos pos4
? _random =< 5 : _truck setpos getpos pos5
? _random =< 6 : _truck setpos getpos pos6

exit

And execute it like this:
[Truckname] exec "nameofscript.sqs"

:beat: *Gets Shot* :beat:

j-man

  • Guest
Re:Random positions for a vehicle
« Reply #2 on: 01 May 2004, 20:18:14 »
I believe it's something like this:

_truck = _this select 0

_random = random 6

?(_random > 0) && (_random <= 1) : _truck setpos getpos pos1
?(_random > 1) && (_random <= 2) : _truck setpos getpos pos2
?(_random > 2) && (_random <= 3) : _truck setpos getpos pos3
?(_random > 3) && (_random <= 4) : _truck setpos getpos pos4
?(_random > 4) && (_random <= 5) : _truck setpos getpos pos5
?(_random > 5) && (_random <= 6) : _truck setpos getpos pos6

Milwot

  • Guest
Re:Random positions for a vehicle
« Reply #3 on: 01 May 2004, 20:19:15 »
Hmm...looks good...I put it in a script, put some "empty" markers down, and named the truck "truck"....but when I execute it, it says '
  • } Error Invalid Number in expression[/b]

Milwot

  • Guest
Re:Random positions for a vehicle
« Reply #4 on: 01 May 2004, 20:23:37 »
...and after trying J-man's version, it still says that and doesn't work....I'm using a radio Alpha trigger to do it....lemme know what you think...

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:Random positions for a vehicle
« Reply #5 on: 01 May 2004, 20:27:11 »
hmm - I'm a friend of using scripted solutions, but i'm also
a friend of easy & simple solutions - even if there's no need
for scripts  ;)

Maybe this one got lost during OFP's 3 years being:

create 6 markers and place them where you want the truck
to possibly appear

create your truck now and group it with all 6 markers (press F2
and drag a line from-to)

Now preview your mission as often as u want and guess where
the truck will appear  :D

:edit - off course you can make your markers invisible (make
'em rectangle size: 0/0 or so), once you did your drag-line-to-group job. If you do it before, i wish yer good luck to find the
markers  ;D

~S~ CD
« Last Edit: 01 May 2004, 20:28:51 by Chris Death »
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 Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:Random positions for a vehicle
« Reply #6 on: 01 May 2004, 20:28:44 »
Or even this:

Code: [Select]
_truck = _this select 0

_random = random 6
_num = random mod 1
_random = random - _num

? _random = 1 : _truck setpos getpos pos1
? _random = 2 : _truck setpos getpos pos2
? _random = 3 : _truck setpos getpos pos3
? _random = 4 : _truck setpos getpos pos4
? _random = 5 : _truck setpos getpos pos5
? _random = 6 : _truck setpos getpos pos6

exit

@Milwot

Where have you defined the positions:
pos1 through to pos6?


EDIT:.......OOPS


Planck
« Last Edit: 01 May 2004, 20:30:53 by Planck »
I know a little about a lot, and a lot about a little.

Milwot

  • Guest
Re:Random positions for a vehicle
« Reply #7 on: 01 May 2004, 20:33:13 »
Well waddya know...

No scripts are needed....Chris Death's Idea works...just group the truck to the markers and it works perfectly...

I defined the positions using "empty" markers...keep them together to find them, then move them to where they need to be.

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re:Random positions for a vehicle
« Reply #8 on: 01 May 2004, 21:53:29 »
There reason it didn't work was because you used markers, I thought you were going to use GLs or invisible Hs. You ahve to change the command getpos to getmarkerpos in order for it to work. ;)

:beat: *Gets Shot* :beat: