• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

vJass Questions

Status
Not open for further replies.
Level 12
Joined
May 20, 2009
Messages
822
So, I have to learn vJass, I guess, in order to use Progress Bars. I figured out what I could based off the examples. This is what I got, I really have no idea if it works and I haven't tested it yet:

JASS:
scope Farm initializer OnInit

    globals
    public ProgressBar bar = ProgressBar.create()
    endglobals
    
private function FarmProgressBar takes nothing returns nothing
    set bar.zOffset = 100
    set bar.color = PLAYER_COLOR_GREEN
    set bar.targetUnit = udg_FarmUnit[FarmIndex]
endfunction

public function SetFarmProgressBar takes nothing returns nothing
    call bar.setPercent(udg_Progress[FarmIndex])
endscope

Trying to save the map with this causes the editor to completely freeze. =\
(Yes I am using JassNewGen with JassHelper)
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
SetFarmProgressBar doesnt have an endfunction.
I dont really know about that system with the progressbars but it sounds they arent coded well.
I mean if you have to learn vJASS to use it...

The health bars in that system fail as well (in my testmap they eventually display 60% health but the unit has no life any more).
So I am not really surprised that it wont be really well done.

You can simply create a unit with the progressbar as model and set the unit's animation speed.
I think 100% is 1 second.
1000% would be 0.1 seconds and 1% would be 100 seconds.
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
Additionally, you cannot initialize user-defined types in globals block, because all globals blocks are moved above all the code, including the function that is called when you create new instance for any user-defined type(otherwise, it wouldn't be valid Jass file), so you have to move that to initializer.

Your scope doesnt have initializer either, despite you said to the scope there will be one.

Model speed is fucked up tho, thats why TriggerHappy(I believe) tried to make it using animations, because if you set animation speed below 8% or something, then the unit fucks up and will actually progress its animation at something like 6%, so you remove the unit and it isnt full yet even.
 
Status
Not open for further replies.
Top