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

[Solved] Non-combat healing fountain

Status
Not open for further replies.
Level 5
Joined
Jul 5, 2014
Messages
155
I think it falls under spells (or abilities more precisely): is it possible to make the healing fountain's passive ability into a non-combat healing?
 
Level 5
Joined
Jul 5, 2014
Messages
155
Triggering the fountain healing would be easy, next you could add units to a unit group when they've made an attack or been attacked and remove them once a period of time has elapsed.

Knowledge of basic trigger enhancing would be required.

I know triggering to a degree though it's generally a duct tape-like solution not the most efficient. How would that look like?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,517
A very basic design using a Unit Indexer:
  • Attacked
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Set VariableSet CV = (Custom value of (Triggering unit))
      • Set VariableSet AttackCounter[CV] = (AttackCounter[CV] + 1)
      • Wait 1.00 seconds
      • Set VariableSet CV = (Custom value of (Triggering unit))
      • Set VariableSet AttackCounter[CV] = (AttackCounter[CV] - 1)
  • Healing Loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set VariableSet TempPoint = (Position of Healing Fountain)
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within 300.00 of TempPoint.) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • AttackCounter[(Custom value of (Picked unit))] Equal to 0
              • ((Picked unit) is A structure) Equal to False
              • ((Picked unit) is alive) Equal to True
            • Then - Actions
              • Unit - Set life of (Picked unit) to ((Percentage life of (Picked unit)) + 1.00)%
            • Else - Actions
      • Custom script: call RemoveLocation (udg_TempPoint)
For efficiency sake you could turn off the Healing Loop trigger when no units are in range of the Healing Fountain. This could be handled by putting a Region around the Healing Fountain and some triggers that detect when A unit Enters/Leaves said Region.

A unit enters Heal Region -> If Healing Loop is Off then Turn on Healing Loop.
A unit leaves Heal Region -> Wait 0.01 seconds -> If number of units in Heal Region Equal to 0 -> If Healing Loop is On then Turn off Healing Loop.

But this line will cause problems: If number of units in Heal Region Equal to 0
Because it will count Dead units, Structures, the Healing Fountain, etc...

So you'd want to use a Unit Group to filter out unwanted units in the Heal Region instead:
Set Variable TempGroup = Units in Heal Region matching Matching unit-type not equal to Healing Fountain and Matching unit is Alive = True and Matching unit is a Structure = False

Then you reference TempGroup instead:
A unit leaves Heal Region -> Wait 0.01 seconds -> If number of units in TempGroup Equal to 0 -> If Healing Loop is On then Turn off Healing Loop.

And destroy the Unit Group once you're done: Custom script: call DestroyGroup (udg_TempGroup)
 
Last edited:
Level 5
Joined
Jul 5, 2014
Messages
155
Here's an example map (requires latest version).

Also, the Variables used:
CV = Integer
AttackCounter = Integer [ARRAY]
TempPoint = Point

I appreciate it but I only have 1.26. Also, there are factors like owner and non-mechanical units, so I may better off modifying a scroll of regeneration into an ability and make it manual.
 
Level 24
Joined
Jun 26, 2020
Messages
1,850
I appreciate it but I only have 1.26. Also, there are factors like owner and non-mechanical units, so I may better off modifying a scroll of regeneration into an ability and make it manual.
Do you know all of that things that @Uncle show and check the owner and non-mechanical units are in the 1.26?
I reffer, if you can't open the map, do it yourself.
Ok, that unit indexer not, but you can find one for the 1.26
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,517
I appreciate it but I only have 1.26. Also, there are factors like owner and non-mechanical units, so I may better off modifying a scroll of regeneration into an ability and make it manual.
Like Herly said, the trigger will allow you to filter any types of units you want, triggers tend to give you far greater control than an ability.

So you would just add some more conditions like:
((Picked unit) is Mechanical) Equal to False
Picked unit belongs to X Player Equal to True/False

Again, the triggers are fairly simple and only use 3 variables. All you need to do is recreate what you see. Everything there is categorized and named appropriately in the Editor, if you can't find something make sure you're looking in the right place. Search for Text is a huge help for finding the correct Actions.
 
Status
Not open for further replies.
Top