• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • 💡 We're thrilled to announce that our upcoming texturing contest is in the works, and we're eager to hear your suggestions! Please take this opportunity to share your ideas in this theme discussion thread for the Texturing Contest #34!
  • 🏆 Hive's 7th HD Modeling Contest: Icecrown Creature is now open! The frozen wastes of Icecrown are home to some of Azeroth’s most terrifying and resilient creatures. For this contest, your challenge is to design and model a HD 3D monster that embodies the cold, undead, and sinister essence of Icecrown! 📅 Submissions close on April 13, 2025. Don't miss this opportunity to let your creativity shine! Enter now and show us your frozen masterpiece! 🔗 Click here to enter!

Need some help with spell charges

Status
Not open for further replies.
Level 4
Joined
May 12, 2022
Messages
22
Hi, I have made a trigger for a reveal that has 3 charges. After I have used the spell for the first time, the cooldown is supposed to start and load the charge back.

For each charge used, the icon of the spell is supposed to change to an icon that has 1 less charge (as shown in the picture bellow).

1663188543347.png

Now .. the trigger seemed to be working after some tests..

But after I implemented the trigger in a map and played with some people, I then came across a problem.
It looks like after any of the players uses a charge at any given time, the trigger then interferes with every other player that has the same spell. It either resets the cooldown for all other players or it doesn't let you cast it after you use the first charge. I don't know if it's simply because other players also have the same spell or if it's because they use it before the charge finishes charging and it somehow messes it up.

From my understanding, you can fix this by using hashtables but I'm not very knowledgeable with these kind of triggers..

I'll attach a simple map with the trigger so you can see what i'm talking about.
If someone could take a look at the triggers I used for this spell and help me out if possible, that would be awesome.

Thanks in advance!
 

Attachments

  • Charges_Spell.w3x
    90.5 KB · Views: 12

Uncle

Warcraft Moderator
Level 72
Joined
Aug 10, 2018
Messages
7,761
It's not MUI because you're sharing the same variables/timer with everyone. That's the very nature of Global variables, as opposed to Local variables which would be unique to each trigger instance. Unfortunately, local variables aren't really the solution here either nor are they readily available in GUI (the standard trigger editor).

Luckily, there are other ways of going about this (and yes, a Hashtable could be one solution). I updated your map using a method which takes advantage of a Unit Indexer, a very powerful and easy to use system for storing Data to units. This in combination with a Periodic trigger and a Unit Group allows us to track each hero's Sight Charges and manages their Abilities.

Also, I noticed that the True Sight ability had strange behavior like causing the Hero to ignore Move orders. I went ahead and fixed this by creating separate versions of the ability. So the Hero casts a "fake" ability which then tells a Dummy unit to cast the real True Sight ability.

Warning! The Unit Indexer has 2 important rules:
1) You cannot have multiple Unit Indexers in the same map. One is all you'll ever need.
2) You cannot Set Custom Value yourself - The system relies on setting Custom Value in order to work. The fix to this is simple, replace those Custom Value actions with an Integer Array. A tutorial can be found here. The whole point of a Unit Indexer is to mimic the behavior as well as remove the limitation of Custom Value.
 

Attachments

  • Charges_Spell.w3x
    98 KB · Views: 9
Last edited:
Status
Not open for further replies.
Top