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

[Trigger] MUI Index that holds a dynamic number of values (Resolved)

Status
Not open for further replies.
Reference Page: Visualize: Dynamic Indexing

I am currently using the above dynamic indexing; but attempted to expand it further - allowing each index to track subitems.

Imagine that each index held an "Ongoing Occurrence" and that these occurrences were able to host between 1 and 5 special effects.

Upon resolution of an occurrence all the special effects it was hosting would be resolved and destroyed.

I had made a variable to track what range of special effects should be getting targeted for any given point in the MUI's iteration.

It was written like this:
Occurrence A: (3 FX)
Occurence B: (1 FX)
Occurrence C: (5 FX)

As the MUI function iterated it would set the range of special effects to target equal to the total sum of all occurrences that have already iterated in this run.

(For example, on Index 3. SpecialEffectToStartOn would be equal to 3 + 1, since those 2 occurences already happened. So it would properly look at 5-9 for Occurence C.

HOWEVER; after looking back at this tutorial I remembered that when Occurrence A resolves, it's position will actually be taken by Occurrence C (the last one in the index).

So my SpecialEffectToStartOn variable gets it's position lost since it is no longer a linear iteration in terms of C now being before B.

Query:

Does anyone know how to resolve this? Preferrably without a hashtable, with which I have no experience.


TLDR: Can you make an MUI array where a single index tracks a dynamic amount of values and have it iterate properly?
 
Last edited:
I believe I just noticed why this won't work. It can't actually deindex properly because Occurrence C uses 5 slots and is being put in the place of Occurrence A which only has 3 slots..., to keep it dynamic I would have to move all indexes later in the queue a number of positions in order for Occurrence C to fit, and at that point it isn't efficient. Looks like I'll probably just go back to having set number of slots for each Occurrence regardless of how many slots it actually uses.
 
Level 25
Joined
Sep 26, 2009
Messages
2,381
If you need it like that, you could use a hashtable for the special effects.
Use Unit array which you iterate through and each unit would save an integer representing how many special effects it uses... for example under key 'maxeffects' in the hashtable. The effects themselves would be stored under parent key = handle Id of unit and child key = index keys 1, 2, 3, 4 or 5 in the same hashtable.
So to delete them, you iterate from 1 to maxeffects, load effect with key == current iteration number and delete it.

Question is if the overhead is worth it.
 
Status
Not open for further replies.
Top