Is there a way to change the duration of a buff/effect for an ability? I am trying to create an Unholy Frenzy that changes duration based on the amount of charges in an item that a hero is carrying. Thank you.
P.S. I've had no luck with Google to find the answer.
well i think the only way is.. U make that much different ability with different durations how much the item can be stacked
or trigger the spell by yourself
basically this would be the better option
i think it can be done easily by setting the ebility max level to how much the item can stack and when used
check the number of stacks .. and use the ability with that level on the unit with a dummyunit
Some abilities get 'infinite' duration when it's set to '0'. If not, you can place "9999" duration (about three hours).
This way, you work the 'Effect' Removal, instead of the 'Effect' Duration.
"Effect lasts 20 seconds" = "Effect is removed after 20 seconds". It's the same, but from a different perspective.
Why not just make it so when this 'Unholy Frenzy' is cast, the buff/ability just replays again? You could have it manually done so you copy-paste this buff/ability "x" amount of times, each copy-pasted buff/ability having a different time taken to cast and when you cast unholy frenzy, if you have "x" charges in your inventory then cast buff "x" on unit "x". Something like that is all I can think off at the top of my head without WEditor xD
Hmm this seems like useful information, thank you all.
@Spartipilo: What is this "Effect Removal" thing anyway, based on what I have read it sounds like the trigger "Remove Buff of Type."
@Levdragon: Are you saying that a Dummy should recast Unholy Frenzy on the target?
So far I have this idea after reading the posts:
Set Unholy Frenzy to the max duration (lets just say 20 for example).
Create a trigger that removes the Unholy Frenzy buff based on the charges of said item.
The variable could be.... "DurationFrenzy" equal to Charge*4. The trigger could look like something like this:
If triggering unit has greater than 0 Charges then,
Wait "DurationFrenzy" seconds.
Remove buff from targeted unit of type Unholy Frenzy.
How does that sound to you all?
Good, but not the "Wait" part. The "Wait" action is mean and evil Try not to use it. Timers are used for this. I don't know precisely how to work timers for units the way you want to, but I'm sure there are a lot of resources around for that. Basically, you have to start a timer with the Charges * 4 duration, and remove the buff when timer expires.
The next method will require a Unit Indexing System (Bribe has a good one in Spell Section)
An "easy" way to do it is with a loop.
1) Create a Unit Group called whatever you want (I'll call it "UnholyGroup"). Also create a "Integer Array" for the loop, and "Integer Array" for the time limit.
2) Create a Trigger that adds the casting unit to UnholyGroup when casts the skill and set TimeLimit[Custom Value of Casting Unit] = Charges on item * 4.
3) Create a Trigger that every 1 sec (If number of units in UnholyGroup > 0) picks every unit in UnholyGroup and
set Int_Timer[Custom Value of Picked Unit] = Int_Timer[Custom Value of Picked Unit] + 1.
Create an If/Then/Else, and
JASS:
if Int_Timer[Custom Value of Picked Unit] = TimeLimit[Custom Value of Casting Unit] or Unit has "Unholy Frenzy" buff = False then
Set TimeLimit[Custom Value of Casting Unit] = 0, and remove the unit from UnholyGroup.
There's another way using Hashtables, but is almost the same. Instead of using Custom Value of Unit, can use Unit ID, and works for infinite unit (If you plan to use this for over 8190 units at the same time).
Using "Number of charged greater than 0" means the unit has the item. Item with 0 charges is empty slot.
Huh? What's the problem with several systems working with the unit custom value? They don't change it, just takes it to know which unit is.... Some kind of Unit Id replacement.
Well thats a ton of information that is new to me so I'll have to learn more about these custom values and hash tables. I tried the trigger I made in my earlier post and it WOULD HAVE worked if it weren't for the "Wait" trigger. I'm guessing that "Wait" uses only absolute values (for lack of better word) and no mathematical equations such as (Charge*4). Because then the "Wait" trigger just assumes that you want the trigger to last 0 seconds. It literally get rids of the buff right away.
And waits an inaccurate... and also, the trigger forgets every value associated to the event that fired the trigger except TriggeringUnit after a wait function...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.