Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Support

    3. Suggestions

Happy Holidays from the GTANet team!

random locations


Nesthor
 Share

Recommended Posts

 Hello, I have several mappings, especially for trucks, I would like to know if it is possible to save a location through a code, that is, that a variable is assigned to a place with its X Y Z coordinates, I would like to do a kind of missions, in which the player must take a load to other places that I will define in the code, but that is random so that he does not always have to go to the same place

Link to comment
Share on other sites

Yes of course, it's very simple and a usual method to check for the content of a specific var which lead the code to code blocks depending to the content of the var
Best example are the mission sniffers, if ever had a look into main.scm
So go to the thread that starts mission 13, 14, 15, 16, 17, 18, 19, 20, 21

the global var $SWEET_TOTAL_PASSED_MISSIONS is set to 0 by default
If mission Tagging up Turf is completed the var becomes to 1 by adding 1
$SWEET_TOTAL_PASSED_MISSIONS += 1
it becomes 2 by adding again 1 if mission Cleaning the Hood is completed
and so on

The mission sniffer checks for $SWEET_TOTAL_PASSED_MISSIONS and can so decide which mission should be started

00D6: if 
0038:   $SWEET_TOTAL_PASSED_MISSIONS == 0 

 

Spoiler
:SWEET
03A4: name_thread 'SWEET' 

:SWEET_11
0001: wait $DEFAULT_WAIT_TIME ms 
00D6: if 
0038:   $SWEET_TOTAL_PASSED_MISSIONS == 9 
004D: jump_if_false @SWEET_36 
004E: end_thread 

:SWEET_36
00D6: if 
0256:   player $PLAYER_CHAR defined 
004D: jump_if_false @SWEET_807 
00D6: if 
0038:   $ONMISSION == 0 
004D: jump_if_false @SWEET_807 
00D6: if 
00FF:   actor $PLAYER_ACTOR sphere 0 in_sphere $X_SWEET_HOUSE $Y_SWEET_HOUSE $Z_SWEET_HOUSE radius 1.2 1.2 2.0 on_foot 
004D: jump_if_false @SWEET_684 
00D6: if 
03EE:   player $PLAYER_CHAR controllable 
004D: jump_if_false @SWEET_684 
00D6: if 
0038:   $SWEET_TOTAL_PASSED_MISSIONS == 0 
004D: jump_if_false @SWEET_180 
0004: $ONMISSION = 1 
00BA: show_text_styled GXT 'SWEET_1' time 1000 style 2  // Tagging up Turf
0050: gosub @SUB_CJ_GOTO_SWEET_HOUSE 
0417: start_mission 13  // Tagging Up Turf

:SWEET_180
00D6: if 
0038:   $SWEET_TOTAL_PASSED_MISSIONS == 1 
004D: jump_if_false @SWEET_232 
0004: $ONMISSION = 1 
00BA: show_text_styled GXT 'SWEET1B' time 1000 style 2  // Cleaning the Hood
0050: gosub @SUB_CJ_GOTO_SWEET_HOUSE 
0417: start_mission 14  // Cleaning The Hood

:SWEET_232
00D6: if 
0038:   $SWEET_TOTAL_PASSED_MISSIONS == 2 
004D: jump_if_false @SWEET_284 
0004: $ONMISSION = 1 
00BA: show_text_styled GXT 'SWEET_3' time 1000 style 2  // Drive-thru
0050: gosub @SUB_CJ_GOTO_SWEET_HOUSE 
0417: start_mission 15  // Drive-Thru

:SWEET_284
00D6: if 
0038:   $SWEET_TOTAL_PASSED_MISSIONS == 3 
004D: jump_if_false @SWEET_336 
0004: $ONMISSION = 1 
00BA: show_text_styled GXT 'SWEET_2' time 1000 style 2  // Nines and AK's
0050: gosub @SUB_CJ_GOTO_SWEET_HOUSE 
0417: start_mission 16  // Nines And AK's

:SWEET_336
00D6: if 
0038:   $SWEET_TOTAL_PASSED_MISSIONS == 4 
004D: jump_if_false @SWEET_388 
0004: $ONMISSION = 1 
00BA: show_text_styled GXT 'SWEET_4' time 1000 style 2  // Drive-By
0050: gosub @SUB_CJ_GOTO_SWEET_HOUSE 
0417: start_mission 17  // Drive-By

:SWEET_388
00D6: if 
0038:   $SWEET_TOTAL_PASSED_MISSIONS == 5 
004D: jump_if_false @SWEET_440 
0004: $ONMISSION = 1 
00BA: show_text_styled GXT 'SWEET_5' time 1000 style 2  // Sweet's Girl
0050: gosub @SUB_CJ_GOTO_SWEET_HOUSE 
0417: start_mission 18  // Sweet's Girl

