• 🏆 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] Auto "random" AOE Heal

Status
Not open for further replies.
Level 4
Joined
Oct 5, 2012
Messages
52
Good evening (it's evening in my country :p)

I wanted to make the ability that works like this:

When casted it will add 50 HP to a random unit in a 300 AOE every 1 seconds for 5 seconds.
It should heal 1,5 (rounded) units per level of the ability.

That means:

On level 1 it heals 2 units per second for 5 seconds.
On level 2 it heals 3 units per second for 5 seconds.
On level 3 it heals 5 units per second for 5 seconds.
On level 4 it heals 6 units per second for 5 seconds.

And so on.

I really tried my best but the trigger i made doesn't work AT ALL.:thumbs_down:

Hope you can help me :)!
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
Do you want to pick random units and then heal that unit for 5 seconds? or do you want each second/each tick to heal random units?

<Also, I don't think this belongs here; this section is for when your triggers are not working and you need help fixing them, not to ask other people to make spell for you>
 
Level 4
Joined
Oct 5, 2012
Messages
52
Do you want to pick random units and then heal that unit for 5 seconds? or do you want each second/each tick to heal random units?
Each second/each tick a random unit should be healed by 50.

<Also, I don't think this belongs here; this section is for when your triggers are not working and you need help fixing them, not to ask other people to make spell for you>
Thanks for the advise, but as I said, i allready tried to make this spell but it just didn't work. I don't need the whole spell just a few hints how it would be triggered would be enough.

I could publish the trigger I made right now, if that's needed.
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
<Also, I don't think this belongs here; this section is for when your triggers are not working and you need help fixing them, not to ask other people to make spell for you>

this does belong in here since he is asking how to do it.

I could publish the trigger I made right now, if that's needed.

this would help it is a simple spell tho

edit: here ya go
you have to change the no unit to the unit u want.
  • Untitled Trigger 001
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set tempPoint = (Position of urUnit)
      • Set tempGroup = (Units within 512.00 of tempPoint matching (((Matching unit) is alive) Equal to True))
      • For each (Integer tempInt) from 1 to 2, do (Actions)
        • Loop - Actions
          • Set tempUnit = (Random unit from tempGroup)
          • Unit - Set life of tempUnit to ((Life of tempUnit) + 1.00)
          • Set tempUnit = No unit
      • Custom script: call DestroyGroup( udg_tempGroup)
      • Custom script: set udg_tempGroup = null
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
this does belong in here since he is asking how to do it.
Well, I partially disagree :D
"In this forum you may ask for help on fixing a trigger or script. But if you need help getting started with a trigger, this is not the right place"
but he wrote that he did try to trigger this spell but failed and asked people to do it, and he didn't provide the trigger to fix it :)
But no matter.

----
Anyway, the only problem I had when I tried to create the ability myself is calculating number of units.

As he wrote in his original post, he wants it to affect units in this fashion:
[ability level] * 1,5 = amount of affected units (round up the number if it's not an integer)
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
Well, I partially disagree :D
"In this forum you may ask for help on fixing a trigger or script. But if you need help getting started with a trigger, this is not the right place"
but he wrote that he did try to trigger this spell but failed and asked people to do it, and he didn't provide the trigger to fix it :)
But no matter.

----
Anyway, the only problem I had when I tried to create the ability myself is calculating number of units.

As he wrote in his original post, he wants it to affect units in this fashion:
[ability level] * 1,5 = amount of affected units (round up the number if it's not an integer)

oops i didnt notice this was triggers and scripts lol i thought it was in world editor so ur right. as for the lvls ill have to add it into my post. i already made him a trigger in the post above

the post i made was only for healing random units once this will require slightly more work although i should have it done in 10 min at most

edit: here it is.
  • Aoe
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set tempPoint = (Position of No unit)
      • Set tempIncrease = ((Level of urAbility for No unit) + 1)
      • Set tempGroup = (Units within 512.00 of tempPoint matching (((Matching unit) is alive) Equal to True))
      • For each (Integer tempInt) from 1 to tempIncrease, do (Actions)
        • Loop - Actions
          • Set aoeIndex = (aoeIndex + 1)
          • Set aoeTime[aoeIndex] = 5
          • Set aoeUnits[aoeIndex] = (Random unit from tempGroup)
      • Custom script: call DestroyGroup( udg_tempGroup)
      • Custom script: set udg_tempGroup = null
      • For each (Integer tempInt) from 1 to aoeIndex, do (Actions)
        • Loop - Actions
          • Unit - Set life of aoeUnits[tempInt] to ((Life of aoeUnits[tempInt]) + 50.00)
          • Set aoeTime[tempInt] = (aoeTime[tempInt] - 1)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • aoeTime[tempInt] Equal to 0
                  • (Life of aoeUnits[tempInt]) Less than 0.41
            • Then - Actions
              • Set aoeUnits[tempInt] = aoeUnits[aoeIndex]
              • Set aoeUnits[aoeIndex] = No unit
              • Set aoeTime[tempInt] = aoeTime[aoeIndex]
              • Set aoeIndex = (aoeIndex - 1)
            • Else - Actions
 
Last edited:
Level 25
Joined
Sep 26, 2009
Messages
2,378
I don't think you have it right.

He wants number of units affected to be [spell lvl]*1,5, while you calculate number of units as [spell lvl] + 1.
So 1*1,5 = 1,5 => 2
2*1,5 = 3
3*1,5 = 4,5 => 5
4*1,5 = 6

I also think he doesn't want the same random units to be healed over 5 seconds, but to pick random units every second and heal them.

Something like this:
  • Triggers
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set TempPoint = (Position of Caster)
      • Set NumberOfUnits = ((Real((Level of Ability for Caster))) x 1.50)
      • Set TempInteger = (Integer(NumberOfUnits))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • NumberOfUnits Not equal to (Real(TempInteger))
        • Then - Actions
          • Set NumberOfUnits = ((Real(TempInteger)) + 1.00)
        • Else - Actions
      • Set TempGroup = (Units within 312.00 of TempPoint matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an ally of (Owner of Caster)) Equal to True)))
      • Unit Group - Pick every unit in (Random (Integer(NumberOfUnits)) units from TempGroup) and do (Actions)
        • Loop - Actions
          • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + 50.00)
      • Custom script: call DestroyGroup(udg_TempGroup)
      • Custom script: set udg_TempGroup = null
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Custom script: set udg_TempPoint = null
He would need to set "Caster" variable in initial trigger when a unit starts the ability.
(Also this is not MUI)
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
ya mine does not give desired units he would have to make another array and store those values and call them when needed which isnt hard. urs also does not last the desired 5 seconds and isnt mui. mine does both.

