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

[Spell] I want to do MUI DoT spells

Status
Not open for further replies.
Level 8
Joined
Jun 13, 2010
Messages
344
Hello

To begin with I will apologize if this has already been a topic too many times, but I have looked it up on MUI Triggers with Waits and Tutorial - GUI MUI Spell Making Guide which are tutorials for MUI.

I do still have issues with creating MUI DoT as I am not sure if the first tutorial ensures a continues stability and as the tutorial states:

The highest index you could use for an array is
8191.

I just do not know if his ways do reset the value in a proper way, when it is regarding a continues damage over time event.

If you do have any knowledge or a guide I may use for this matter I would greatly appreciate it. I recall once reading a tutorial with the Dark Ranger Life Drain as an example, but I cannot seem to find it atm.

Thanks for stopping by!
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,188
The highest index of an array is not 8,191. It is JASS_MAX_ARRAY_SIZE - 1 which at the time of posting is 32,767. Lua tables have no reasonable limits.

With Lua one can use a coroutines to implement Mui for most ability designs easily by keeping track of all states with locals. Delays such as waiting for an event or a timer to expire can be implemented by suspending the coroutine and having a callback resume it.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,496
@Dr Super Good

Here's something I whipped up in Lua (just started learning). Will this cause problems? Should I use coroutines instead of PolledWait? It seems to work just fine for Mui.

I call the function after a unit casts an ability.
Code:
function TestAbility()
    local u = GetTriggerUnit()
    for i=1,10 do
        PolledWait(1.00)
        local p = GetUnitLoc(u)
        AddSpecialEffectLoc("Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl", p)
        DestroyEffectBJ(GetLastCreatedEffectBJ())
        p = nil
        end
    u = nil
    end
It simply creates a special effect at the position of the caster every second for the next 10 seconds.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,188
Here's something I whipped up in Lua (just started learning). Will this cause problems? Should I use coroutines instead of PolledWait? It seems to work just fine for Mui.
Yes you should use coroutines because PolledWait is actually TriggerSleepAction which is a network synchronized approximately real time delay with a timer to prevent it deviating too much from game time. With coroutines you can make a proper game time wait which will wait the specified amount of game time.
 
Level 8
Joined
Jun 13, 2010
Messages
344

Thanks! This was the tutorial I was looking for. If I want to alter the damage done over time for the specific instance (which are affected by ability level, spell damage, enemy magic resistance ect), I will have to account for more array integers for those and set the damage for the instance, before dealing it?

Edit:
I do have another issue though. How do I make this system if I have multiple units EACH dealing damage over time to MULTIPLE enemies, which are not necessarily the same?
Will I have to make array unit groups for the instance?


The highest index of an array is not 8,191. It is JASS_MAX_ARRAY_SIZE - 1 which at the time of posting is 32,767. Lua tables have no reasonable limits.

I think I get it, without fully understanding though. I guess by allocating the index for the MUI, as the tutorial states, I suppose I have what I need to know. I do not know what Lua or hashtables are. Never used it and I never figured out how to create one to be honest.
 
Last edited:
Thanks! This was the tutorial I was looking for. If I want to alter the damage done over time for the specific instance (which are affected by ability level, spell damage, enemy magic resistance ect), I will have to account for more array integers for those and set the damage for the instance, before dealing it?
create new array variables and write the data needed at SL_Index. You also need to reindex variables you added. Reading is done using index SL_Loop_Integer in the tutorial.

I do have another issue though. How do I make this system if I have multiple units EACH dealing damage over time to MULTIPLE enemies, which are not necessarily the same?
Will I have to make array unit groups for the instance?
The triggers in the tutorial should work for any amount of casters, targets and casts.
 
Status
Not open for further replies.
Top