Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. Red Dead Redemption 2

      1. PC
      2. Gameplay
      3. Missions
      4. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
      4. Frontier Pursuits
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. DLC
      2. Find Lobbies & Players
      3. Guides & Strategies
      4. Vehicles
      5. Content Creator
      6. Help & Support
      7. The Diamond Casino Heist
    2. Grand Theft Auto Series

    3. GTA 6

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA IV Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA SA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA VC Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA III Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

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

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

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

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

    2. Forum Support

    3. Site Suggestions

Thesord

Debugging some code..

Recommended Posts

Thesord

Sorry for the long section of code. I've compiled without errors but I crash when the button in the check (look behind) is pressed. I'm almost sure I didn't make any mistakes.. Although I'm not sure, I might've made a mistake due to lack of attention, but still, I ask anyone experienced enough for help debugging this thread:

 

 

:Label00B0A60001: wait  250 ms00D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false ££Label00B0A600D6: if  080E0: NOT    player $PLAYER_CHAR driving004D: jump_if_false ££Label00B0A600D6: if  000E1:   key_pressed  0  19004D: jump_if_false ££Label00B0A60209: $VAR5 = random_int 0 10209: $VAR6 = random_int 0 1:LabelGuardRandomization 0001: wait 250 ms 00D6: if  00038:	egi $VAR5 = 0004D: jump_if_false ££LabelGuardRandomization10247: request_model #PGA00D6: if  00248: model #PGA available004D: jump_if_false ££LabelGuardRandomization0002: jump ££LabelWeaponRandomization:LabelGuardRandomization1 0001: wait 250 ms 00D6: if  00038:	egi $VAR5 = 1004D: jump_if_false ££LabelGuardRandomization0247: request_model #SGa00D6: if  00248: model #SGa available004D: jump_if_false ££LabelGuardRandomization1:LabelWeaponRandomization0001: wait 250 ms 00D6: if  00038:	egi $VAR6 = 0004D: jump_if_false ££LabelWeaponRandomization10247: request_model #UZI00D6: if  00248: model #UZI available004D: jump_if_false ££LabelWeaponRandomization0002: jump ££LabelGuardPossibility1:LabelWeaponRandomization1 0001: wait 250 ms 00D6: if  00038:	egi $VAR6 = 1004D: jump_if_false ££LabelWeaponRandomization0247: request_model #M400D6: if  00248: model #M4 available004D: jump_if_false ££LabelWeaponRandomization1 :LabelGuardPossibility1  0001: wait 250 ms00D6: if 10038:	egi $VAR5 = 00038:	egi $VAR6 = 0004D: jump_if_false ££LabelGuardPossibility20054: store_player $PLAYER_CHAR position_to  [email protected]  [email protected]  [email protected]  0007:  [email protected] =  1.2;; floating-point values005B:  [email protected] +=  [email protected];; floating-point values (never used in VC or GTA 3)009A:  [email protected] = create_actor  13 #PGA at  [email protected]  [email protected]  [email protected] 01B2: give_actor  [email protected] weapon  23 ammo  9999;; Load the weapon model before using this0002: jump ££Label00B0DC:LabelGuardPossibility2 0001: wait 250 ms00D6: if 10038:	egi $VAR5 = 10038:	egi $VAR6 = 0004D: jump_if_false ££LabelGuardPossibility30054: store_player $PLAYER_CHAR position_to  [email protected]  [email protected]  [email protected]  0007:  [email protected] =  1.2;; floating-point values005B:  [email protected] +=  [email protected];; floating-point values (never used in VC or GTA 3)009A:  [email protected] = create_actor  13 #SGa at  [email protected]  [email protected]  [email protected] 01B2: give_actor  [email protected] weapon  23 ammo  9999;; Load the weapon model before using this0002: jump ££Label00B0DC:LabelGuardPossibility30001: wait 250 ms00D6: if 10038:	egi $VAR5 = 00038:	egi $VAR6 = 1004D: jump_if_false ££LabelGuardPossibility40054: store_player $PLAYER_CHAR position_to  [email protected]  [email protected]  [email protected]  0007:  [email protected] =  1.2;; floating-point values005B:  [email protected] +=  [email protected];; floating-point values (never used in VC or GTA 3)009A:  [email protected] = create_actor  13 #PGA at  [email protected]  [email protected]  [email protected] 01B2: give_actor  [email protected] weapon  26 ammo  9999;; Load the weapon model before using this0002: jump ££Label00B0DC:LabelGuardPossibility40001: wait 250 ms00D6: if 10038:	egi $VAR5 = 10038:	egi $VAR6 = 1004D: jump_if_false ££LabelGuardPossibility10054: store_player $PLAYER_CHAR position_to  [email protected]  [email protected]  [email protected]  0007:  [email protected] =  1.2;; floating-point values005B:  [email protected] +=  [email protected];; floating-point values (never used in VC or GTA 3)009A:  [email protected] = create_actor  13 #SGa at  [email protected]  [email protected]  [email protected] 01B2: give_actor  [email protected] weapon  26 ammo  9999;; Load the weapon model before using this:Label00B0DC035E: set_player $PLAYER_CHAR armour_to  10001ED: reset_actor  [email protected] flags0243: set_actor  [email protected] ped_stats_to  00223: set_actor  [email protected] health_to  18002E2: set_actor  [email protected] weapon_accuracy_to  10001DF:	tie_actor_to_player  [email protected]  $PLAYER_CHAR:Label00B15C0001: wait  250 ms00D6: if  00118:   actor  [email protected] dead004D: jump_if_false ££Label00B15C0001: wait  2500 ms034F: destroy_actor_with_fade  [email protected];; The actor fades away like a ghost0001: wait  1200 ms:LabelModelRelease10001: wait 250 ms00D6: if 1   0038:	egi $VAR5 = 00038:	egi $VAR6 = 0004D: jump_if_false ££LabelModelRelease20249: release_model #PGA0249: release_model #UZI0002: jump ££Label00B0A6:LabelModelRelease20001: wait 250 ms00D6: if 1   0038:	egi $VAR5 = 10038:	egi $VAR6 = 0004D: jump_if_false ££LabelModelRelease30249: release_model #SGa0249: release_model #UZI0002: jump ££Label00B0A6:LabelModelRelease30001: wait 250 ms00D6: if 1   0038:	egi $VAR5 = 00038:	egi $VAR6 = 1004D: jump_if_false ££LabelModelRelease40249: release_model #PGA0249: release_model #M40002: jump ££Label00B0A6:LabelModelRelease40249: release_model #SGa0249: release_model #M40002: jump ££Label00B0A6

 

 