mine is MUI

he can change that value so it comes out to the units he wants.

he also asked # of units for 5 seconds. if its just purely random then my first post is the way to go
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
Is there a better way to round up the number, except doing it like me with the ITE action?
I know converting real to integer rounds the number down, but I'd like to know if there is an action/equation for rounding up.
 
Level 4
Joined
Oct 5, 2012
Messages
52
Here's the trigger I made (I have much too learn I guess ;)).


  • Enchant
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Enchant
    • Actions
      • Set EnchantCaster = (Casting unit)
      • Set EnchantLevel = (Level of Enchant for EnchantCaster)
      • If (EnchantLevel Equal to 1) then do (Set EnchantCounter = 2) else do (Do nothing)
      • If (EnchantLevel Equal to 2) then do (Set EnchantCounter = 3) else do (Do nothing)
      • If (EnchantLevel Equal to 3) then do (Set EnchantCounter = 5) else do (Do nothing)
      • If (EnchantLevel Equal to 4) then do (Set EnchantCounter = 6) else do (Do nothing)
      • If (EnchantLevel Equal to 5) then do (Set EnchantCounter = 8) else do (Do nothing)
      • Trigger - Turn on EnchantRotat <gen>
      • Wait 5.50 seconds
      • Trigger - Turn off EnchantRotat <gen>
  • EnchantRotat
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set EnchantPoint = (Position of EnchantCaster)
      • Set EnchantGroup = (Units within 300.00 of EnchantPoint matching ((((Picked unit) is A structure) Equal to False) and ((((Picked unit) is An Ancient) Equal to False) and ((((Picked unit) is dead) Equal to False) and ((((Owner of (Picked unit)) is an ally of (Owner of EnchantCas
      • For each (Integer A) from 1 to EnchantCounter, do (Actions)
        • Loop - Actions
          • Set EnchantHeal[(Integer A)] = (Random unit from EnchantGroup)
          • Unit - Set life of EnchantHeal[(Integer A)] to ((Life of EnchantHeal[(Integer A)]) + 50.00)
          • Set EnchantHeal[(Integer A)] = No unit


Doesn't work.

I'll try your triggers, they don't have to be MUI btw.

Sorry for posting in the wrong section, if I did!
 
Last edited:
Level 4
Joined
Jan 27, 2010
Messages
133
Why it's not working

Units in Group matching ... doesn't use (Picked Unit). Matching uses (Matching Unit).


Other stuff

Use "Event - Starts effect of ability". If you use "Begins" and units have casting animations, they can cancel the spell before it is cast, but the trigger will run anyway.


Leak cleaning

You create a point and a group, and you seem to be aware of doing so (you point variables to them). All that remains is destroying them when you are done with them.

  • Actions
    • Set EnchantPoint = (Position of EnchantCaster)
    • Set EnchantGroup = (Units within 300.00 of EnchantPoint matching ((((Picked unit) is A structure) Equal to False) and ((((Picked unit) is An Ancient) Equal to False) and ((((Picked unit) is dead) Equal to False) and ((((Owner of (Picked unit)) is an ally of (Owner of EnchantCas
    • For each (Integer A) from 1 to EnchantCounter, do (Actions)
      • Loop - Actions
        • Set EnchantHeal[(Integer A)] = (Random unit from EnchantGroup)
        • Unit - Set life of EnchantHeal[(Integer A)] to ((Life of EnchantHeal[(Integer A)]) + 50.00)
    • Custom script - call RemoveLocation(udg_EnchantPoint)
    • Custom script - call DestroyGroup(udg_EnchantGroup)
 
Status
Not open for further replies.
Top