• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Making a cast bar system

Status
Not open for further replies.
Level 7
Joined
Aug 19, 2009
Messages
278
I have gone through many cast bar systems here on hive and some other site. Mostly for some reason I feel all cast bar systems are complicated and use vjass which I don't know.

So I am planning to make a cast bar system.

I need to ask a few things before it though.

How to make a player lose control of a unit?(I also need it when I trigger stuns)
But unit should be animated.

Can we increase or decrease the size of cast bar i.e "|||||||||||"?

Are there any alternatives other than using "|||||||||||" ? Like using Images?

Is there anyway to make the bar appear always above the caster? If it includes setting a variable for each unit, it is also fine.
 
How to make a player lose control of a unit?(I also need it when I trigger stuns)
But unit should be animated.
Use a stun snippet. There are some available in the JASS section and spells section. I recommend using one of the JASS stun systems, since it usually only requires one line of custom script to stun a unit then instead of multiple GUI lines.


Are there any alternatives other than using "|||||||||||" ? Like using Images?
Yes. You can also use dummyunits with a progressbar model like those:
http://www.hiveworkshop.com/forums/models-530/progresscastingbar-227064/?prev=search=bar&d=list&r=20
http://www.hiveworkshop.com/forums/models-530/progressbar-v2-223392/?prev=search=bar&d=list&r=20

Also, there's a system that uses lightnings instead of floating texts/models for a neat unique look:
http://www.hiveworkshop.com/forums/2334901-post7.html

Is there anyway to make the bar appear always above the caster? If it includes setting a variable for each unit, it is also fine.[/QUOTE]
 
Level 7
Joined
Aug 19, 2009
Messages
278
Use a stun snippet. There are some available in the JASS section and spells section. I recommend using one of the JASS stun systems, since it usually only requires one line of custom script to stun a unit then instead of multiple GUI lines.



Yes. You can also use dummyunits with a progressbar model like those:
http://www.hiveworkshop.com/forums/models-530/progresscastingbar-227064/?prev=search=bar&d=list&r=20
http://www.hiveworkshop.com/forums/models-530/progressbar-v2-223392/?prev=search=bar&d=list&r=20

Also, there's a system that uses lightnings instead of floating texts/models for a neat unique look:
http://www.hiveworkshop.com/forums/2334901-post7.html

Is there anyway to make the bar appear always above the caster? If it includes setting a variable for each unit, it is also fine.
[/QUOTE]

I like the progressbarv2.. I guess i will make my system using it. Thanks..
 
I like the progressbarv2.. I guess i will make my system using it. Thanks..
Progressbar V2 has one huge drawback, though:
- The model itself does only look good from one side. If you turn the camera to the other side, even if its billboarded, the bar will disappear
- If the model animation is issued outside of the screen, the animation might not display correctly when viewed

I fixed the first issue for my own take on the model (and added an inverted animation to it), but the version here on hive still has this issue.
The second thing, however, can not be fixed. The other progressbar uses animation indices instead of time scaling the animation, which solves the second issue aswell.
If you know about modelling, I recommend using the way the other bar model works and applying it to the better looks of progressbar V2.
 
Level 7
Joined
Aug 19, 2009
Messages
278
Progressbar V2 has one huge drawback, though:
- The model itself does only look good from one side. If you turn the camera to the other side, even if its billboarded, the bar will disappear
- If the model animation is issued outside of the screen, the animation might not display correctly when viewed

I fixed the first issue for my own take on the model (and added an inverted animation to it), but the version here on hive still has this issue.
The second thing, however, can not be fixed. The other progressbar uses animation indices instead of time scaling the animation, which solves the second issue aswell.
If you know about modelling, I recommend using the way the other bar model works and applying it to the better looks of progressbar V2.




I tested to turn the screen but the bar doesn't disappear. Nope i don't know about modeling.

I don't know modeling.. But i found sometimes cast bar gets inaccurate. Is that what you mean?




------edit----------


I want to make my ability work like this..

Unit casts an ability.. trigger checks the start the effect of an ability.. Stops him from casting it.

Channels the ability by trigger lets say for 2 seconds.
i.e. The trigger check if the unit stops or moves in those 2 seconds.

After 2 seconds cast that spell through trigger (putting it in cooldown) only if the channeling is complete. Or else cancels everything. Is this possible?
 
Last edited:
Level 20
Joined
Jul 14, 2011
Messages
3,213
Yes, it is. You can make the ability channeling and use "A unit begins channeling an ability" and start your progress bar. use "A unit stops channeling an ability" to stop the progress bar.
 
Level 7
Joined
Aug 19, 2009
Messages
278
Yes, it is. You can make the ability channeling and use "A unit begins channeling an ability" and start your progress bar. use "A unit stops channeling an ability" to stop the progress bar.

