[Snippet] A Method of taking nearest random vehicle

Ninja FTW

Well-Known Member
Joined
Aug 11, 2017
Messages
61
Likes
0
Points
6
Location
Saturn
#1
Since, 0AB5 do not work in Multi-Player. There is a simple method of taking nearest car with specific radius!


PHP:
00A0: store_actor $PLAYER_ACTOR position_to [email protected] [email protected] [email protected] // This will store the XYZ Position in Variable [email protected] [email protected] [email protected] (X = [email protected], Y = [email protected], Z = [email protected])
 0AE2: [email protected] = random_vehicle_near_point [email protected] [email protected] [email protected] in_radius 10.0 find_next 0 pass_wrecked 0 // random car in near point and
Kinda useless but snippet is snippet!

Constant radius i recommend is 9.0
 
OP
OP
Ninja FTW

Ninja FTW

Well-Known Member
Joined
Aug 11, 2017
Messages
61
Likes
0
Points
6
Location
Saturn
#3
RE: [Snippet] Get nearest Vehicle with specific Radius

Opcode.eXe said:
this doesnt take the nearst car! it takes the first car inside the memory in a predefined radius.
Add a activation with jump at the end. Each time you'll Enter the Activation code in different place.. each time it'll take nearest car which will store the new car inside the memory.

Add few lines like (radius [email protected] and then [email protected] += 1.0) and edit it everytime in-game with a particular key and connect it with '0AE2'. That's all. 

Looks complicated when reading but easy in making.
 

supahdupahnubah

Well-Known Member
Joined
Dec 31, 2015
Messages
674
Likes
2
Points
18
#4
RE: [Snippet] Get nearest Vehicle with specific Radius

Ninja FTW said:
Opcode.eXe said:
this doesnt take the nearst car! it takes the first car inside the memory in a predefined radius.
Add a activation with jump at the end. Each time you'll Enter the Activation code in different place.. each time it'll take nearest car which will store the new car inside the memory.

Add few lines like (radius [email protected] and then [email protected] += 1.0) and edit it everytime in-game with a particular key and connect it with '0AE2'. That's all. 

Looks complicated when reading but easy in making.
Then you should rename the snippet or add some description in it
 

Zin

Well-Known Member
Joined
Aug 1, 2013
Messages
1,269
Likes
0
Points
36
Website
youtube.com
#5
RE: [Snippet] Get nearest Vehicle with specific Radius

Seems like a pretty pointless snippet tbh as most people want snippets for complex stuff that takes a bunch of math and memory coding to accomplish. Whereas this is not that hard to figure out on your own.
 
OP
OP
Ninja FTW

Ninja FTW

Well-Known Member
Joined
Aug 11, 2017
Messages
61
Likes
0
Points
6
Location
Saturn
#6
RE: [Snippet] Get nearest Vehicle with specific Radius

Zin said:
Seems like a pretty pointless snippet tbh as most people want snippets for complex stuff that takes a bunch of math and memory coding to accomplish. Whereas this is not that hard to figure out on your own.
Why not easy and making newbies life easy.

 

supahdupahnubah

Well-Known Member
Joined
Dec 31, 2015
Messages
674
Likes
2
Points
18
#7
RE: [Snippet] Get nearest Vehicle with specific Radius

Ninja FTW said:
supahdupahnubah said:
Then you should rename the snippet or add some description in it
There is no need to. It's very same like that opcode which does not work in MP anymore. It finds a closest car but random closest! Now, the setting of radius and opcode magic.. it's becomes familiar like closest opcode.
Closest car in area != Random car in area, it will fail in more serious calculations, since it will give you "random" handle of a car, that's what I'm trying to say
 

Opcode.eXe

Well-Known Member
Joined
Feb 18, 2013
Messages
1,256
Likes
10
Points
38
Location
( ͡° ͜ʖ ͡°)
Website
www.youtube.com
#8
RE: [Snippet] Get nearest Vehicle with specific Radius

Code:
0AB1: @GET_CLOSEST_CAR 0 [email protected]

:GET_CLOSEST_CAR
[email protected] = 300.0 // search radius
[email protected] = -1 // make vehicle invalid
IF
0AE2: [email protected] = random_vehicle_near_point in_radius 300.0 find_next 0 pass_wrecked 0
THEN
    REPEAT
    IF    
    056E:   car [email protected] defined
    THEN
        00A0: store_actor $PLAYER_ACTOR position_to [email protected] [email protected] [email protected]
        00AA: store_car [email protected] position_to [email protected] [email protected] [email protected]
        050A: [email protected] = distance_between_XYZ [email protected] [email protected] [email protected] and_XYZ [email protected] [email protected] [email protected]
        IF         
        0025:   [email protected] > [email protected]  // (float)
        THEN
            0087: [email protected] = [email protected] // (float) // set search radius to closest
            0087: [email protected] = [email protected] // (float) // store car
        END        
    END
    UNTIL 8AE2: [email protected] = random_vehicle_near_point [email protected] [email protected] [email protected] in_radius 300.0 find_next 1 pass_wrecked 0
END
0AB2: ret 1 [email protected]
Here it will loop through all vehicles and filter the closest one out!
 
OP
OP
Ninja FTW

Ninja FTW

Well-Known Member
Joined
Aug 11, 2017
Messages
61
Likes
0
Points
6
Location
Saturn
#9
RE: [Snippet] Get nearest Vehicle with specific Radius

Lol, if you've read the topic.. I've said that it's just a method of taking nearest car.. not an actual or total opcode.
 
Top