skyblader
You're living only because it's illegal killing.
- Reaction score
- 159
I made a loading/casting bar since I haven't found a proper GUI one, and another is in JASS. (Also made it sometime back, just didn't submit because of a few glitches) It's meant for users that have trouble getting NewGen, and for others that do not want to learn JASS. It would be much easier for them. At the moment, it's almost functional except for a few glitches here and there which I have not managed to solve. I would be really grateful if you would take some time to browse through my triggers and see if you can find anything wrong, or more ways to make it more efficient. Once it's fully functional, I'll post it in the tutorial and resources section. And do inform me if I missed out anything required for submission, and thanks in advance!
Current Problems:
-The bar jumps slightly at the start
-Doesn't work properly with other smoothness values
Features:
-Very customizable
-Can fit into almost every use (building, spell casting, attack cool down)
-Simple to implement and use (Made it as simple as I could)
Images:
Triggers:
This trigger is for adding in to wherever you're using the loading bar.
Changelog:
Do feel free to tell me, if there are things I can improve on. I'm looking to make it as efficient as possible in GUI. Thanks.
Download for testmap:View attachment Loading Bar in GUI.w3x
Current Problems:
-The bar jumps slightly at the start
-Doesn't work properly with other smoothness values
Loading/Casting Bar
In GUI
V 1.1
In GUI
V 1.1
Features:
-Very customizable
-Can fit into almost every use (building, spell casting, attack cool down)
-Simple to implement and use (Made it as simple as I could)
Images:
Triggers:
Trigger:
- LB Load
- Events
- Conditions
- Actions
- Unit Group - Pick every unit in LBUnitGroup and do (Actions)
- Loop - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- CheckAliveBool Equal to True
- Then - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- ((Picked unit) is alive) Equal to False
- Then - Actions
- Unit Group - Remove (Picked unit) from LBUnitGroup
- Hashtable - Clear all child hashtables of child (Key (Picked unit)) in LBHash
- Else - Actions
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Else - Actions
- Set LBTotalLength = (Load (Key LBTotalLength) of (Key (Picked unit)) from LBHash)
- Set LBTotalLengthInt = ((Integer(LBTotalLength)) x ((Integer(LBMultiplier)) + 2))
- Set LBLength = (Load (Key LBLength) of (Key (Picked unit)) from LBHash)
- Set LBLengthRemaining = (Load (Key LBLengthRemaining) of (Key (Picked unit)) from LBHash)
- Set LB = LBColour
- Set LBIntegerAReal = (LBLength x LBMultiplier)
- Set LBIntegerAInteger = (Integer(LBIntegerAReal))
- For each (Integer A) from 3 to LBTotalLengthInt, do (Actions)
- Loop - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- LBIntegerAReal Equal to (Real((Integer A)))
- Then - Actions
- Set LBIntegerAInteger = (Integer A)
- Else - Actions
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Loop - Actions
- For each (Integer A) from 0 to LBIntegerAInteger, do (Actions)
- Loop - Actions
- Set LB = (LB + LBPiece)
- Loop - Actions
- Set LB = (LB + |r)
- Set LBIntegerAReal = (LBLengthRemaining x LBMultiplier)
- Set LBIntegerAInteger = (Integer(LBIntegerAReal))
- For each (Integer A) from 0 to LBIntegerAInteger, do (Actions)
- Loop - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- LBLengthRemaining Greater than 0.00
- Then - Actions
- Set LB = (LB + LBPiece)
- Else - Actions
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Loop - Actions
- Floating Text - Create floating text that reads LB above (Picked unit) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
- Floating Text - Change (Last created floating text): Disable permanence
- Floating Text - Change the lifespan of (Last created floating text) to (LBSmooth + 0.05) seconds
- Floating Text - Change the fading age of (Last created floating text) to (LBSmooth + 0.05) seconds
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- LBLength Equal to LBTotalLength
- Then - Actions
- Unit Group - Remove (Picked unit) from LBUnitGroup
- Hashtable - Clear all child hashtables of child (Key (Picked unit)) in LBHash
- Else - Actions
- Hashtable - Save (LBLength + LBSmooth) as (Key LBLength) of (Key (Picked unit)) in LBHash
- Hashtable - Save (LBLengthRemaining - LBSmooth) as (Key LBLengthRemaining) of (Key (Picked unit)) in LBHash
- If - Conditions
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Loop - Actions
- Unit Group - Pick every unit in LBUnitGroup and do (Actions)
Trigger:
- LB Initialization
- Events
- Map initialization
- Conditions
- Actions
- -------- Set to true if you want the casting bar to be removed if the unit dies --------
- Set CheckAliveBool = False
- -------- Set colour of loading bar --------
- -------- Colour code starts with |c like in the example below. --------
- -------- It follows with the first two 00, which is transparency and can be ignored. --------
- -------- Next two 00, represents red. --------
- -------- Next two 00, represents green. --------
- -------- Next two 00, represents blue. --------
- -------- For example, |c00ff00ff would be a mixture of red and blue. --------
- -------- The default is black. --------
- Set LBColour = |c00000000
- -------- Set size of loading bar. Recommended 1. --------
- Set LBSize = 1
- -------- Set smoothness of Loading bar. Lower value = smoother. Recommended 0.20. Too smooth, loading bar will be too long. --------
- -------- Note: Might not work properly if smoothness is set to anything other than 0.20. --------
- Set LBSmooth = 0.20
- -------- Do not touch below unless you know what you're doing. --------
- -------- If you want to use your own hashtable, set LBHash to your hashtable and remove the action "Hashtable - Create a hashtable" --------
- Hashtable - Create a hashtable
- Set LBHash = (Last created hashtable)
- For each (Integer A) from 1 to LBSize, do (Actions)
- Loop - Actions
- Set LBPiece = (LBPiece + ')
- Loop - Actions
- Set LBMultiplier = (1.00 / LBSmooth)
- Trigger - Add to LB Load <gen> the event (Time - Every LBSmooth seconds of game time)
- Events
This trigger is for adding in to wherever you're using the loading bar.
Trigger:
- LB Setup
- Events
- Conditions
- Actions
- -------- Edit LBTotalLength to how long you want the loading bar to last. For example 10, if your unit takes 10 seconds to build a building. --------
- Set LBTotalLength = 10.00
- Set LBTotalLength = (LBTotalLength - LBSmooth)
- Set LBLength = 0.00
- Set LBLengthRemaining = LBTotalLength
- -------- Repalce triggering unit with your units. E.g. Attacking unit/constructing unit/picked unit --------
- Unit Group - Add (Triggering unit) to LBUnitGroup
- Hashtable - Save LBTotalLength as (Key LBTotalLength) of (Key (Triggering unit)) in LBHash
- Hashtable - Save LBLength as (Key LBLength) of (Key (Triggering unit)) in LBHash
- Hashtable - Save LBLengthRemaining as (Key LBLengthRemaining) of (Key (Triggering unit)) in LBHash
Changelog:
Code:
V 1.0
-Release
V 1.1
-Changed handles saved to texts instead of integers
-Added comment to use own hashtable
-Improved testing triggers
Do feel free to tell me, if there are things I can improve on. I'm looking to make it as efficient as possible in GUI. Thanks.
Download for testmap:View attachment Loading Bar in GUI.w3x