How do I create a non-stackable but MUI healing over time spell?

Marsmallos

Member
Reaction score
17
Hello!
I want to trigger a spell that acts in a way identical to rejuvination.
It would be something like this:

Trigger:
  • Events
    • A unit starts the effect of an bility
    • Conditions
      • (Ability being cast) equal to RejuvinationTargettingSpell
    • Actions
      • custom script: local unit udg_RejuvinationTarget
      • set RejuvinationTarget = Target unit of ability being cast
      • For each integer A from 1 to 7, do actions
        • loop - actions
          • Unit - set life of RejuvinationTarget to (Life of RejuvinationTarget + 20)
          • wait 1,00 seconds
      • custom script: set udg_RejuvinationTarget = null


This makes my spell MUI, but, unfortunately it is stackable this way (as far as I can see) and I dont want that. If I cast rejuvination on the same target again before an earlier rejuvination has expired, I want the new rejuvination to overwrite the old rejuvination.
However, as far as I can see like the trigger is now, the two rejuvinations will simply stack on top of each other, thus naturally healing a double amount of what a single rejuvination would do, and I absolutely do not want that.

In short, this is how the spell should work:

It is a healing over time effect, meaning that it will heal a certain amount every x seconds for z seconds
It must be MUI
It must not be possible to stack on the same target but
Recasting it on the same target must refresh the duration of the healing over time effect
It must be triggered, using existing spells is not an option

What do I need to add/change in my trigger to make my rejuvination MUI but non-stackable on the same unit? (Keep in mind that several units might be on the battlefield casting rejuvination at the same time on the same/different targets)

Rep will of course be rewarded
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
i dont get why you just dont use an ability to heal the targeted unit...

copy the ability of regeneration fountain and change its data to heal 20 hitpoints per second (be sure to uncheck "Data - Percentage") and give it 7 levels all with same data.
now create those 2 triggers:
Code:
AddAbility
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to HealOverTime
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Level of CustomRegenerationAuraSpell for (Target unit of ability being cast)) Equal to 0
            Then - Actions
                Unit - Add CustomRegenerationAuraSpell  to (Target unit of ability being cast)
            Else - Actions
                Unit - Set level of CustomRegenerationAuraSpell  for (Target unit of ability being cast) to 1
and
Code:
RemoveAbility
    Events
        Time - Every 1.00 seconds of game time
    Conditions
    Actions
        Set TempGroup = (Units in (Playable map area)((Level of CustomRegenerationAuraSpell   for (Matching unit)) Not equal to 0))
        Unit Group - Pick every unit in TempGroup and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Level of CustomRegenerationAuraSpell   for (Picked unit)) Equal to 7
                    Then - Actions
                        Unit - Remove CustomRegenerationAuraSpell   from (Picked unit)
                    Else - Actions
                        Unit - Increase level of CustomRegenerationAuraSpell   for (Picked unit)
        Custom script: call DestroyGroup (udg_TempGroup)
the 7 levels of the CustomRegenerationAuraSpell are the timer. each second the level of the spell gets increased, if it reaches level 7 it will vanish and stop healing your unit.
 

Marsmallos

Member
Reaction score
17
i dont get why you just dont use an ability to heal the targeted unit...

because I am going to trigger this action

Trigger:
  • Unit - set life of RejuvinationTarget to (Life of RejuvinationTarget + 20)


in a more advanced way in the finished version, the amount healed is going to be dependant on a number of variables (spellpower items equipped, number of players in the map, difficulty selected, etc) that can vary the amount healed between many different numbers.

EDIT: saw your updated post, and that was a pretty cool solution ;) however, see above
 

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
Does your trigger even work because your nulling it but not seting the variable again
 

Marsmallos

Member
Reaction score
17
Does your trigger even work because your nulling it but not seting the variable again

This is a copy of a trigger I was given on these very forums a couple of months ago (but with other variables, of course), and yes it works
 

DiFm

New Member
Reaction score
35
well you could still make it with an ability. MAke 200 levels and increase healed value every level and then just set the level of the amount it should heal. then you made the spell MUI.
 

vypur85

Hibernate
Reaction score
803
Code:
Rejuvenate
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Rejuvenate
    Actions
        Custom script:  local unit udg_Unit 
        Custom script:  local integer i = 0
        Set Unit = (Target unit of ability being cast)
        Custom script:  loop
        Custom script:  exitwhen i == 10 <-- [I]Adjust this to change how many times it loops[/I]
        Custom script:  set i = i + 1
        Set Unit = Unit2 <-- [I]Just set the local unit to another global unit[/I]
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
             [B]Unit2[/B] is in SomeUnitGroup Equal to False
          Then - Actions
             Unit - Set life of [B]Unit2[/B] to (Life of [B]Unit2[/B] + 20)
             Unit group - Add [B]Unit2[/B] to SomeUnitGroup
          Else - Actions
        Wait 1.00 seconds
        Unit group - Remove [B]Unit[/B] from SomeUnitGroup
        Custom script:  endloop
        Custom script:  set udg_Unit = null

You can try the above. Not sure if it may work. May bug. Not tested. The bolded stuffs are important. Make sure you globalise the local variable (because locals don't work in GUI condition function).
 

Marsmallos

Member
Reaction score
17
well you could still make it with an ability. MAke 200 levels and increase healed value every level and then just set the level of the amount it should heal. then you made the spell MUI.

However, then I only got one healing over time spell, and I need like 7 different ones castable on the same target (meaning that the same spell must NOT be stackable, but different spells that just happen to work in the same way must BE stackable)


Code:
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          If - Conditions
             Unit2 is in SomeUnitGroup Equal to False
          Then - Actions
             Unit - Set life of Unit2 to (Life of Unit2 + 20)
             Unit group - Add Unit2 to SomeUnitGroup
          Else - Actions
        Wait 1.00 seconds
        Unit group - Remove Unit from SomeUnitGroup
not sure what the if/then/else and adding/removing the unit to a unit group is supposed to do

However I'll try your trigger as soon as I come home, I'll probably make five different accounts and +rep you if this works!
 

Marsmallos

Member
Reaction score
17
Hello again! I invented my own solution, and it seems to be working, but I am not sure if it was the ideal solution. Do you think there isa better way of doing this?
Trigger:
  • Hero Druid Regrowth Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to (Druid) Regrowth
    • Actions
      • Set HDRUID_RegrowthTarget[(((Player number of (Owner of (Casting unit))) x 10) + (Player number of (Owner of (Target unit of ability being cast))))] = (Target unit of ability being cast)
      • Set HDRUID_RegrowthTicks[(((Player number of (Owner of (Casting unit))) x 10) + (Player number of (Owner of (Target unit of ability being cast))))] = 0


Trigger:
  • Hero Druid Reqrowth Heal
    • Events
      • Time - Every 3.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 11 to 101, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • HDRUID_RegrowthTicks[(Integer A)] Less than 7
            • Then - Actions
              • Set HDRUID_RegrowthTicks[(Integer A)] = (HDRUID_RegrowthTicks[(Integer A)] + 1)
              • Unit - Set life of HDRUID_RegrowthTarget[(Integer A)] to ((Life of HDRUID_RegrowthTarget[(Integer A)]) + 35)
            • Else - Actions


Especially setting each of the
Trigger:
  • Set HDRUID_RegrowthTarget[(((Player number of (Owner of (Casting unit))) x 10) + (Player number of (Owner of (Target unit of ability being cast))))] = (Target unit of ability being cast)

variables will be a daunting task since I will have several healing over time spells. Does anyone know a way to speed up this task by the way?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top