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

Chain heal based on int?

Status
Not open for further replies.
How can i make a chain heal type spell with healing based on int?

It seems like something hard to do.

it isn't really hard if you have the heart for it...

-make a dummy spell.
- save the caster unit (preferably in a hashtable) when it casts the dummy spell then add him to a caster group.
-save other data such as number of jumps and such things in the hashtable. -heal the target unit and save the target to the hashtable
-a periodic trigger that picks every unit in the caster group then
-->Load target(last one that got hit) unit
-->Pick every unit within range of target(matching unit is not equal to target)
-->Pick a random unit from that group
-->set him as the new target then heal, then adjust the variables saved in the hashtable.

make sure you remove the caster when the jumps get to 0 or when there are no units in the units within range of target... and of course clean leaks. if you want lightning effects you need to save the location of the last target and the new target.
 
Level 3
Joined
Apr 29, 2009
Messages
32
  • Set IntInteger = (Intelligence of (Triggering unit) (Include bonuses))
This makes the integer the intelligence amount of the triggering unit. Then just do something like...
  • Unit - Set (Life of YourUnit) to (Life of YourUnit) + (Real(IntInteger x YourAmount))
Do one of this for each unit that has been hit.

Ex. for a chain heal hitting 4 units.

  • Untitled Trigger 004
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Chain Heal
    • Actions
      • Set IntInteger = (Intelligence of (Triggering unit) (Include bonuses))
      • Set Position[1] = (Position of (Target unit of ability being cast))
      • Set UnitGroup = (Units within 500.00 of Position[1] matching (((Owner of (Matching unit)) is an ally of (Owner of (Triggering unit))) Equal to True))
      • Set Unit[1] = (Random unit from UnitGroup)
      • Set Position[2] = (Position of Unit[1])
      • Set UnitGroup2 = (Units within 500.00 of Position[2] matching ((((Owner of (Matching unit)) is an ally of (Owner of (Triggering unit))) Equal to True) and ((Matching unit) Not equal to (Target unit of ability being cast))))
      • Set Unit[2] = (Random unit from UnitGroup2)
      • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + ((Real(IntInteger)) x 2.50))
      • Unit - Set life of (Target unit of ability being cast) to ((Life of (Target unit of ability being cast)) + ((Real(IntInteger)) x 5.00))
      • Unit - Set life of Unit[1] to ((Life of Unit[1]) + ((Real(IntInteger)) x 2.50))
      • Unit - Set life of Unit[2] to ((Life of Unit[2]) + ((Real(IntInteger)) x 1.25))
Or something like that.

Hope it helps.
 
Level 9
Joined
Sep 28, 2004
Messages
365
You need a trigger to compare health of units in group and then store the lowest in a unit variable. Below is the way i do it. Briefly..

  • Priority Heal
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Priority Heal
    • Actions
      • Set healpoint = (Target point of ability being cast)
      • Set healgroup = (Units within 300.00 of healpoint matching ((Unit-type of (Matching unit)) Not equal to Healing Dummy))
      • Game - Display to (All players) the text: (Group Count: |cffffcc00 + ((String((Number of units in healgroup))) + |r))
      • Unit Group - Pick every unit in healgroup and do (Actions)
        • Loop - Actions
          • Set currunit = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • firstunit Equal to False
            • Then - Actions
              • Set healme = (Picked unit)
              • Set firstunit = True
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Life of currunit) Less than (Life of healme)
                • Then - Actions
                  • Set healme = currunit
                • Else - Actions
                  • Set healme = healme
          • Game - Display to (All players) the text: (|cffFF0000Current Unit: |r + (String((Life of currunit))))
          • Game - Display to (All players) the text: (|cff00FF00Heal Me: |r + (String((Life of healme))))
          • Game - Display to (All players) the text: ===================...
      • Set healingPos = (Position of healme)
      • Unit - Create 1 Healing Dummy for (Owner of (Triggering unit)) at healingPos facing Default building facing degrees
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Unit - Order (Last created unit) to Human Paladin - Holy Light healme
      • Set firstunit = False
      • Custom script: call RemoveLocation(udg_healpoint)
      • Custom script: call RemoveLocation(udg_healingPos)
      • Custom script: call DestroyGroup(udg_healgroup)
EDIT: Updated code, fix logic error, everything should work fine now. The above code includes debug message. If you don't understand you can download the map below.

**Note that this is not a chain spell but just a single spell that checks for the lowest health. Just to give you some idea.
 

Attachments

  • heal lowest health priority code.w3x
    18.6 KB · Views: 44
Last edited:
Status
Not open for further replies.
Top