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

[Solved] Dynamically changing button position to "stack abilities"

Status
Not open for further replies.
Level 5
Joined
Jul 31, 2020
Messages
103
Misleading title, and hi.

I can't think of a short title that actually communicates my question properly.

So, the situation: 4 different spell books. These are the abilities, or rather the arrays of abilities if we're trying hard to be technically correct. They contain the stuff I want, and they should be active during different times, under different circumstances.

The issue: Although I can disable/enable, hide/unhide ability icons, this will not push their button around on the unit. This obviously leads to the problem where 3 of the 4 spell books will never show up since they don't have space.

What I tried: A couple different ways.
  • First I thought maybe if I use one big spell book (I was lucky to be able to fit everything into one from all 4), I would be able to just hide/unhide specific abilities, and call it a day. No, they retain their button position (from what I saw, consistent with the list in the object editor). I don't want, for example, the first 3 slots to be empty, and then have a few buttons starting from after there.
  • I went on to creating 4 spell books instead, and adding only the sets of abilities I want. I tried just hiding/unhiding, hoping it would all fall into place. No, they would just never show up past the initial one, since the rest don't have space. They should occupy the same slot, but they obviously cannot do that, even if hidden.
  • Disabling and hiding, same as the previous situation. Nothing changes.
  • Trying to force out the position change by setting the X and Y. Doesn't work, the slot is technically occupied, so this just fails to do anything.
  • Scripting a bit to move every momentarily unused spell book icon to (0, -11) although I don't know any fresh information on whether this still crashes the game on Mac or not. Still no, nothing changes. I'm unsure whether this even works if one attempts to call BlzSetAbilityPosX/Y(), and do this dynamically during runtime. Anyway, didn't work.
Guess it's time to state the method that does work, but would require an additional system that's quite tedious to make although I would probably be able to do it.
  • Remove the 4 spell book abilities from the hero, and add them back immediately with the one I'm going to be using added first. This means the slot is guaranteed to be empty, and the one I need enabled will be going there. The other 3 get disabled. (Side note here, you might be wondering why do I not just remove the ones I'm not using. Long story short, I need every ability to actively be on the hero. I just don't want to have access to all of them at the same time. It's a requirement, so to speak.)
The obvious issue: Cooldown reset. This method works, but requires a custom cooldown system. I could make one as I said before, but I could also post this thread instead since I tend to work on these things past midnight after being awake for way too long, therefore finding it harder to come up with ideas.

Anyway, is there anything very simple that escapes me during these late hours?
 
Level 5
Joined
Jul 31, 2020
Messages
103
Crisis averted. My past midnight brain wasn't able to come up with the idea of adding 4 levels to a single spell book ability, and adding the different sets of abilities to different levels, then changing the level to the approriate one on demand. It required some additional changes to all the triggers though since this does remove abilities from the hero that aren't currently in the spell book. Extra work, but that's pretty common. I'll shake my own hand.
 
Status
Not open for further replies.
Top