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

Add healing amount to Int

Status
Not open for further replies.
Level 2
Joined
Mar 16, 2017
Messages
20
so I have a int array called Totalheal. that im using on my multi board it's goal is to show everyone how much that player have healed in the entire game (it's a td map with towers that heal the units first)
so Im wondering if there is a ingame command that just say Add healing amunt to Totalheal.

so any iders how I do this is a nice way?. and if it can take in account that overhealing does NOT count in. that would be awesome.(but thats a nice to have not need)
 
Level 8
Joined
Jan 28, 2016
Messages
486
You're probably best to trigger the heals. That way you can easily track the amount and calculate any extra healing.

  • Holy Hand
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Holy Hand
    • Actions
      • Set HHCaster = (Triggering unit)
      • Set HHTarget = (Target unit of ability being cast)
      • Set HHAmount = 100.00
      • Set HHLife = (Life of HHTarget)
      • Set HHLifeMax = (Max life of HHTarget)
      • Set HHLifeSum = (HHLife + HHAmount)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HHLifeSum Greater than HHLifeMax
        • Then - Actions
          • Set HHExtra = (HHLifeSum - HHLifeMax)
          • Set Totalheal[(Player number of (Owner of HHCaster))] = (Totalheal[(Player number of (Owner of HHCaster))] + (Integer((HHAmount - HHExtra))))
        • Else - Actions
      • Unit - Set life of HHTarget to HHLifeSum
 
Level 2
Joined
Mar 16, 2017
Messages
20
MY Heal was allready a Trigger so this did the trick with some changes. It would only update the total heal qhen the unit qwas fully healing not partial so i added in a else line. and i removed the last set helth cause i could not get it to work. I forgot how to put in code so it looks pretty but here it is in raw text.
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Ability being cast) Equal to Heal1
      • Then - Actions
        • Set Healcaster = (Triggering unit)
        • Set HealTaget = (Target unit of ability being cast)
        • Set HealAmount = 75
        • Set Heallife = (Integer((Life of (Target unit of ability being cast))))
        • Set HealMax = (Integer((Max life of (Target unit of ability being cast))))
        • Set HealSum = (Heallife + HealAmount)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • HealSum Greater than HealMax
          • Then - Actions
            • Set HealExtra = (HealSum - HealMax)
            • Set TotalHeal[(Player number of (Owner of Healcaster))] = (TotalHeal[(Player number of (Owner of Healcaster))] + (HealAmount - HealExtra))
          • Else - Actions
            • Set TotalHeal[(Player number of (Owner of Healcaster))] = (TotalHeal[(Player number of (Owner of Healcaster))] + HealAmount)
      • Else - Actions
 
Last edited:
Level 7
Joined
Mar 10, 2013
Messages
366
MY Heal was allready a Trigger so this did the trick with some changes. It would only update the total heal qhen the unit qwas fully healing not partial so i added in a else line. and i removed the last set helth cause i could not get it to work. I forgot how to put in code so it looks pretty but here it is in raw text.

Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Ability being cast) Equal to Heal1
Then - Actions
Set Healcaster = (Triggering unit)
Set HealTaget = (Target unit of ability being cast)
Set HealAmount = 75
Set Heallife = (Integer((Life of (Target unit of ability being cast))))
Set HealMax = (Integer((Max life of (Target unit of ability being cast))))
Set HealSum = (Heallife + HealAmount)
Game - Display to (All players) the text: (String(HealSum))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
HealSum Greater than HealMax
Then - Actions
Set HealExtra = (HealSum - HealMax)
Set TotalHeal[(Player number of (Owner of Healcaster))] = (TotalHeal[(Player number of (Owner of Healcaster))] + (HealAmount - HealExtra))
Else - Actions
Set TotalHeal[(Player number of (Owner of Healcaster))] = (TotalHeal[(Player number of (Owner of Healcaster))] + HealAmount)
Else - Actions


Use these tags:
Code:
[trigger][/trigger]
e.g.:
  • Unit - A unit Dies
So, whats the problem with your trigger? It doesn't work?
 
Level 2
Joined
Mar 16, 2017
Messages
20
It's working with the changes I did. I Greatly apriciated the help im getting here. MY thanks. I moved on to next problem. I have to start my creeps with 1 hp cause if i do it with 0 there die. so im looking for a way to negate that 1 hp. Eighter with some code or maybe an item that negate 1 point of heal that first time it gets heal or maybe then a command that make the item vanish after it's first effected by a heal.

im sure there is a VERY easy solation to the problem
 
Level 7
Joined
Mar 10, 2013
Messages
366
It's working with the changes I did. I Greatly apriciated the help im getting here. MY thanks. I moved on to next problem. I have to start my creeps with 1 hp cause if i do it with 0 there die. so im looking for a way to negate that 1 hp. Eighter with some code or maybe an item that negate 1 point of heal that first time it gets heal or maybe then a command that make the item vanish after it's first effected by a heal.

im sure there is a VERY easy solation to the problem
No, there isnt, the units can't have 0 life otherwise the game states them as dead, it's really tricky to get around those situations (I'll try to take a look, I've already found a thread on this topic elsewhere). What's the matter using the life you desire + 1? (I know that, if you're looking for perfection, this makes it as an ugly solution but just to make your map work as intended while you're working on a solution).

EDIT: Ok, I'm not easilly finding that topic yet. Create a new topic on the matter and see if anyone can help you with it.

EDIT2: Found it - Negative Health
 
Last edited:
Level 2
Joined
Mar 16, 2017
Messages
20
so I looked over the topic and moved over the item to my minions but since there start with 1 health and the item remove 2000 of them then there die. and i can't change it manual to a negativ health. so i don't know how there managed to put in a -2000 in there. I need a -1
 
Status
Not open for further replies.
Top