Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. The Criminal Enterprises
      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

*DO NOT* SHARE MEDIA OR LINKS TO LEAKED COPYRIGHTED MATERIAL. Discussion is allowed.

VERY small question


bull.04
 Share

Recommended Posts

Alright cool, thanks. Also, how would I go about drawing it in numbered text? I have a small script maybe you could diagnose.

 

 

{$CLEO .cs}thread 'TXTHLTH'[email protected] = 1:TXTHLTH_1wait 0ifPlayer.Defined($PLAYER_CHAR)jf @TXTHLTH_1ifPlayer.Controllable($PLAYER_CHAR)jf @[email protected] = Actor.Health($PLAYER_ACTOR)0092: [email protected] = float [email protected] to_integer 0095: make [email protected] absolute_integerjump @TXTHLTH_3:TXTHLTH_2wait 0if0062: [email protected] -= [email protected] // (int)  jf @TXTHLTH_6 jump @TXTHLTH_3:TXTHLTH_6wait 0if005A: [email protected] += [email protected] // (int)  jf @TXTHLTH_2jump @TXTHLTH_4:TXTHLTH_3wait [email protected] >= 20jf @TXTHLTH_40512: show_permanent_text_box 'HLTH2'  // Player's Health if it gets below 20.jump @TXTHLTH_2:TXTHLTH_4wait [email protected] <= 20jf @TXTHLTH_503E6: remove_text_box0512: show_permanent_text_box 'HLTH1'  // Player's Health if it gets above 20.jump @TXTHLTH_2:TXTHLTH_5wait 0ifActor.Dead($PLAYER_ACTOR)jf @TXTHLTH_403E6: remove_text_box 0512: show_permanent_text_box 'HLTH3'  // Player's Health if he dies.jump @TXTHLTH_2

 

 

And here is my GXT:

 

HLTH1 ~g~HEALTH: ~1~~w~HLTH2 ~r~HEALTH: ~1~~w~HLTH3 ~b~HEALTH: ~1~~w~

 

 

Anyways, if you can't thats fine. Just wondering and trying to get some learning about integers and floats.

Link to comment
Share on other sites

Try this.

 

 

{$CLEO .cs}thread 'TXTHLTH' :TXTHLTH_11wait 0 if   Player.Defined($PLAYER_CHAR)else_jump @TXTHLTH_11 [email protected] = Actor.Health($PLAYER_ACTOR)if   not [email protected] > 20 else_jump @TXTHLTH_106 if  [email protected] > 1 else_jump @TXTHLTH_137 045A: draw_text_1number 50.0 50.0 GXT 'HLTH3' number [email protected] jump @TXTHLTH_11 :TXTHLTH_106045A: draw_text_1number 50.0 50.0 GXT 'HLTH1' number [email protected] jump @TXTHLTH_11 :TXTHLTH_137045A: draw_text_1number 50.0 50.0 GXT 'HLTH2' number [email protected] jump @TXTHLTH_11

 

user posted image
Link to comment
Share on other sites

It worked but it crashes after about 5 seconds in game. Don't know whats causing it but it's weird...

 

 

UPDATE: I got the loops working, now it isn't counting changes in health. When it meets the [email protected] < 20 check it crashes, instead of displaying my health.

Edited by bull.04
Link to comment
Share on other sites

spaceeinstein

Always check the original script. Surely the game has done this before. An integer value is returned when reading your health. If you want to use UNRADTED's code, don't use 045A.

Link to comment
Share on other sites

What opcode should I use for it?

 

EDIT:

I stored the health to an integer and changed the text drawing. But it still crashes.

 

{$CLEO .cs}thread 'TXTHLTH'[email protected] = 1 :TXTHLTH_1wait 0 if  Player.Defined($PLAYER_CHAR)jf @TXTHLTH_1ifPlayer.Controllable($PLAYER_CHAR)jf @[email protected] = Actor.Health($PLAYER_ACTOR)0084: [email protected] = [email protected] // (int)jump @TXTHLTH_4:TXTHLTH_4 wait 0if0184:   actor $PLAYER_ACTOR health >= 20jf @TXTHLTH_5033F: set_text_draw_letter_size 0.6 2.6 033E: set_draw_text_position 550.0 350.0 GXT 'HLTH1'  // HEALTH: 045A: draw_text_1number 550.0 375.0 GXT 'HLTH4' number [email protected]  // ~1~%jump @TXTHLTH_4:TXTHLTH_5wait 0if8184:   not actor $PLAYER_ACTOR health >= 20jf @TXTHLTH_6033F: set_text_draw_letter_size 0.6 2.6 033E: set_draw_text_position 550.0 350.0 GXT 'HLTH2'  // HEALTH: 045A: draw_text_1number 550.0 375.0 GXT 'HLTH5' number [email protected]  // ~1~%jump @TXTHLTH_4:TXTHLTH_6wait 0if8184:   not actor $PLAYER_ACTOR health >= 1jf @TXTHLTH_4033F: set_text_draw_letter_size 0.6 2.6 033E: set_draw_text_position 550.0 350.0 GXT 'HLTH3'  // HEALTH: 045A: draw_text_1number 550.0 375.0 GXT 'HLTH6' number [email protected]  // ~1~%jump @TXTHLTH_4

 

