• 🏆 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!

Custom Cooldown (For Hero Units only)

Status
Not open for further replies.
Level 10
Joined
Apr 9, 2004
Messages
502
This was previously coined over a year ago and after much toiling I have a proof of concept for a multi cooldown system that seems to work beyond the limits that were first set on it.

I know leandrotp said he was working on a system but I hadn't seen any motion.

A few things to note based on his comments below:

Hmm. Implementing charges would be easier to do. I guess I'm going to start with that.

This system, just like all present alternatives, requires big amounts of object data (which will be automatically generated with Lua). The only thing the user will have to do is to create 1 ability based on Engineering Upgrade for every ability that he wants to have a counter.

This ability is the key to create the number in the icon. It must have the same id of the main ability with the first letter changed to "C" (eg. 'C000'). When you want to create a counter, the system will try to add the corresponding ability to the unit. If this ability is there, the counter will be created, if it does not exist, nothing happens.

Nothing else needs to be modified in the map. You will just need to call a function and a number will appear in the bottom-right corner of the icon. The numbers are created by the game itself, it does not use imported icons. And it will not replace the ability with a dummy, the number will appear in the real icon of the ability.

However, not everything is roses. This implementation has some restrictions:

  • Not every ability can have a counter. Only 5 abilities in the game can have counters: Channel, Spellbook, Charge Gold and Lumber, Sentinel and Flare. And you can only have 2 of them in a unit simultaneously. (This restriction will not apply to my future cooldown system, as it will replace the real ability with a dummy)

  • Because Engineering Upgrade is used, it can only be used on heroes. ([thread=270930]HeroicUnit[/thread] has the potential to remove this restriction, but it's not perfect yet)

As I said this system uses a bunch of hacks to acomplish it's job. The basic principle is how the Command UI works: if two abilities in a unit have the same rawcode and the same order id, their buttons will collapse and become only one. Since order id can't be dynamically modified, we are restricted to the 5 abilities I mentioned. Engineering upgrade is then used to change the rawcode of the ability at runtime.

When the buttons collapse, the numbers present in the Sentinel and Flare abilities can be transferred to other abilities like Channel or Spellbook, if you set their order ids to "sentinel" or "flare". Obviously it requires 1 ability for every number that we want to display, but this doesn't affect performance, and those abilities are automatically generated.

There's still a lot of work to do. The concept is already demonstrated, but it's not easy to make this system completely MUI and bug-free. I will be beginning the development in the following days, any suggestion is highly appreciated. If you have any doubts feel free to ask me as well.

Quick note I've tried the system with thunderclap as a dummy ability and it worked just as well as any other ability. I also don't know about only having 2 of them simultaneously as my testmap shows 4 channel based abilities all running on 1 unit so either i misunderstood or my modifications overcomes these limitations.

As it stands my test map shows that I can use more than 2 channel based abilities on a unit and it seems to work just fine.

I basically replicated leandrotp's code 4 times redefining the triggers so they were all unique instances and making the necessary modifications to replica abilities required to ensure each cooldown worked independently and did not cause errors with any other cooldown.

The testmap shows proof of concept on multiple abilities for up to 10 seconds at the moment but the plan is to allow up to 360 seconds (6mins) max cooldown time on up to 6 abilities on heroes only.

Notice that I'm only using flare and channel, and that I did not need to reference using sentinel or any of the other abilities he referenced.

My guess is that the ability modifications I made might require more upfront base abilities to work but it gets rid of those limitations that his setup had (assuming i'm not misunderstanding the explanation of those limitations)

I'm working on the code to make this MUI and for the most part it's really quite easy to explain how this works:

I have the following list of abilities that all work together:

Bulk of the system:

-360 flare dummy abilities all with 1-360 charges

-1 dummy flare ability, no charges
(used to link display to a unique orb of slow ability)

-6 unique orb of slow dummy abilities with the dummy flare as the equipped ability
(these will eventually "contain" and show the real ability with cooldown number listed which is a pretty nice looking cooldown effect)

-6x36 dummy spell books used to stack spells in segments of 10 counts (flare abilities), for each array from 1-10s, 11-20s etc. up to 351-360s for each of the 6 cooldowns instances

(used because the actual refresh triggers only need to run every 10 counts per unit so less overlap as all that goes on in the meantime is im removing 1 ability when i tic down 1s.

6 unknown base abilities which are used to link real abilities, and dummy abilities together (i tried using only 1 but this causes issues when more than 1 ability is on cooldown)

36 dummy abilities which convert all numbers into the unknown base ability

(uses the reverse engineering hack to transform the cooresponding number abilities in the current spellbook to the specific base ability being used for the cooldown instance)

For each real ability you use:

1 dummy ability that convert the real ability to the unknown base ability as well as convert a secondary dummy ability back into this ability
1 dummy ability used for actual casting and cooldown effect

[Update 2017-03-16]

Did find an issue which caused the dummy caster ability to always revert to level 1. To circumvent this I worked in an extra level which simply displays "on cooldown" with modified text. This was the quickest and cleanest fix and the issue definately outlines a flaw with the system.

Finished all of the polishing work on the system (i.e. added lua to generate base real abilities and corresponding dummy abilities, updated triggers to control real and dummy caster linked abilities) overall this feels like you could stick it in a map and start working with it. Ready to test and optimize. Will have a full breakdown here within a few days. In the meantime, feel free to look at the map code and comment on anything you find.

[Update 2017-03-15]

Managed to get the system running with proper UI, still haven't generated the LUA to easily make abilities nor have I coded adding the dummy casting ability upon learning the real hero ability.

For now I'm showing how the dummy casting abilities run the system.

A few notes:
-Lag spike in loading, I preloaded the abilities onto existing units (right now all units are heroes but will need a hero filter)
-Adding a new unit has a bit of a delay but not too bad.

I'd like people to try out the system and let me know what you think, if it seems at all feasible or useful or if it's too much of a drain on performance for this one effect.
 

Attachments

  • Cooldown - BETA v0.1.w3x
    96.8 KB · Views: 75
Last edited:
Level 10
Joined
Apr 9, 2004
Messages
502
wait what? 700*smh what does that mean?

Is it an issue to have this many abilities? I was under the assumption this was doable...I asked about memory use and performance when doing stuff like this and no one said anything about any issues. all the levels are less than 4 levels per ability, most just use 1 level at all. I could shrink down the skills that are used to combine multiple spells into 1 base unknown into 1 ability with enough levels to deal with it.

Just running the numbers, for a typical AoS with max 30 heroes to choose from that's 2065 abilities, 180 of which are not dummy abilities...

In this case, what's the main issue here, the number of abilities? What limit would be more acceptable?

There's a very easy and slightly uglier approach which is to simply generate 2 dummy abilities per real ability to refresh said ability by swapping it with a copy that has a 0 cooldown and swapping back. I haven't tested the option but it would be fairly easy to implement.

Perhaps if leandrotp looked at this he might be able to figure out a way i can increase the efficiency of the system, perhaps his origional setup was already the most efficient hence some of the limitations imposed on it? His code is the base after all, it might simply require more intermediate operations (i.e. certain abilities have to be added and removed in a certain order not to overlap).

I mean 360 abilities are just used to get the number display effect I can run the refresh operation every second (so now that whole chunk of code to generate the first cooldown effect would fire for every ability every second instead of just removing an ability to change the countdown) and that saves using the spellbook for the countdown numbers which is 216. If I limit abilities to 1 cd slot always then there

In any case, let me know if this would still be feasible and of benefit to anyone or if it's a lost cause.

I'm going to try and play around with the abilities to see if I can increase some quantities to have a much larger overall decrease to others (i.e. i may be able to reduce the number of extra abilities per real ability to 0 if my test works out....)

unfortunately my understanding of this method only skims the surface so it's more trial and error than actually understanding what's happening right now.
 
Last edited:
Level 39
Joined
Feb 27, 2007
Messages
4,989
I fail to see why you would need or want a system like this any more now that we have the ability to modify ability fields at runtime. Any custom cooldown text can be baked into the text of the ability itself and updated as desired, or you could updated the icon path field (if that works, honestly not sure if it does). Abilities can now be put on cooldown with an arbitrary cooldown duration of your choosing whenever needed as well.
 
I fail to see why you would need or want a system like this any more now that we have the ability to modify ability fields at runtime. Any custom cooldown text can be baked into the text of the ability itself and updated as desired, or you could updated the icon path field (if that works, honestly not sure if it does). Abilities can now be put on cooldown with an arbitrary cooldown duration of your choosing whenever needed as well.
Hivecraft community edition isn't out yet, but no worries I have other ways of obtaining this effect without needing reforged. Just wanted to mention in case anyone else considered using this method too that it doesn't work if your map is going to be playable in reforged and legacy.
 
Status
Not open for further replies.
Top