My bet is that the randomization opcode (0209) is what is making the game crash. Apologies for thr lack of comments.

Edited by Thesord

Share this post


Link to post
Share on other sites
Craig Kostelecky

You're right that 0209 is the issue. The variable has to be the first parameter. Then you have the lower and upper integers as the second and third parameters. Like this:

 

0209: $VAR5 = random_int 0 1

 

Share this post


Link to post
Share on other sites
Thesord
Thanks for the help Craig, now it stopped crashing, but another problem has risen, the randomness never occurs.. I set up $VAR5 and $VAR6 and use them during the script for that purpose, but I've tried more than ten times now, and I always get the actor with #PGA and #UZI models, just like if those 2 global variables were always 0. I know you can never be sure with random numbers, but it just seems to me that it isn't working.

Share this post


Link to post
Share on other sites
Craig Kostelecky

I'm not sure if the random number generator is inclusive or exclusive. Meaning I'm not sure if rand 0 4 will return 0, 1, 2, 3, or 4 or 1, 2, or 3. Maybe you could solve this by using rand 0 10. Then check if the number is greater or less than 5.

Share this post


Link to post
Share on other sites
Thesord

:Label00B0A60001: wait  250 ms00D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false ££Label00B0A600D6: if  080E0: NOT    player $PLAYER_CHAR driving004D: jump_if_false ££Label00B0A600D6: if  000E1:   key_pressed  0  19004D: jump_if_false ££Label00B0A60209: $VAR5 = random_int 0 100209: $VAR6 = random_int 0 10:LabelGuardRandomization 0001: wait 250 ms 00D6: if  1  002A:	gteig  5 >=  $VAR5004D: jump_if_false ££LabelGuardRandomization10247: request_model #PGA00D6: if  00248: model #PGA available004D: jump_if_false ££LabelGuardRandomization0002: jump ££LabelWeaponRandomization:LabelGuardRandomization1 0001: wait 250 ms 00D6: if  0002A:	gteig  5 <=  $VAR5004D: jump_if_false ££LabelGuardRandomization0247: request_model #CBa00D6: if  00248: model #SGa available004D: jump_if_false ££LabelGuardRandomization1:LabelWeaponRandomization0001: wait 250 ms 00D6: if  0002A:	gteig  5 >=  $VAR6004D: jump_if_false ££LabelWeaponRandomization10247: request_model #UZI00D6: if  00248: model #UZI available004D: jump_if_false ££LabelWeaponRandomization0002: jump ££LabelGuardPossibility1:LabelWeaponRandomization1 0001: wait 250 ms 00D6: if  0002A:	gteig  5 <=  $VAR6004D: jump_if_false ££LabelWeaponRandomization0247: request_model #M400D6: if  00248: model #M4 available004D: jump_if_false ££LabelWeaponRandomization1 :LabelGuardPossibility1  0001: wait 250 ms00D6: if 1002A:	gteig  5 >=  $VAR5002A:	gteig  5 >=  $VAR6004D: jump_if_false ££LabelGuardPossibility20054: store_player $PLAYER_CHAR position_to  [email protected]  [email protected]  [email protected]  0007:  [email protected] =  1.2 ;; floating-point values005B:  [email protected] +=  [email protected] ;; floating-point values (never used in VC or GTA 3)009A:  [email protected] = create_actor  13 #PGA at  [email protected]  [email protected]  [email protected] 01B2: give_actor  [email protected] weapon  23 ammo  9999 ;; Load the weapon model before using this0002: jump ££Label00B0DC:LabelGuardPossibility2 0001: wait 250 ms00D6: if 1002A:	gteig  5 <=  $VAR5002A:	gteig  5 >=  $VAR6004D: jump_if_false ££LabelGuardPossibility30054: store_player $PLAYER_CHAR position_to  [email protected]  [email protected]  [email protected]  0007:  [email protected] =  1.2 ;; floating-point values005B:  [email protected] +=  [email protected] ;; floating-point values (never used in VC or GTA 3)009A:  [email protected] = create_actor  13 #CBa at  [email protected]  [email protected]  [email protected] 01B2: give_actor  [email protected] weapon  23 ammo  9999 ;; Load the weapon model before using this0002: jump ££Label00B0DC:LabelGuardPossibility30001: wait 250 ms00D6: if 1002A:	gteig  5 >=  $VAR5002A:	gteig  5 <=  $VAR6004D: jump_if_false ££LabelGuardPossibility40054: store_player $PLAYER_CHAR position_to  [email protected]  [email protected]  [email protected]  0007:  [email protected] =  1.2 ;; floating-point values005B:  [email protected] +=  [email protected] ;; floating-point values (never used in VC or GTA 3)009A:  [email protected] = create_actor  13 #PGA at  [email protected]  [email protected]  [email protected] 01B2: give_actor  [email protected] weapon  26 ammo  9999 ;; Load the weapon model before using this0002: jump ££Label00B0DC:LabelGuardPossibility40001: wait 250 ms00D6: if 1002A:	gteig  5 <=  $VAR5002A:	gteig  5 <=  $VAR6004D: jump_if_false ££LabelGuardPossibility10054: store_player $PLAYER_CHAR position_to  [email protected]  [email protected]  [email protected]  0007:  [email protected] =  1.2 ;; floating-point values005B:  [email protected] +=  [email protected] ;; floating-point values (never used in VC or GTA 3)009A:  [email protected] = create_actor  13 #CBa at  [email protected]  [email protected]  [email protected] 01B2: give_actor  [email protected] weapon  26 ammo  9999 ;; Load the weapon model before using this:Label00B0DC035E: set_player $PLAYER_CHAR armour_to  10001ED: reset_actor  [email protected] flags0243: set_actor  [email protected] ped_stats_to  00223: set_actor  [email protected] health_to  18002E2: set_actor  [email protected] weapon_accuracy_to  10001DF:	tie_actor_to_player  [email protected]  $PLAYER_CHAR:Label00B15C0001: wait  250 ms00D6: if  00118:   actor  [email protected] dead004D: jump_if_false ££Label00B15C0001: wait  2500 ms034F: destroy_actor_with_fade  [email protected] ;; The actor fades away like a ghost0001: wait  1200 ms:LabelModelRelease10001: wait 250 ms00D6: if 1   002A:	gteig  5 >=  $VAR5002A:	gteig  5 >=  $VAR6004D: jump_if_false ££LabelModelRelease20249: release_model #PGA0249: release_model #UZI0002: jump ££Label00B0A6:LabelModelRelease20001: wait 250 ms00D6: if 1   002A:	gteig  5 <=  $VAR5002A:	gteig  5 >=  $VAR6004D: jump_if_false ££LabelModelRelease30249: release_model #CBa0249: release_model #UZI0002: jump ££Label00B0A6:LabelModelRelease30001: wait 250 ms00D6: if 1   002A:	gteig  5 >=  $VAR5002A:	gteig  5 <=  $VAR6004D: jump_if_false ££LabelModelRelease40249: release_model #PGA0249: release_model #M40002: jump ££Label00B0A6:LabelModelRelease40249: release_model #CBa0249: release_model #M40002: jump ££Label00B0A6

 

 

Well I updated and did as you suggested, but now something else happens, it still only spawns the PGA and UZI models, and sometimes the actor doesn't respawn when I press the button, thus seeming like the the thread stopped. I'm not quit sure why this is happening.

Share this post


Link to post
Share on other sites
Craig Kostelecky

I can see what's wrong with this code. You're using 002A for all of your comparisons. The ">=" or "<=" that show up are only there for a visual aid. They are completely ignored by the compiler. Here's the way those opcodes should be used in MB.

 

This would check if 5 is greater or less than $VAR5.

 

002A:   5 >= $VAR5

 

If you want to check the opposite way, you need to use 0028.

 

0028:   $VAR5 >= 5  

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • 2 Users Currently Viewing
    0 members, 0 Anonymous, 2 Guests

×
×
  • Create New...

Important Information

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