Home
Intel Depot
Editors Depot
Missions Depot
Addons Depot
Forum
Home
Help
Search
Login
Register
OFPEC Forum
»
Editors Depot - Mission Editing and Scripting
»
OFP - Editing/Scripting General
(Moderators:
h-
,
savedbygrace
,
Gruntage
) »
smallest number
« previous
next »
Send this topic
Print
Pages: [
1
]
Go Down
Author
Topic: smallest number (Read 511 times)
0 Members and 1 Guest are viewing this topic.
j-man
Guest
smallest number
«
on:
30 Jan 2005, 20:29:00 »
I'm trying to create a script that will pick a car from a list that is closest to the player and send it out. I've managed to get the distances between tha player and the cars, but I found no easy way of checking which distance is the smallest. Is there something i'm missing
Logged
Triggerhappy
Contributing Member
Llama, it's what's for dinner.
Re:smallest number
«
Reply #1 on:
30 Jan 2005, 20:52:26 »
something like this:
(_cars is your array of cars)
_i = 0
#loop
_car = _cars select _i
{?_car distance player < _x distance player} foreach (_cars - [_car]):_closest = _car;goto "next"
_i = _i + 1
goto "loop"
#next
code that will use that car
«
Last Edit: 31 Jan 2005, 03:14:11 by Triggerhappy
»
Logged
Sliding plane crash script
Arrest script
Fragorl
Coding Team
Former Staff
Re:smallest number
«
Reply #2 on:
31 Jan 2005, 00:56:24 »
dont forget ur
i = i + 1
!
Logged
Triggerhappy
Contributing Member
Llama, it's what's for dinner.
Re:smallest number
«
Reply #3 on:
31 Jan 2005, 03:13:44 »
oops, my bad.
I'll fix that right now...
Logged
Sliding plane crash script
Arrest script
Send this topic
Print
Pages: [
1
]
Go Up
« previous
next »
OFPEC Forum
»
Editors Depot - Mission Editing and Scripting
»
OFP - Editing/Scripting General
(Moderators:
h-
,
savedbygrace
,
Gruntage
) »
smallest number
Top of page