No you didn't understand.

Starts the effect of an ability (say X) then order unit to stop casting and begin its channeling animation

A trigger checking if the casting unit moves or casts the stop ability. If it does that, stops casting the spell.(Channeling by trigger) Or gets stunned.

If it is interrupted, no cooldown and the trigger which casts it stops.

If it doesn't do anything or gets interrupted by stuns. The spell (X) is casted by trigger which makes it go into cooldown.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Of course i understood. You can achieve that with "Begins" and "Stops" channeling ability events. If the unit moves or gets stunned it stops, so does the channel bar.
 
Level 7
Joined
Aug 19, 2009
Messages
278
Of course i understood. You can achieve that with "Begins" and "Stops" channeling ability events. If the unit moves or gets stunned it stops, so does the channel bar.

But if the unit channels it can't be moved. And I want to make the duration dynamic.
 
Level 7
Joined
Aug 19, 2009
Messages
278
But you want to stop your unit and stop channeling if it moves... What do you mean with "dynamic"?

Means the cast time can be changed at anytime.(triggering the cast time)

I can't work on it today. I will send it to you tomorrow if it "work"..
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
You can make the channel last any time you want in the OE, and, after the unit has channeled enough time, stop it and cast the ability.
 
Level 7
Joined
Aug 19, 2009
Messages
278
You can make the channel last any time you want in the OE, and, after the unit has channeled enough time, stop it and cast the ability.

How?
Will it go to cool down after that?

Can we make a trigger to check if the unit channeled the spell for x amount of time then cast the spell? Will the unit be moveable while channeling the spell?
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
You can use a negative timer (Set timer to 60 second) and if the unit stops channeling, check the timing left on the timer, substract the #1 from the #2 and you get the channeling time.

Another way is adding the unit to a group and with a periodic loop add the periodic duration (0.03) in a variable or hashtable untill the channel time has reached it's goal.

If the unit moves or gets stunned or any other stun/hide/hex effect is applied during channeling the channel stops automatically and goes into cooldown.

If you save in a Hashtable the duration of all your channeling abilities, you can detect the ability being cast and config your castbar adjust accordingly, and all the other stuffs too. It's a peace of cake. You can avoid the hashtable if you use an Array and some math.
 
Level 7
Joined
Aug 19, 2009
Messages
278
You can use a negative timer (Set timer to 60 second) and if the unit stops channeling, check the timing left on the timer, substract the #1 from the #2 and you get the channeling time.

Another way is adding the unit to a group and with a periodic loop add the periodic duration (0.03) in a variable or hashtable untill the channel time has reached it's goal.

If the unit moves or gets stunned or any other stun/hide/hex effect is applied during channeling the channel stops automatically and goes into cooldown.

If you save in a Hashtable the duration of all your channeling abilities, you can detect the ability being cast and config your castbar adjust accordingly, and all the other stuffs too. It's a peace of cake. You can avoid the hashtable if you use an Array and some math.

Is there a way we can check if the unit is still channeling an ability?

I want to give and example what I want to do..

This is just and example original system which I will be making will be in jass and MUI. This is just the "concept".
  • Untitled Trigger 001
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Channel
    • Actions
      • Unit - Order (Triggering unit) to Stop
      • Animation - Play (Triggering unit)'s channel animation
      • Wait 2.00 game-time seconds //(cast time of the spell... It will be done by and unit group and a seperate trigger to be more accurate and MUI. I know about waits)
      • Trigger - Turn off (This trigger) // There will be more conditions to check if the unit is still casting. Has it moved or stoper etc
      • Unit - Order (Triggering unit) to Human Mountain King - Thunder Clap //To make spell go in cooldown
      • Wait 2.00 game-time seconds
      • Trigger - Turn on (This trigger)
Is there a better way to do what I want? This looks clumbsy but the warcraft 3 channel doesn't allow unit to move while channeling(Canceling the channel).
The alternative I am thinking detect when the target is issued order to move to a point. Issue the stop and then move the target. But it doesn't work
 
Last edited:
Since you are not actually casting as soon as you move the unit, you need to define which actions should cancel the "custom channeling" and which actions shouldn't.

Basicly, what you can do is using a hashtable here.
You store the ID of the spell used to the Key of the casting unit.
Then you can also store the time remaining to the Key of casting unit.
You also add the unit to a global group and loop through that group every second.

With every group loop, you reduce all time remaining values for the units by 1 by replacing the table entries. If it reaches 0, you fire that spell and clear it from the group and table.

If the unit is issued one of the "forbidden" orders that cancel casting (catch them by events), you simply lookup that unit in the hashtable, flush the child table and then remove the unit from the casting group aswell.

