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.

Making a new health bar?


bull.04
 Share

Recommended Posts

So I never understood how to make a bar representing something's health. Like Sweet's health in Sweet's Girl mission. Would anyone know how to make a copy of that in CLEO format? And if so, is there a way to scale that bar?

Link to comment
Share on other sites

spaceeinstein

 

03C4: set_status_text_to $100 1 'DUMMY'while true   wait 10   $100 = your health   if       you dead   then       0151: remove_status_text $100       break   endend

 

 

CLEO can't use global variables, though, and this opcode can only support global variables. Search for a work around for this problem, it's somewhere in this forum.

Edited by spaceeinstein
Link to comment
Share on other sites

So it can only be done with global variables which CLEO doesn't use? What if I defined a special global variable within the CLEO script, would that change anything?

Link to comment
Share on other sites

spaceeinstein

If you really want to use global variables, use an useless global var from the game. As long as you're not adding global vars that the script did not define or you're not changing existing global vars, then you can use global vars. Sanny's CustomVariables.ini file should provide you with some unused variables that you can use.

Link to comment
Share on other sites

So I made a new healthbar in PS to represent each 10% of health lost. I used 11 different textures for the health bar and made a TON of checks to draw a special texture when the health is in that area. The problem is is that the texture just flickers really badly and is just pure white, even though I am sure I used the right texture names.

 

Anyways, here is the code, and if you can help me fix the flickering it would be appreicated.

 

