OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Milwot 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?
-
Put this in a script:
_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:
-
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
-
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]
-
...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...
-
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
-
Or even this:
_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
-
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.
-
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: