We want to have % cooldown reduction as stat on items. 100% cooldown reduction should reduce the cooldown from 20seconds to 10 seconds, as example.
Edit:
VERY IMPORTANT:
In Behavior Buff Modifications there is an entry under "Behavior" named RATE MULTIPLIER ARRAY - this is cooldown reduction IN ITSELF. If you modify the value of "Cooldown" in this array to 2 all cooldowns will cool down twice as fast! It doesn't change the number on cooldowns, but it's a small price to save yourself massive trigger work.
uhhh, I would like to point out here that a 100% reduction would take 20 seconds down to 0 seconds. a 100% increase on 10 seconds, would be 20 seconds. With the above ratio, I am not sure it is possible, since 100% of 20 is 20. However, using a system where 100% equals 100% in all situations, it is reasonably doable; so long as each player only controls a single unit with the ability; or all units have the ability changed equally. I speak of course of the "set catalog field value"
We want to have % cooldown reduction as stat on items. 100% cooldown reduction should reduce the cooldown from 20seconds to 10 seconds, as example.
Assuming I guessed right on what you are looking to achieve, I see no reason you couldn't do a system like this. I assume you would want 200 % reduction to take 20 to 5, and 250 % from 20 to 3.75, right? I did a little thinking of how you could achieve this, and here is what I came up with:
(Please keep in mind this is is pseudo code, for purpose of logic only, I recommend fixed variables)
baseDuration = 20.0;
reduction = 0.0;
x = 50.0;
i = ReductionCombinedAmount (whatever this may be);
while(i > 100)
{
i -= 100; (take 100 away from i)
red += x; (Add to reduction in %)
x \= 2; (Reduce 50 to 25, 25 to 12.5, etc)
}
(reduction would now be at 75.00 for 250 % reduction)
i \= 100; (To take care of any left after dealing 100 % at a time)
i *= x; (X value Should be good to go from the while loop no problem)
reduction += i; (reduction would now be at 81.25 for 250 % reduction)
reduction *= -1; (reduction goes from 81.25 to -81.25 for reducing purposes)
reduction += 100; (reduction goes from -81.25 to 18.75, the actual recast amount we want)
reduction \= 100; (18.75 becomes .1875, to make it a usable percentage)
reduction *= baseDuration; (This makes 20 become 3.75 as desired)
SetCatalog1(blahblah,reduction);(If you need help w/ setcatalog let me know, assuming you know here.)
And there you have it, you now have a reduction percentage of .1875, just multiply whatever your base durations might be by that and it will give you the value you want there. This will work for 1 % reduction to 2000 % reduction or whatever, of course this is assuming you were thinking along these terms of how you want reduction to work. Kind of fun to come up with a solution for that actually, might add it to my own project at some point.
If parts aren't clear, please by all means repost and ask about what doesn't make sense to you, I will do my best to clear it up.
I think I will find a good way to get the numbers the way I want, more interestingly tho, I would like to know how you can actually implement Cooldown Reduction, aka what does the trigger need to do to actually reduce the cooldown and what is a good way to set that up.
Per player there can be multiple units with different amounts of cooldown reduction.
The problem I was worried about was this (Which I encountered while working with attack speed):
Assume a base cast speed of 10.0
I pick up 1 item with 10% increased cast speed (This reduces my current attack speed by 10%) my new cast speed will be 9.00
I pick up 10 items with 1% attack speed, my new attack speed is 9.14
The other problem to be encountered is, if you have a cast time of 10, and remove 10% (picking the easier way above) you have a new cast time of 9.00
If you add 10% back to that, your new cast time will be 9.9; not 10.0
It seems as though zergling has overcome both of these problems (So long as the base cast time for each spell is saved in a variable for reference) Very good mathing and the sorts there zergling.
Ohh, uhhh, I am not sure you can implement a TRUE cooldown reduction then, as catalog field values affect all of a unit type for a player.
Using the same system above, you could manually reset the cooldown for a unit after a timer expires. If you have hundreds of units using abilities though, I fear this would be quite laggy; and the cooldown "count down" would not reflect properly.
It is possible to add a set cooldown if you know the link, and it is possible to clear the cooldown (although not take away 15 seconds, only reduction allowed is total clearing). So a simple take away some cooldown won't work, but I do have another idea.
First, you would need to keep track of the ability used, unit that used it (just use triggering unit and store that as a temp variable), reduction to be done, and of course you'd need a way of getting the cooldown link.
Second, you would need to make an action of sorts to handle this, with option Create Thread checked. Say you wanted to make your 20 second cooldown take only 4 seconds. Well you'd need to call this action with ability used, unit that used, new recast time, and cooldown link, WAIT for 4 seconds, then use the clear the cooldown trigger. This is the only way I'm seeing this realistically happen if multiples of the same unit for the same player are allowed and you want the possibility of different cooldown reductions for each.
Edit: Do NOT use timers or catalogsets if this is what you are aiming for by the way, it'd screw everything up.
What about clearing the cooldown and then adding a reverted percentage? e.g. I have 100% CDR, resulting in 50% less cooldown, when an ability is used, say it has 45 second cooldown, the cooldown is cleared and then 22.5 seconds are added again.
Doable, and would make the cooldown look cleaner on the user side, but you'd have to disable that ability somehow while you were doing this, otherwise if it was an instant no target type ability, it would be possible to get a free cast(s) during the trigger delay if you mashed the key real hard or had a macro setup to turbo press it for you. Be unlimited free casts possibly then....
...,but you'd have to disable that ability somehow while you were doing this, otherwise if it was an instant no target type ability, it would be possible to get a free cast(s) during the trigger delay if you mashed the key real hard or had a macro setup to turbo press it for you. Be unlimited free casts possibly then....
I don't believe so, because before the trigger executes, the ability is on cooldown because of its own cooldown. Then the trigger kicks in, resets the cooldown and instantly adds the new cooldown. There is no way a player-executed command could interfere.
@OP: You can easily make a generalized function, that works for any spell. You can get the triggering ability command, get the ability ID from there, use catalogs to read out the cooldown link and cooldown amount and calculate stuff with it.
It could probably look somewhat like this. Tested and seems to work correctly. However, this would trigger for a ton of abilities, you probably want to implement a whitelist of abilities (or units), rather than excluding everything you don't want to trigger it.
I don't believe so, because before the trigger executes, the ability is on cooldown because of its own cooldown. Then the trigger kicks in, resets the cooldown and instantly adds the new cooldown. There is no way a player-executed command could interfere.
You say you don't think so, then post an example doing exactly what was being said in the last 2 posts? Go home Kueken, you are drunk.
Some other maps uses timescale to reduce the cooldown and it works fine but the problem with timescale that it makes the unit move and attack faster = the percentage of the time scale that you gave. but this can be solved by decreasing movement and attack speed by the same amount of the timescale.
another problem with timescale that it dose not change the text ( cooldown number ) on the ability but it makes the time moves faster. Also timescale can make the behavior go faster ( i.e if you have a behavior which creates fire every 10 seconds and you increased time scale by 100% then the fire will be created every 5 seconds )
i saw many maps doing cooldown reduction this way like infested arena for example and i personaly use it too because blizzard didnt give us anyother easy way to do it.
@OP: You can easily make a generalized function, that works for any spell. You can get the triggering ability command, get the ability ID from there, use catalogs to read out the cooldown link and cooldown amount and calculate stuff with it.
It could probably look somewhat like this. Tested and seems to work correctly. However, this would trigger for a ton of abilities, you probably want to implement a whitelist of abilities (or units), rather than excluding everything you don't want to trigger it.
I can't get this to work, e.g. I dont even know what variable you used for "ability" and I cannot get the 3rd set variable action to what you made.
P.S.: If you provide me the trigger in a map that would be great. It can be made to trigger for every ability, as my current project only has heros and no other units. And every hero will probably have cooldown reduction in some way.
By the way - if you use "add cooldown to unit ability" and enter a negative value it does indeed reduce the cooldown by the specified value. I just want to clarify that this works.
VERY IMPORTANT:
In Behavior Buff Modifications there is an entry under "Behavior" named RATE MULTIPLIER ARRAY - this is cooldown reduction IN ITSELF. If you modify the value of "Cooldown" in this array to 2 all cooldowns will cool down twice as fast! It doesn't change the number on cooldowns, but it's a small price to save yourself massive trigger work.
Any good way to do that?
We want to have % cooldown reduction as stat on items. 100% cooldown reduction should reduce the cooldown from 20seconds to 10 seconds, as example.
Edit:
VERY IMPORTANT: In Behavior Buff Modifications there is an entry under "Behavior" named RATE MULTIPLIER ARRAY - this is cooldown reduction IN ITSELF. If you modify the value of "Cooldown" in this array to 2 all cooldowns will cool down twice as fast! It doesn't change the number on cooldowns, but it's a small price to save yourself massive trigger work.
uhhh, I would like to point out here that a 100% reduction would take 20 seconds down to 0 seconds. a 100% increase on 10 seconds, would be 20 seconds. With the above ratio, I am not sure it is possible, since 100% of 20 is 20. However, using a system where 100% equals 100% in all situations, it is reasonably doable; so long as each player only controls a single unit with the ability; or all units have the ability changed equally. I speak of course of the "set catalog field value"
Skype: [email protected] Current Project: Custom Hero Arena! US: battlenet:://starcraft/map/1/263274 EU: battlenet:://starcraft/map/2/186418
Assuming I guessed right on what you are looking to achieve, I see no reason you couldn't do a system like this. I assume you would want 200 % reduction to take 20 to 5, and 250 % from 20 to 3.75, right? I did a little thinking of how you could achieve this, and here is what I came up with:
(Please keep in mind this is is pseudo code, for purpose of logic only, I recommend fixed variables)
baseDuration = 20.0;
reduction = 0.0;
x = 50.0;
i = ReductionCombinedAmount (whatever this may be);
while(i > 100)
{
i -= 100; (take 100 away from i)
red += x; (Add to reduction in %)
x \= 2; (Reduce 50 to 25, 25 to 12.5, etc)
}
(reduction would now be at 75.00 for 250 % reduction)
i \= 100; (To take care of any left after dealing 100 % at a time)
i *= x; (X value Should be good to go from the while loop no problem)
reduction += i; (reduction would now be at 81.25 for 250 % reduction)
reduction *= -1; (reduction goes from 81.25 to -81.25 for reducing purposes)
reduction += 100; (reduction goes from -81.25 to 18.75, the actual recast amount we want)
reduction \= 100; (18.75 becomes .1875, to make it a usable percentage)
reduction *= baseDuration; (This makes 20 become 3.75 as desired)
SetCatalog1(blahblah,reduction);(If you need help w/ setcatalog let me know, assuming you know here.)
And there you have it, you now have a reduction percentage of .1875, just multiply whatever your base durations might be by that and it will give you the value you want there. This will work for 1 % reduction to 2000 % reduction or whatever, of course this is assuming you were thinking along these terms of how you want reduction to work. Kind of fun to come up with a solution for that actually, might add it to my own project at some point.
If parts aren't clear, please by all means repost and ask about what doesn't make sense to you, I will do my best to clear it up.
I think I will find a good way to get the numbers the way I want, more interestingly tho, I would like to know how you can actually implement Cooldown Reduction, aka what does the trigger need to do to actually reduce the cooldown and what is a good way to set that up.
Per player there can be multiple units with different amounts of cooldown reduction.
The problem I was worried about was this (Which I encountered while working with attack speed):
Assume a base cast speed of 10.0
I pick up 1 item with 10% increased cast speed (This reduces my current attack speed by 10%) my new cast speed will be 9.00
I pick up 10 items with 1% attack speed, my new attack speed is 9.14
The other problem to be encountered is, if you have a cast time of 10, and remove 10% (picking the easier way above) you have a new cast time of 9.00
If you add 10% back to that, your new cast time will be 9.9; not 10.0
It seems as though zergling has overcome both of these problems (So long as the base cast time for each spell is saved in a variable for reference) Very good mathing and the sorts there zergling.
Ohh, uhhh, I am not sure you can implement a TRUE cooldown reduction then, as catalog field values affect all of a unit type for a player.
Using the same system above, you could manually reset the cooldown for a unit after a timer expires. If you have hundreds of units using abilities though, I fear this would be quite laggy; and the cooldown "count down" would not reflect properly.
Skype: [email protected] Current Project: Custom Hero Arena! US: battlenet:://starcraft/map/1/263274 EU: battlenet:://starcraft/map/2/186418
The maximum amount of units in the field will effectively be probably 6-7 for those that have cooldown reduction.
I was thinking along those lines:
Event -> Unit uses any ability
Variables -> CDR local variable
Actions -> Set variable (math), results in a negative value
Add cooldown to unit ability (Add CDR to unit cooldown, triggering ability on triggering unit.)
The question is - how do I return a triggering cooldown? That value needs to fit the cooldown ID on the ability.
@Scythe1250: Go
It is possible to add a set cooldown if you know the link, and it is possible to clear the cooldown (although not take away 15 seconds, only reduction allowed is total clearing). So a simple take away some cooldown won't work, but I do have another idea.
First, you would need to keep track of the ability used, unit that used it (just use triggering unit and store that as a temp variable), reduction to be done, and of course you'd need a way of getting the cooldown link.
Second, you would need to make an action of sorts to handle this, with option Create Thread checked. Say you wanted to make your 20 second cooldown take only 4 seconds. Well you'd need to call this action with ability used, unit that used, new recast time, and cooldown link, WAIT for 4 seconds, then use the clear the cooldown trigger. This is the only way I'm seeing this realistically happen if multiples of the same unit for the same player are allowed and you want the possibility of different cooldown reductions for each.
Edit: Do NOT use timers or catalogsets if this is what you are aiming for by the way, it'd screw everything up.
What about clearing the cooldown and then adding a reverted percentage? e.g. I have 100% CDR, resulting in 50% less cooldown, when an ability is used, say it has 45 second cooldown, the cooldown is cleared and then 22.5 seconds are added again.
@Scythe1250: Go
Doable, and would make the cooldown look cleaner on the user side, but you'd have to disable that ability somehow while you were doing this, otherwise if it was an instant no target type ability, it would be possible to get a free cast(s) during the trigger delay if you mashed the key real hard or had a macro setup to turbo press it for you. Be unlimited free casts possibly then....
I don't believe so, because before the trigger executes, the ability is on cooldown because of its own cooldown. Then the trigger kicks in, resets the cooldown and instantly adds the new cooldown. There is no way a player-executed command could interfere.
@OP: You can easily make a generalized function, that works for any spell. You can get the triggering ability command, get the ability ID from there, use catalogs to read out the cooldown link and cooldown amount and calculate stuff with it.
It could probably look somewhat like this. Tested and seems to work correctly. However, this would trigger for a ton of abilities, you probably want to implement a whitelist of abilities (or units), rather than excluding everything you don't want to trigger it.
You say you don't think so, then post an example doing exactly what was being said in the last 2 posts? Go home Kueken, you are drunk.
That was a response to your statement about the possible free casts.
I see, thanks for the clarification in the reply and the edited other response, that makes a lot more sense.
Some other maps uses timescale to reduce the cooldown and it works fine but the problem with timescale that it makes the unit move and attack faster = the percentage of the time scale that you gave. but this can be solved by decreasing movement and attack speed by the same amount of the timescale.
another problem with timescale that it dose not change the text ( cooldown number ) on the ability but it makes the time moves faster. Also timescale can make the behavior go faster ( i.e if you have a behavior which creates fire every 10 seconds and you increased time scale by 100% then the fire will be created every 5 seconds )
i saw many maps doing cooldown reduction this way like infested arena for example and i personaly use it too because blizzard didnt give us anyother easy way to do it.
http://www.sc2mapster.com/forums/development/triggers/26931-add-cooldown-to-ability/#posts in the end of 1st page is map that you need
Timescale is not an option. We want to do it properly and timescale messed a lot up, for example unit animations.
Further we have a lot of timescale buffs and debuffs in the game which would interfere multiplicative with the CDR and thus cause big issues.
I will see what method I use, thanks for the help so far - I will most likely come back and ask a few more questions.
I dont think timescale do anything to the animations ......... it did not to me
I can't get this to work, e.g. I dont even know what variable you used for "ability" and I cannot get the 3rd set variable action to what you made.
P.S.: If you provide me the trigger in a map that would be great. It can be made to trigger for every ability, as my current project only has heros and no other units. And every hero will probably have cooldown reduction in some way.
By the way - if you use "add cooldown to unit ability" and enter a negative value it does indeed reduce the cooldown by the specified value. I just want to clarify that this works.
VERY IMPORTANT:
In Behavior Buff Modifications there is an entry under "Behavior" named RATE MULTIPLIER ARRAY - this is cooldown reduction IN ITSELF. If you modify the value of "Cooldown" in this array to 2 all cooldowns will cool down twice as fast! It doesn't change the number on cooldowns, but it's a small price to save yourself massive trigger work.