:SWEET_440
00D6: if 
0038:   $SWEET_TOTAL_PASSED_MISSIONS == 6 
004D: jump_if_false @SWEET_492 
0004: $ONMISSION = 1 
00BA: show_text_styled GXT 'SWEET_6' time 1000 style 2  // Cesar Vialpando
0050: gosub @SUB_CJ_GOTO_SWEET_HOUSE 
0417: start_mission 19  // Cesar Vialpando

:SWEET_492
00D6: if 
0038:   $SWEET_TOTAL_PASSED_MISSIONS == 8 
004D: jump_if_false @SWEET_684 
0956: get_respect_to $47 
00D6: if 
0018:   $47 > 1 
004D: jump_if_false @SWEET_632 
00BF: $TIME_HOURS = current_time_hours, $TIME_MINS = current_time_minutes 
00D6: if and
0028:   $TIME_HOURS >= 9 
001A:   17 > $TIME_HOURS 
004D: jump_if_false @SWEET_609 
00BE: text_clear_all 
0004: $ONMISSION = 1 
00BA: show_text_styled GXT 'SWEET_7' time 1000 style 2  // Los Sepulcros
0050: gosub @SUB_CJ_GOTO_SWEET_HOUSE 
0417: start_mission 20  // Los Sepulcros
0002: jump @SWEET_625 

:SWEET_609
00BC: show_text_highpriority GXT 'MTIME3' time 1000 flag 1  // ~s~Komm zwischen 9:00 Uhr und 17:00 Uhr wieder

:SWEET_625
0002: jump @SWEET_684 

:SWEET_632
00BC: show_text_highpriority GXT 'MOREREP' time 1000 flag 1  // ~s~Du musst dir mehr Respekt erwerben.
00D6: if 
0038:   $HELP_RESPECT_SHOWN == 0 
004D: jump_if_false @SWEET_684 
03E5: show_text_box 'HELP101'  // Du kannst dir Respekt erwerben, indem du bestimmte Missionen erf¬llst, indem du Mitglieder rivalisierender Gangs ausschaltest, indem du Gebiet eroberst und durch das Spr¬hen von Graffitis.
0004: $HELP_RESPECT_SHOWN = 1 

:SWEET_684
00D6: if 
00FF:   actor $PLAYER_ACTOR sphere 0 in_sphere 1365.251 -1280.12 12.5469 radius 1.2 1.2 2.0 on_foot 
004D: jump_if_false @SWEET_807 
00D6: if 
03EE:   player $PLAYER_CHAR controllable 
004D: jump_if_false @SWEET_807 
00D6: if and
0038:   $SWEET_TOTAL_PASSED_MISSIONS == 7 
0038:   $1346 == 1 
004D: jump_if_false @SWEET_807 
0004: $ONMISSION = 1 
00BA: show_text_styled GXT 'CRASH_2' time 1000 style 2  // Doberman
0050: gosub @SUB_FADE_500MS 
0417: start_mission 21  // Doberman

:SWEET_807
0002: jump @SWEET_11

 

 

 

 

 

This can also be done by local vars
The difference: global vars will be stored when making savegame, local vars not
So if you wanna do it by cleo and it should be stored in savegame, then it needs additional method

 

 

 

Edited by ZAZ
  • KEKW 1
Link to comment
Share on other sites

  • 2 weeks later...

i have some method for this, its matematic.

 

:startnumber

[email protected]=-500.0

[email protected]=-500.0

jump @loop 

 

:loop

car. storepos([email protected], [email protected], [email protected], [email protected])

* [email protected][email protected](float)

* [email protected][email protected](float)

 

* [email protected][email protected]

* [email protected][email protected]

[email protected]*=-1.0

[email protected]=500.0

* [email protected][email protected]

 

[email protected][email protected]

* [email protected][email protected]

 [email protected]*=-1.0

 [email protected]=500.0

* [email protected][email protected]

 

*get nearest car path coord from [email protected] [email protected] [email protected] to $x $y $z

 

car. driveto([email protected], $x, $y, $z)

 

*   [email protected][email protected](float) 

*   [email protected][email protected](float) 

jump @check 

 

:check 

if

* actor player actor sphere [email protected] [email protected] [email protected] radius 50.0 50.0 in_car

jf @check 

jump @loop

//---------------------//

 

* i mean use opcode, u can search it on sannybuilder. i forget it. 

 

that math formula u can mix it. but wit that, u will get random coord Every round. 

Edited by fikri7wgx
wrong type
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.