• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Need Help with Diminishing Return (CC) System!

Status
Not open for further replies.
Level 6
Joined
Aug 31, 2018
Messages
157
Hello everyone, i want to balance the CC in my game to be the same like in WoW, means: If same ability is used 3 times in a row, and it has 10 sec duration, the system gonna turn it to 10+5+2.5 sec instead 10+10+10

Example: A rogue sapping u 3 times, each time the duration drops with 50%

Can someone please help me to make this system or at least tell me how to make it? I am not very good at making Triggers ^^

-Thanks!
 

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,457
Is the CC system designed around specific ability usage? Such as your Sap example, meaning Sap could have 1/4 of it's base duration but some other CC ability that you haven't used yet would work at 100% effectiveness?

OR does a unit have a "CC Resistance" stat that determines how long CC effects last on it. This stat changes as a unit gets hit by CC, and eventually resets back to normal.

The 2nd option is a lot easier to make since it's more general. A unit casts CC on a target, the targets CC Resistance gets divided by 2, the duration of the CC ability gets reduced based on this CC Resistance.

Here's an example of the 2nd option using a Unit Indexer. I don't have the Editor open so I'm just writing the names of things from memory:
  • Events:
  • A unit starts the effect of an ability
  • Conditions:
  • Ability being cast equal to Slow
  • Actions:
  • Custom script: local integer i = GetUnitUserData(GetSpellTargetUnit())
  • Set CV = Custom value of target unit of ability being cast
  • Set CC_Resistance[CV] = CC_Resistance[CV] / 2.0
  • Set N_Duration = Get Ability being cast Normal Duration --- (GetAbilityRealLevelField)
  • Set H_Duration = Get Ability being cast Hero Duration --- (GetAbilityRealLevelField)
  • Set Ability being cast Normal Duration equal to N_Duration*CC_Resistance[CV] --- (SetAbilityRealLevelField)
  • Set Ability being cast Hero Duration equal to N_Duration*CC_Resistance[CV] --- (SetAbilityRealLevelField)
  • Wait 5.00 seconds
  • Custom script: set udg_CV = i
  • Set CC_Resistance[CV] = CC_Resistance[CV] * 2.0
  • Custom script: set i = null
CC_Resistance has a default value of 2.0

Note that this would reduce the first cast duration by half, since the CC Resistance gets updated immediately. That's why I set the CC_Resistance to 2.0 by default, this way the first cast of CC divides it by 2.00 resulting in 1.00 resistance, and the Duration is then multiplied by 1.00 causing no changes to the duration. If I didn't do this then the first cast would get reduced by half.

How the CC Resistance changes:
1st cast -> CC Resistance: 2.00 / 2.00 = 1.00 -> CC lasts (X * 1.00) seconds
2nd cast -> CC Resistance: 1.00 / 2.00 = 0.50 -> CC lasts (X * 0.50) seconds
3rd cast -> CC Resistance: 0.50 / 2.00 = 0.25 -> CC lasts (X * 0.25) seconds
etc...

The 5.00 second Wait happens after each cast of CC, and undos a single casts worth of division. So basically, the CC Resistance gets divided by 2, then 5 seconds later it gets mulitplied by 2 (resetting back to where it was).
 
Last edited:
Level 6
Joined
Aug 31, 2018
Messages
157
Is the CC system designed around specific ability usage? Such as your Sap example, meaning Sap could have 1/4 of it's base duration but some other CC ability that you haven't used yet would work at 100% effectiveness?

OR does a unit have a "CC Resistance" stat that determines how long CC effects last on it. This stat changes as a unit gets hit by CC, and eventually resets back to normal.

The 2nd option is a lot easier to make since it's more general. A unit casts CC on a target, the targets CC Resistance gets divided by 2, the duration of the CC ability gets reduced based on this CC Resistance.

Here's an example of the 2nd option using a Unit Indexer. I don't have the Editor open so I'm just writing the names of things from memory:
  • Events:
  • A unit starts the effect of an ability
  • Conditions:
  • Ability being cast equal to Slow
  • Actions:
  • Custom script: local integer i = GetUnitUserData(GetSpellTargetUnit())
  • Set CV = Custom value of target unit of ability being cast
  • Set CC_Resistance[CV] = CC_Resistance[CV] / 2.0
  • Set N_Duration = Get Ability being cast Normal Duration (GetAbilityRealLevelField)
  • Set H_Duration = Get Ability being cast Hero Duration (GetAbilityRealLevelField)
  • Set Ability being cast Normal Duration equal to N_Duration*CC_Resistance[CV] (SetAbilityRealLevelField)
  • Set Ability being cast Hero Duration equal to N_Duration*CC_Resistance[CV] (SetAbilityRealLevelField)
  • Wait 5.00 seconds
  • Custom script: set udg_CV = i
  • Set CC_Resistance[CV] = CC_Resistance[CV] * 2.0
  • Custom script: set i = null
CC_Resistance has a default value of 1.0

Note that this would reduce the first cast duration by half, since the CC Resistance gets updated immediately.

So if Slow's duration is 10.00 seconds:
First cast = 10.00/2.00 -> 5.00
Second cast = 5.00/2.00 = 2.50
Third cast = 2.50/2.00 = 1.25
etc...

The 5.00 second Wait happens after each cast of CC, and undos a "stack" of reduction.
Thank you a lot for giving ur time to answer and help! But sadly we need the DR system like in WoW. Means the CC reduction gonna work only for same type abilities. Like using Sap 3 times will not affect other abilities like sheep and etc. Sadly we cannot use the CC reduction, because there are like 40 cc abilities, some of them are 1-2 sec, some are 10 sec, thats why we cant use it, i know that it gonna take some time to make it work for each specific ability, but if i get the triggers for 1 ability, i can just coppy it and replace the effects/abilities?
 

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,457
What are same-type abilities? Like categories of abilities?

For example:

Category A = Sap/Stun/Daze
Category B = Slow/Disarm

And then you basically use my system above but have separate CC_Resistance variables for each category type.

CC_Resistance_A = unit's resistance to Category A abilities
CC_Resistance_B = unit's resistance to Category B abilities

Something like that?
 
Last edited:
Level 6
Joined
Aug 31, 2018
Messages
157
What are same-type abilities? Like categories of abilities?

For example:

Category A = Sap/Stun/Daze
Category B = Slow/Disarm

And then you basically use my system above but have separate CC_Resistance variables for each category type.

CC_Resistance_A = unit's resistance to Category A abilities
CC_Resistance_B = unit's resistance to Category B abilities

Something like that?
I think that gonna work, the map is the popular map WoW Arena and there are all of the classes from WoW, means we have Charge, Storm Bolt, tons of fears, sapping, sheeping, sleeping, freazing and etc.

P.S About the same type abilities, i meaned like 3 times sap, 3 times sheep and basicly every ability used more than once in the last few seconds. So they dont stack, otherwise people can stun u for 40 sec with sap and sheep, recasting them.
 

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,457
Ah, so instead of categories it would be individual abilities:

CC_Resistance_Sap
CC_Resistance_Fear
CC_Resistance_Sheep

etc...

So you'd need 1 variable for each ability.

That being said, a Hashtable is probably the best option here since you can use the abilities id as the Key. That would require only 1 Variable, the Hashtable and nothing else.

Note that my described system is only possible on version 1.31+ since you'd be using the Set/Get Ability fields.
 
Last edited:
Status
Not open for further replies.
Top