Edited by bull.04
Link to comment
Share on other sites

Now all I need is a way to update an integer. I tried opcode 0627 but it didn't yield results.

I declared [email protected] as the Players health, then transferred [email protected] to [email protected] through an integer and now I need a way to update the integer.

 

EDIT: CRAP! Sorry I accidentally double posted. Meant to edit.

Link to comment
Share on other sites

spaceeinstein

Use 01E5. Text_high/lowpriority opcodes are easier to use than draw_text.

 

This makes no sense:

 

[email protected] = Actor.Health($PLAYER_ACTOR)0084: [email protected] = [email protected] // (int)

 

You're setting [email protected] as equal to [email protected], which is not defined anywhere, so you'll always get "0" in return. If you want [email protected] = [email protected], it is redundant. You're not using [email protected] anywhere else, only in this code. So just use [email protected]

Edited by spaceeinstein
Link to comment
Share on other sites

 

Use 01E5. Text_high/lowpriority opcodes are easier to use than draw_text.

 

This makes no sense:

 

[email protected] = Actor.Health($PLAYER_ACTOR)0084: [email protected] = [email protected] // (int)

 

You're setting [email protected] as equal to [email protected], which is not defined anywhere, so you'll always get "0" in return. If you want [email protected] = [email protected], it is redundant. You're not using [email protected] anywhere else, only in this code. So just use [email protected]

Oh I thought I was transferring [email protected] to [email protected] aka converting it into an integer, so I guess it has always been an integer. Also, I declared [email protected] as 100 in the beginning, but that also didn't work so yeah.

 

Also, it looks as if 01E5 doesn't have text positioning. Is there a way to position that text?

Link to comment
Share on other sites

spaceeinstein

Oh, I didn't know that you wanted custom text. Here's a working code:

 

 

{$CLEO .cs}constHEALTH = [email protected]  // reading a variable as a word is better than as a numberend0000:while true   wait 0   if       Player.Defined($PLAYER_CHAR)   then       if           Player.Controllable($PLAYER_CHAR)       then           HEALTH = Actor.Health($PLAYER_ACTOR)  // stores an integer value of the player's health           if               HEALTH >= 20  // if the value (your health) is greater than 20           then               033F: set_text_draw_letter_size 0.6 2.6               033E: set_draw_text_position 550.0 350.0 GXT 'HLTH1'  // HEALTH:               045A: draw_text_1number 550.0 375.0 GXT 'HLTH4' number HEALTH  // ~1~%           end           if and               20 > HEALTH  // if the value is between 1 and 20               HEALTH >= 1           then               033F: set_text_draw_letter_size 0.6 2.6               033E: set_draw_text_position 550.0 350.0 GXT 'HLTH2'  // HEALTH:               045A: draw_text_1number 550.0 375.0 GXT 'HLTH5' number HEALTH  // ~1~%           end           if               1 > HEALTH  // if the value is less than 1           then               033F: set_text_draw_letter_size 0.6 2.6               033E: set_draw_text_position 550.0 350.0 GXT 'HLTH3'  // HEALTH:               045A: draw_text_1number 550.0 375.0 GXT 'HLTH6' number HEALTH  // ~1~%           end           03F0: text_draw_toggle 0       end   endend

 

 

The main problem with text_draw in loops is that you have to place "03F0: text_draw_toggle 0" at least once in a loop containing a text_draw opcode. Another problem is your original code only read your health once. It did not loop back to TXTHLTH_1 to reread your health again.

Edited by spaceeinstein
Link to comment
Share on other sites

The main problem with text_draw in loops is that you have to place "03F0: text_draw_toggle 0" at least once in a loop containing a text_draw opcode. Another problem is your original code only read your health once. It did not loop back to TXTHLTH_1 to reread your health again.

I think the proper use is to use this opcode ONCE with param 1. But, it's a good idea to loop it in CLEOs, when you're not sure if SCM thread will mess with it, for example.

Link to comment
Share on other sites

spaceeinstein

I'm unsure how SA works, but in VC, text_draws stay permanent on the screen unless you use 03F0: 0 to clear all text, especially important if you loop your code. Without it, the game will keep drawing additional text overlapping the previous ones until it reaches the limit and freezes the game.

Link to comment
Share on other sites

In SA enable_text_draw 1 makes it draw only for one frame, makes it obsolete to loop the opcode (unless you make a CLEO script, when you are unsure how the flag is set by SCM threads/other CLEOs). VC may have a worse system though.

Link to comment
Share on other sites

So the toggle only works once? I just wanted to use the draw_text_1number and size and position that then make the toggle loop. But that is obsolete in SA? Makes sense I guess. I will try spaceeinsteins code real quick and get back with results.

 

EDIT:

Oh spaceeinsteins uses the same basic concept as mine. So is there any way to size and position high priority text? That's all I need to do now, seeing as I put it to read the Actor's health before every text render and it worked with high priority text.

 

EDIT:

YESS! I GOT IT! The toggle actually worked big time, but the reason it stayed at 100 is because I forgot to change the variable the text read and I had a [email protected] variable at the beginning of the script set to 100 and no decreasing.

Edited by bull.04
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.