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

MUI Spell Issue (I guess?)

Status
Not open for further replies.

SpasMaster

Hosted Project: SC
Level 23
Joined
Jan 29, 2010
Messages
1,969
Hello, Hive!
So I am working on a new spell for my map, but I dunno how to make one element of it. Here is what the spell should end up as:

latest
Prayer of Mending: Grants Prayer of Mending which lasts for 10 seconds and restores 0,5% of the target's maximum health every time it takes damage. This healing can occur 40 times before the buff gets exhausted. If the buff gets exhausted in that manner, another nearby allied unit will recieve Prayer of Mending. The affected unit will also gain 20% attack damage and 10% movement speed while the buff lasts.
Ok, so I was planning to use an Integer Variable called PrayerCount which counts each healing occurance and upon reaching 40 - removes the buff. However, I am aware that if 2 units have the buff at the same time, they will both increase the same integer variable. I guess the spell won't be MUI. Any ideas on how to fix that?
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
Alternatively, you could use Hashtable. Use unit's ID a a parent key, then something for child key (it could even be a string "Prayer" or soemething) and save as integer the number of occurrences (or better yet, save the number of occurrences LEFT for that unit, because integer's default value is 0).
 

SpasMaster

Hosted Project: SC
Level 23
Joined
Jan 29, 2010
Messages
1,969
Do you have a Damage Detection (LFH, Bribe, Nes, etc) in your map?
You can use that, along with Inner Fire as buff and a counter (along with an index or using a Unit Indexer) and some booleans to manipulate the buff.

I am using Weep's damage detection.

Alternatively, you could use Hashtable. Use unit's ID a a parent key, then something for child key (it could even be a string "Prayer" or soemething) and save as integer the number of occurrences (or better yet, save the number of occurrences LEFT for that unit, because integer's default value is 0).
Good luck adding 20% attack damage, it's not worth the effort.
Otherwise I guess it's an kinda easy spell. Use hashtables and a DDS and this is a nobrainer :D

The damage bonus comes from the ability itself and I never mentioned the 20% damage part was an issue. I am suing negative Cripple :)
What is giving me a hard time is the "This healing can occur 40 times before the buff gets exhausted" part. If two or more units have the buff, they would both decrease the same Integer variable.
You both suggest using hashtables, but I've never learned how to use them, so I'd be glad if you demonstrate how to make that work. :)
 
And is the Indexer worth it? :p Would you suggest any unit indexer for me to use? I'll also have to figure out how it works, so I can make my spell ^^
Well, if you're in pause 8190 units limitation, pretty much you're safe.
Also, Unit Indexer is much easier compared to Hashtables, at least for me. And yet, this varies from person to person.
In other hand, Unit Indexer can serve as one global Hashtable (thus eliminates most of Hashtables needs). There are some restrictions on Unit Indexer that can be handled through Hashtables (or perhaps it's on my end), but your case is one that can be done in Unit Indexer boundaries if memory serves well.

EDIT :
Also, I just remember at least in my memories, Unit Indexer and indexing technique doesn't go along well, and tend to rely on Group Enumeration.

If this is true then every single spell that I have ever created is invalid xD
Not truly correct on all cases (it's still worth to use Hashtables, as if I recall group enumeration in GUI is slow, and Unit Indexer relies on it, at least in GUI cases for me, and Unit Indexer has it's weaknesses), but it's better to conserve the 256 Hashtables limit to systems (at least from my perspective). And Hashtables has it's own benefits, such as deallocation if I recall.
And for Spell Section, it's possible that your Hashtable is used to handle 2 or more different spells in actual map (eg : 2 similar spells with different values, but passes through the same Hashtables), despite used only for one spell (modified on user end manually, who knows? :p)
The main case here is that the spell works properly, and if there's not much unit using this kind of ability, shouldn't be a big issue.
 
Status
Not open for further replies.
Top