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

Custom healing ward

Status
Not open for further replies.
Level 11
Joined
Jul 17, 2013
Messages
544
Hey how can i make healing ward ability healing one unit only once? IT heals unit instantly for x HP but only once IT cant heal again unless healing ward is casted again. Healing ward should also heal units WHO come to IT too or who are near IT. IT should heal every unit nearby but only once unless recasted.


I have some ideas for this spell but i think my ideas mąkę it too complained
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,558
So if I understand correctly, you want a Healing Ward that casts Holy Light or Heal for example, but it'll never target the same unit more than once?

For that I would use a Unit Indexer / Hashtable and a Unit Group array. So when you spawn the Healing Ward you would create a new Unit Group and link it to the Ward. Then whenever the Ward heals a unit, you add them to this "heal" Unit Group. You can then prevent use the Unit Group as a filter to prevent the Ward from healing the same unit more than once (If target is NOT in Heal Group then proceed to heal).

To handle the periodic healing you can add the Healing Wards to a single Unit Group and use a Timer/Periodic Interval + Pick Every Unit function to loop over them and look for nearby targets to heal. If the ward dies, remove it from the ward Unit Group and then destroy the "heal" Unit Group that is linked to it.

Edit:
  • Cast Healing Ward
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoned unit)) Equal to Healing Ward
    • Actions
      • Set VariableSet HW_Ward = (Summoned unit)
      • Unit Group - Add HW_Ward to HW_WardGroup
      • Set VariableSet HW_CV = (Custom value of HW_Ward)
      • Custom script: set udg_HW_HealedGroup[udg_HW_CV] = CreateGroup()
      • -------- --------
      • -------- turn on the periodic trigger if it's off --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Healing Ward Periodic <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on Healing Ward Periodic <gen>
        • Else - Actions
  • Healing Ward Periodic
    • Events
      • Time - Every 0.25 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in HW_WardGroup and do (Actions)
        • Loop - Actions
          • Set VariableSet HW_Ward = (Picked unit)
          • Set VariableSet HW_CV = (Custom value of HW_Ward)
          • Set VariableSet HW_Point = (Position of HW_Ward)
          • Set VariableSet HW_TargetGroup = (Units within 400.00 of HW_Point.)
          • Unit Group - Pick every unit in HW_TargetGroup and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is in HW_HealedGroup[HW_CV].) Equal to False
                  • ((Picked unit) belongs to an ally of (Owner of HW_Ward).) Equal to True
                  • ((Picked unit) is alive) Equal to True
                  • (Percentage life of (Picked unit)) Less than 100.00
                  • ((Picked unit) is A structure) Equal to False
                • Then - Actions
                  • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + 200.00)
                  • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Human\HolyBolt\HolyBoltSpecialArt.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Unit Group - Add (Picked unit) to HW_HealedGroup[HW_CV]
                • Else - Actions
          • Custom script: call DestroyGroup (udg_HW_TargetGroup)
          • Custom script: call RemoveLocation (udg_HW_Point)
      • -------- --------
      • -------- turn off this trigger while there are no wards --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in HW_WardGroup) Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
  • Healing Ward Dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Healing Ward
    • Actions
      • Set VariableSet HW_CV = (Custom value of (Triggering unit))
      • Unit Group - Remove (Triggering unit) from HW_WardGroup.
      • Custom script: call DestroyGroup (udg_HW_HealedGroup[udg_HW_CV])
This is using Bribe's Unit Indexer. If you already have a Unit Indexer in your map then DON'T import the one from my map.
 

Attachments

  • Healing Ward emil.w3m
    23.3 KB · Views: 12
Last edited:
Status
Not open for further replies.
Top