{$CLEO .cs}thread 'HLTHBAR':HLTHBAR_1wait 0ifPlayer.Defined($PLAYER_CHAR)jf @HLTHBAR_1ifPlayer.Controllable($PLAYER_CHAR)jf @[email protected] = Actor.Health($PLAYER_ACTOR)0390: load_txd_dictionary 'AVATARS'038F: load_texture "HEALTH" as 2 // Load dictionary with 0390 first038F: load_texture "HLT90" as 4 // Load dictionary with 0390 first038F: load_texture "HLT80" as 6 // Load dictionary with 0390 first038F: load_texture "HLT70" as 8 // Load dictionary with 0390 first038F: load_texture "HLT60" as 10 // Load dictionary with 0390 first 038F: load_texture "HLT50" as 12 // Load dictionary with 0390 first 038F: load_texture "HLT40" as 14 // Load dictionary with 0390 first038F: load_texture "HLT30" as 16 // Load dictionary with 0390 first038F: load_texture "HLT20" as 20 // Load dictionary with 0390 first038F: load_texture "HLT10" as 22 // Load dictionary with 0390 first038F: load_texture "HLT00" as 24 // Load dictionary with 0390 firstjump @HLTHBAR_505:HLTHBAR_505wait 0if0184:  actor $PLAYER_ACTOR health >= 99 jf @[email protected] = Actor.Health($PLAYER_ACTOR)038D: draw_texture 2 position 505.0 400.0 size 130.0 55.0 RGBA 255 255 255 255jump @HLTHBAR_1:HLTHBAR_3wait 0if [email protected] = 90                                                                                                            [email protected] = [email protected] = [email protected] = [email protected] = 86jf @HLTHBAR_4if [email protected] = [email protected] = [email protected] = [email protected] = [email protected] = 81jf @HLTHBAR_4038D: draw_texture 4 position 505.0 400.0 size 130.0 55.0 RGBA 255 255 255 255jump @HLTHBAR_1 :HLTHBAR_4wait 0if [email protected] = 80                                                                                                            [email protected] = [email protected] = [email protected] = [email protected] = 76jf @HLTHBAR_5if [email protected] = [email protected] = [email protected] = [email protected] = [email protected] = 71jf @HLTHBAR_5038D: draw_texture 6 position 505.0 400.0 size 130.0 55.0 RGBA 255 255 255 255jump @HLTHBAR_1:HLTHBAR_5wait 0if [email protected] = 70                                                                                                            [email protected] = [email protected] = [email protected] = [email protected] = 66jf @HLTHBAR_6if [email protected] = [email protected] = [email protected] = [email protected] = [email protected] = 61jf @HLTHBAR_6038D: draw_texture 8 position 505.0 400.0 size 130.0 55.0 RGBA 255 255 255 255jump @HLTHBAR_1:HLTHBAR_6wait 0if [email protected] = 60                                                                                                            [email protected] = [email protected] = [email protected] = [email protected] = 56jf @HLTHBAR_7if [email protected] = [email protected] = [email protected] = [email protected] = [email protected] = 51jf @HLTHBAR_7038D: draw_texture 10 position 505.0 400.0 size 130.0 55.0 RGBA 255 255 255 255jump @HLTHBAR_1:HLTHBAR_7wait 0if [email protected] = 50                                                                                                            [email protected] = [email protected] = [email protected] = [email protected] = 46jf @HLTHBAR_8if [email protected] = [email protected] = [email protected] = [email protected] = [email protected] = 41jf @HLTHBAR_8038D: draw_texture 12 position 505.0 400.0 size 130.0 55.0 RGBA 255 255 255 255jump @HLTHBAR_1:HLTHBAR_8wait 0if [email protected] = 40                                                                                                            [email protected] = [email protected] = [email protected] = [email protected] = 36jf @HLTHBAR_9if [email protected] = [email protected] = [email protected] = [email protected] = [email protected] = 31jf @HLTHBAR_9038D: draw_texture 14 position 505.0 400.0 size 130.0 55.0 RGBA 255 255 255 255jump @HLTHBAR_1:HLTHBAR_9wait 0if [email protected] = 30                                                                                                            [email protected] = [email protected] = [email protected] = [email protected] = 26jf @HLTHBAR_10if [email protected] = [email protected] = [email protected] = [email protected] = [email protected] = 21jf @HLTHBAR_10038D: draw_texture 16 position 505.0 400.0 size 130.0 55.0 RGBA 255 255 255 255jump @HLTHBAR_1:HLTHBAR_10wait 0if [email protected] = 20                                                                                                            [email protected] = [email protected] = [email protected] = [email protected] = 16jf @HLTHBAR_11if [email protected] = [email protected] = [email protected] = [email protected] = [email protected] = 11jf @HLTHBAR_11038D: draw_texture 20 position 505.0 400.0 size 130.0 55.0 RGBA 255 255 255 255jump @HLTHBAR_1:HLTHBAR_11wait 0if [email protected] = 10                                                                                                            [email protected] = [email protected] = [email protected] = [email protected] = 6jf @HLTHBAR_12if [email protected] = [email protected] = [email protected] = [email protected] = [email protected] = 1jf @HLTHBAR_12038D: draw_texture 22 position 505.0 400.0 size 130.0 55.0 RGBA 255 255 255 255jump @HLTHBAR_1:HLTHBAR_12wait 0ifActor.Dead($PLAYER_ACTOR)jf @HLTHBAR_505038D: draw_texture 24 position 505.0 400.0 size 130.0 55.0 RGBA 255 255 255 255jump @HLTHBAR_1

 

 

Also, I did put avatars.txd in the models/txd directory because it worked before I added all the checks, but I only added the full healthbar and made a constant draw texture loop but the problem is is that the texture just rendered for like 1 ms then deleted so I needed a loop, but apparently adding checks after that loop makes the texture flicker.

 

Sorry, this is probably very complicated...

Link to comment
Share on other sites

You added too many wait 0s. You only need one per check loop, not one per if statement. And instead of checking if the player's health is equal to every number, you could just check if it's in between two.

 

 

