1. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  2. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  3. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[vJASS] Team colored health bars

Discussion in 'Triggers & Scripts' started by TheFrenchLeprechaun, Feb 9, 2017.

  1. TheFrenchLeprechaun

    TheFrenchLeprechaun

    Joined:
    Jun 22, 2012
    Messages:
    464
    Resources:
    0
    Resources:
    0
    Hey there!

    I can't use regular team color in my project so I decided to use this system : HP MP Bars Team-Colored

    TriggerHappy has shared a test map to show how to use those team colored bars : Полоски маны, жизни и каста - WarCraft 3 - XGM: Gamedev & Modmaking

    I tried to import this system to my map but I have troubles to make it work. First I've imported the bars custom units and models, then the following triggers : 'ProgressBars v2 1', 'TimerUtils', 'BoundSentinel'. At this state, the map compile well. Finally, I've imported 'HP | MP bars' and I've adjusted the custom units IDs in the code of this trigger. When I compile the following error occurs :

    Error

    Capture.PNG


    I've looked into the triggers to see where UnitAlive could be defined twice without success. Any help would be much appreciated :)!

    +rep and +credit for helpers!
     
  2. Athur12A2

    Athur12A2

    Joined:
    Sep 16, 2016
    Messages:
    269
    Resources:
    6
    Models:
    6
    Resources:
    6
    You should delete any of 2 repeated lines
     
  3. TheFrenchLeprechaun

    TheFrenchLeprechaun

    Joined:
    Jun 22, 2012
    Messages:
    464
    Resources:
    0
    Resources:
    0
    The line is coded only once in the 'HP | MP bars' trigger (maybe the second occurence is in another trigger). I put the line in commentary and the map now compiles. But the game lags as hell and the bars don't seem to work (they are either away, either empty).

    The map provided by TriggerHappy is an example, and I don't know if it can be used "as it" since I'm not familiar with Jass...

    EDIT : native UnitAlive is defined in another Jass spell I use : Dune Worm v1.05b
     
    Last edited: Feb 10, 2017
  4. TriggerHappy

    TriggerHappy

    Code Moderator

    Joined:
    Jun 23, 2007
    Messages:
    3,833
    Resources:
    22
    Spells:
    11
    Tutorials:
    2
    JASS:
    9
    Resources:
    22
  5. TheFrenchLeprechaun

    TheFrenchLeprechaun

    Joined:
    Jun 22, 2012
    Messages:
    464
    Resources:
    0
    Resources:
    0
    I'm using JNGP 2.0.10, isn't it the last version of JNGP?
     
  6. TriggerHappy

    TriggerHappy

    Code Moderator

    Joined:
    Jun 23, 2007
    Messages:
    3,833
    Resources:
    22
    Spells:
    11
    Tutorials:
    2
    JASS:
    9
    Resources:
    22
    That's an unofficial update that uses a broken JassHelper as it's default option.

    Your options are either to use Vexorian's JassHelper, or remove all instances of
    native UnitAlive
    except for one.
     
  7. TheFrenchLeprechaun

    TheFrenchLeprechaun

    Joined:
    Jun 22, 2012
    Messages:
    464
    Resources:
    0
    Resources:
    0
    I've tried to remove one. The map compile. But the game lags a lot, and the HP and MP bars are not displaying correctly. Some units don't have bars (but that may be because they lack some attachment point), some units have empty bars (for both HP and MP).

    Do I have to import the 'Looping' trigger? And the progress bar dummy ('pbar')?
     
  8. KILLCIDE

    KILLCIDE

    Administrator

    Joined:
    Jul 22, 2015
    Messages:
    3,504
    Resources:
    20
    Models:
    2
    Icons:
    10
    Spells:
    7
    Tutorials:
    1
    Resources:
    20
    I've only had that error spit out at me if I was using Cohader's JassHelper. You should switch to Vexorian.
     
  9. TheFrenchLeprechaun

    TheFrenchLeprechaun

    Joined:
    Jun 22, 2012
    Messages:
    464
    Resources:
    0
    Resources:
    0
    I'm a bit lost, tell me if I'm right :

    It exists different compilers for Jass, and Jass helper is one of them. I should download the version of Vexorian and add it to my JNGP grimoire?

    EDIT : I've found how to switch to Vexorian's JassHelper : same that with Cohadar's. Maybe I should downgrade my JNGP version? To which version? 2.0.9? 2.0.7?

    EDIT2 : with Vexorian's JassHelper and JNGP 2.0.7 no more lag! But the bars are still empty (if the unit is on the map at map init) or away (if the unit is created after map init)... @TriggerHappy, do I have to import the 'Looping' trigger?
     
    Last edited: Feb 11, 2017
  10. Athur12A2

    Athur12A2

    Joined:
    Sep 16, 2016
    Messages:
    269
    Resources:
    6
    Models:
    6
    Resources:
    6
    I do hope you only inexperience with vjass. This one contains an add-in for GUI users, you can modify them easier.

    Edit: You should replace old trigger named "HP | MP Bar" in your map with the one in mine. Copy the 2 new trigger (Register and BarInit) into your map. Config like below.

    dd.jpg
     

    Attached Files:

    Last edited: Feb 12, 2017
  11. TheFrenchLeprechaun

    TheFrenchLeprechaun

    Joined:
    Jun 22, 2012
    Messages:
    464
    Resources:
    0
    Resources:
    0
    Thanks for your help! So, I've tested this out, updating triggers and rawcodes, using the following conditions for :
    • 'Register' trigger :
    • (Unit-type of (Triggering unit)) Equal to Gondorian horseman

    • 'BarInit' trigger :
    • (Unit-type of TempUnit) Equal to Gondorian horseman


    The bars are displaying in both case without lag. But there's a problem with the value displayed by the bars. On the following pic, the horseman on the left has been created after map init, it appears with a full bar, but when it is wounded the bar doesn't display the good amount of HP (see example with 50% HP). The two horsemen on the right are created at init with 100% HP, they aren't wounded on the picture, but the bars don't agree :p

    screenshot
    WC3ScrnShot_021417_143647_01.png


    I'll try to see if I find an explanation of that in 'HP | MP bars' and 'ProgressBars v2.1' :)


    EDIT : when a unit with an attached bar dies, a string (the name of the team of the dying unit) displays twice

    screenshot
    aaa.png
     
    Last edited: Feb 14, 2017
  12. Athur12A2

    Athur12A2

    Joined:
    Sep 16, 2016
    Messages:
    269
    Resources:
    6
    Models:
    6
    Resources:
    6
    Idk about the bar showing wrong percentage, but the text is due to Progressbar library, you can find the BJ DisplayTimedTextToForce and delete it.