The beauty about this is: if the unit starts channeling again while already channeling, the hashtable values will automaticly get overwritten again so the timer starts anew.
 
Level 7
Joined
Aug 19, 2009
Messages
278
Since you are not actually casting as soon as you move the unit, you need to define which actions should cancel the "custom channeling" and which actions shouldn't.

Basicly, what you can do is using a hashtable here.
You store the ID of the spell used to the Key of the casting unit.
Then you can also store the time remaining to the Key of casting unit.
You also add the unit to a global group and loop through that group every second.

With every group loop, you reduce all time remaining values for the units by 1. If it reaches 0, you fire that spell and clear it from the group and table.

If the unit is issued one of the "forbidden" orders that cancel casting (catch them by events), you simply lookup that unit in the hashtable, flush the child table and then remove the unit from the casting group aswell.

I was going to do that with multiple arrays. I like using index arrays than hastables. So triggering wont be a problem.

But I don't like the clumbsy part of the system where I have to use wait to turn of the trigger and again turn it on.

I guess I can use a timer to turn it on so that its MUI. But I was thinking of an alternative. Like using the channel. But when the unit is issued to move while in channel. Using Stop order to stop the channel then move to the point. But can't make that work.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Oh... wait. In both cases the abilities would have to be triggered, unless you use some kind of boolean to know if the unit has already charged an specific ability... you would also have to know if the ability is point, unit or no-target, since each one involves a different order (or GUI/jass Command) You can't just stop the unit, and then tell it to continue casting.
 
Last edited:
You have to trigger all abilities anyway. There is no way to do that with just object editor available spells.

You don't need to turn on/turn off triggers or use waits.
You can do all that with just a periodic trigger and a casting event, using either indexing or a hashtable.
Hashtable is the easier solution in this case, as a unit should not be indexed twice here and hashtables provide fast lookup that indexing doesn't.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Zwiebelchen, and how to cast the ability? I have all the loop and stuff thing, but i'm stuck at ordering the unit to cast (or start the triggered effect). I tough about storing a function name within the ability Id and call that function when the timer reaches 0 but I can't find a way to achieve it. Also, I don't know how to make it work for any ability... I mean... Would I have to take any possible argument (unit, point, no-target, duration, x, x, x, x) for any ability, and just rely on the function argument use those it uses, and null the others?
 
Level 7
Joined
Aug 19, 2009
Messages
278
You have to trigger all abilities anyway. There is no way to do that with just object editor available spells.

You don't need to turn on/turn off triggers or use waits.
You can do all that with just a periodic trigger and a casting event, using either indexing or a hashtable.
Hashtable is the easier solution in this case, as a unit should not be indexed twice here and hashtables provide fast lookup that indexing doesn't.

How can this without turning off the the trigger? If you don't switch off the trigger, when the unit casts the spell by trigger, it will again be stopped.

Example

  • Untitled Trigger 001
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Channel
    • Actions
      • Game - Display to (All players) the text: gaba
      • Unit - Order (Triggering unit) to Stop
      • Animation - Play (Triggering unit)'s channel animation
      • Wait 5.00 game-time seconds
      • Set trigger = (This trigger)
      • Trigger - Turn off trigger
      • Unit - Order (Triggering unit) to Human Mountain King - Thunder Clap
      • Countdown Timer - Start timer as a One-shot timer that will expire in 0.00 seconds
And

  • timer
    • Events
      • Time - timer expires
    • Conditions
    • Actions
      • Trigger - Turn on trigger
      • Animation - Play Caster of Spells 0001 <gen>'s attack animation
      • Animation - Queue Caster of Spells 0001 <gen>'s stand animation
This works but you need to make the cast point to 0
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
envenger; periodic triggers are used as "dummy timers". You just make a trigger that every 0.03 seconds reduces a value stored in a variable array or hashtable by 0.03, checking that when that value is less than or = to 0, means it has "expired", and the functions takes place from there on. That way, you don't need to use waits or timers.

I'm also working on this, I'm just having problems with what I said in my last post.

EDIT: I just had the idea to have all the possible ability triggered arguments into variable arrays, and use those in each function calling. Now I just need to know how to store the functions in the unit Id... I'm not sure if i can do it as a string.
 
You can not store the function inside the table. But you can store a trigger.
So basicly all you need is making a trigger without any events and conditions, then store the casting unit, the target and the trigger to be executed into the table aswell and simply run the trigger when the counter expires.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Finally found a way to achieve it. Thanks Zwiebelchen for some tips ;).

You just have to adjust the Channel Bar model/effect based on the Channel Time and the periodic loop. (I didn't import the system and model, I just made the channel and summon part)
 

Attachments

  • Channel.w3x
    21.4 KB · Views: 72
Last edited:
Status
Not open for further replies.
Top