{$CLEO .cs}//-------------MAIN---------------thread 'HLTHBAR' 0390: load_txd_dictionary 'AVATARS' 038F: load_texture "HEALTH" as 2 // Load dictionary with 0390 first 038F: load_texture "HLT90" as 4 // Load dictionary with 0390 first 038F: load_texture "HLT80" as 6 // Load dictionary with 0390 first 038F: load_texture "HLT70" as 8 // Load dictionary with 0390 first 038F: load_texture "HLT60" as 10 // Load dictionary with 0390 first 038F: load_texture "HLT50" as 12 // Load dictionary with 0390 first 038F: load_texture "HLT40" as 14 // Load dictionary with 0390 first 038F: load_texture "HLT30" as 16 // Load dictionary with 0390 first 038F: load_texture "HLT20" as 20 // Load dictionary with 0390 first 038F: load_texture "HLT10" as 22 // Load dictionary with 0390 first 038F: load_texture "HLT00" as 24 // Load dictionary with 0390 first :HLTHBAR_144wait 0 if   Player.Defined($PLAYER_CHAR)else_jump @HLTHBAR_144 [email protected] = Actor.Health($PLAYER_ACTOR):HLTHBAR_172if 0184:   actor $PLAYER_ACTOR health >= 99 else_jump @HLTHBAR_233 038D: draw_texture 2 position 505.0 400.0 size 130.0 55.0 RGBA 255 255 255 255 jump @HLTHBAR_144 :HLTHBAR_233if and [email protected] > 80   not [email protected] > 91 else_jump @HLTHBAR_301 038D: draw_texture 4 position 505.0 400.0 size 130.0 55.0 RGBA 255 255 255 255 jump @HLTHBAR_144 :HLTHBAR_301if and [email protected] > 70   not [email protected] > 81 else_jump @HLTHBAR_369 038D: draw_texture 6 position 505.0 400.0 size 130.0 55.0 RGBA 255 255 255 255 jump @HLTHBAR_144 :HLTHBAR_369if and [email protected] > 60   not [email protected] > 71 else_jump @HLTHBAR_437 038D: draw_texture 8 position 505.0 400.0 size 130.0 55.0 RGBA 255 255 255 255 jump @HLTHBAR_144 :HLTHBAR_437if and [email protected] > 50   not [email protected] > 61 else_jump @HLTHBAR_505 038D: draw_texture 10 position 505.0 400.0 size 130.0 55.0 RGBA 255 255 255 255 jump @HLTHBAR_144 :HLTHBAR_505if and [email protected] > 40   not [email protected] > 51 else_jump @HLTHBAR_573 038D: draw_texture 12 position 505.0 400.0 size 130.0 55.0 RGBA 255 255 255 255 jump @HLTHBAR_144 :HLTHBAR_573if and [email protected] > 30   not [email protected] > 41 else_jump @HLTHBAR_641 038D: draw_texture 14 position 505.0 400.0 size 130.0 55.0 RGBA 255 255 255 255 jump @HLTHBAR_144 :HLTHBAR_641if and [email protected] > 20   not [email protected] > 31 else_jump @HLTHBAR_709 038D: draw_texture 16 position 505.0 400.0 size 130.0 55.0 RGBA 255 255 255 255 jump @HLTHBAR_144 :HLTHBAR_709if and [email protected] > 10   not [email protected] > 21 else_jump @HLTHBAR_777 038D: draw_texture 20 position 505.0 400.0 size 130.0 55.0 RGBA 255 255 255 255 jump @HLTHBAR_144 :HLTHBAR_777if and [email protected] > 0   not [email protected] > 11 else_jump @HLTHBAR_845 038D: draw_texture 22 position 505.0 400.0 size 130.0 55.0 RGBA 255 255 255 255 jump @HLTHBAR_144 :HLTHBAR_845if   Actor.Dead($PLAYER_ACTOR)else_jump @HLTHBAR_172 038D: draw_texture 24 position 505.0 400.0 size 130.0 55.0 RGBA 255 255 255 255 jump @HLTHBAR_144

 

user posted image
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.