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

How can i ADD 50 mana/health to unit?

Status
Not open for further replies.
Level 13
Joined
Mar 4, 2009
Messages
1,156
How can i ADD 50 mana/health to unit every time some unit dies?

I know how to set mana but how can i add like 50 mana?
I can add 50 level to unit becouse there is a function "level of unit"
and than +50
But there is no function called "mana of unit" or "health of unit" there is only "percentage mana" or "percentage life",i actually want to count how much each player gived gold to enemyes but if u know this it would help.
_______________________________________________________________________________
every time some unit dies i need to add 50 mana or health to unit called "show gold gived to enemyes" if gold bounghty of dying unit is 50
_______________________________________________________________________________
 
Last edited:
Level 18
Joined
Mar 7, 2005
Messages
824
first of all, there is a function that adss life or mana without percentage values.. it's a real value, no integer.. so you searched in the wrong categories.. but besides of that.. this doesn't work in warcraft..

so you have to do it with abilities.. create a ability of the Item bonus life ability, and add this ability via trigger to the unit, if you don't want the life bonus remove it. this should work similar with the mana incease..
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
first of all, there is a function that adss life or mana without percentage values.. it's a real value, no integer.. so you searched in the wrong categories.. but besides of that.. this doesn't work in warcraft..

so you have to do it with abilities.. create a ability of the Item bonus life ability, and add this ability via trigger to the unit, if you don't want the life bonus remove it. this should work similar with the mana incease..

There is no function for adding mana (at least i didnt find it),there is only function for seting mana.I cant do it to do it with abilities becouse i would need it for every unit.
 
Level 18
Joined
Mar 7, 2005
Messages
824
There is no function for adding mana (at least i didnt find it),there is only function for seting mana.I cant do it to do it with abilities becouse i would need it for every unit.

that's it dude.. you can "set mana of unit X = mana of unit + 100" for example.. but this dont works..

so create a ability based on the item bonus ability.. that increases the HP, give it some value for example 100. and add this ability to your units, so each unit will have 100 HP more.. that's all no matter how many units you are using
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
that's it dude.. you can "set mana of unit X = mana of unit + 100" for example.. but this dont works..

so create a ability based on the item bonus ability.. that increases the HP, give it some value for example 100. and add this ability to your units, so each unit will have 100 HP more.. that's all no matter how many units you are using

Yeah....,but i said i actually want to count gold with that so i would need new ability for every unit becouse every unit had another gold bounghty :(

so every time some unit dies i need to add mana to unit called "show gold gived to enemyes".
Is there any other way to count how much each player has gived gold to enemyes? (it has in Vampirism Fire 5.06 but i cant open it)
 
Last edited:
Level 13
Joined
Oct 27, 2008
Messages
1,176
ok i think i may of thought up a way idk if it'll work for +50 health/mana a lvl or not but i'll post it once i'm done
 
Level 20
Joined
Oct 21, 2006
Messages
3,231
Is there any other way to count how much each player has gived gold to enemyes? (it has in Vampirism Fire 5.06 but i cant open it)
Unit dies
Set GoldBounty[player number of owner of dying unit] = GoldBounty[player number of owner of dying unit] + Point value of Dying unit

You can modify Point Values from Object Editor -> Unit -> Point Value. Set it to be you bounty.
 
Level 9
Joined
Oct 17, 2007
Messages
547
Make an ability that add those bonus in increments of 50 each... and everytime a unit meet some requirement make a trigger increase the ability lv by 1
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
Unit dies is an event.

GoldBounty is an Integer variable.

Add 12 (number of total players) arrays to your variable.

You use action "Set VARIABLE".

Can u make me that trigger?plz xD and btw when player would type -show than it needs to show gold like this PLAYER 1 has gived 123 gold to enemies
PLAYER 2 has gived 167 gold to enemies...
is´t not a problem to do the problem is how can i count gold gived?...
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
there is a function UNIT PROPERTY
trigger
EVENT every 5 seconds of the game
ACTION-set mana of (some unit) to (unit property)-mana + 50

i can now count how much each player has gived gold to enemyes :)
EVENT -unit dies
CONDITION killing unit belongs to an ally of owner of dying unit
ACTION-set mana of unit (owned by owner of dying unit of type SHOW GOLD GIVED TO ENEMYES) to (unit property)-mana + FLYING HEIGHT OF DYING UNIT ( dying unit must have movement type foot and than he will not "fly" in warcraft and set flying height to its gold bounghty )
 
Level 9
Joined
Oct 17, 2007
Messages
547
there is a function UNIT PROPERTY
trigger
EVENT every 5 seconds of the game
ACTION-set mana of (some unit) to (unit property)-mana + 50

i can now count how much each player has gived gold to enemyes :)
EVENT -unit dies
CONDITION killing unit belongs to an ally of owner of dying unit
ACTION-set mana of unit (owned by owner of dying unit of type SHOW GOLD GIVED TO ENEMYES) to (unit property)-mana + FLYING HEIGHT OF DYING UNIT ( dying unit must have movement type foot and than he will not "fly" in warcraft and set flying height to its gold bounghty )

This will not work that trigger works similar to a healing potion.. it just restore HP/MP it doesn't add more to a unit's max HP/MP.
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
This will not work that trigger works similar to a healing potion.. it just restore HP/MP it doesn't add more to a unit's max HP/MP.
i dont iven need to add more that its max mana becouse i can count gold from 0 to 100000,but there is ability for parnament bonus healt in item "Manual of Health" Item Parnament Life Gain (+50)
in trigger you just need action (hero)
create Manual of Health and give it to (unit you want)
 
Level 9
Joined
Oct 17, 2007
Messages
547
i dont iven need to add more that its max mana becouse i can count gold from 0 to 100000,but there is ability for parnament bonus healt in item "Manual of Health" Item Parnament Life Gain (+50)
in trigger you just need action (hero)
create Manual of Health and give it to (unit you want)

Im not sure that will work for all units though, it might only work on heroes since units cannot use items. If they do the game will crash.
 
Level 9
Joined
Aug 1, 2008
Messages
453
Make an ability based of life bonus. and give it like 100 levels that increase hp by 50 each level. And give it to the unit. Then have a trigger level it up each time a unit dies.

(the reason a 100 kills is because its a high # and usually ALL the players in a game don't get to a 100 kills. If they can/will get more kills in your game just raise it)
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
Im not sure that will work for all units though, it might only work on heroes since units cannot use items. If they do the game will crash.
it can work on normal unit that is not hero he only needs to have an inventory
ACTION
-add ability "inventory" to "Your Unit"
-create "Manual of Health" and give it to "Your Unit"
-remuve ability "inventory" to "Yout Unit"
 
Level 3
Joined
Mar 18, 2009
Messages
31
Maybe I'm getting this wrong and you want to target just one specific unit.
Why don't you just make an upgrade that adds +50 mana, then in the trigger you increase the level of the upgrade?
Of course make sure only that unit-type will benefit from this upgrade.
 
Level 2
Joined
Mar 30, 2009
Messages
30
---------------------------------------------------------------------------
every time some unit dies i need to add 50 mana or health to unit called "show gold gived to enemyes" if gold bounghty of dying unit is 50
---------------------------------------------------------------------------


  • Events
    • Unit - A unit Dies
  • Conditions
    • (Dying unit) Equal to Your unit
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Custom value of Your unit) Equal to 0 (this number is bounty)
  • -------- Set custom value by trigger Unit-Set Custom Value --------
    • Then - Actions
      • Unit - Set life of (Show gold) to ((Life of (Show gold)) + (Real((Custom value of Your unit))))
    • Else - Actions

When a unit dies trigger checks that dying unit is unit that you specified (gives bounty etc. blah blah) then it checks that units custom value (which you set on beginning of game by trigger Unit-Set custom value, that value is your bounty. And finally it adds custom value to life of SHOW GOLD GIVED TO ENEMYS.

Every unit has it's own custom value so you can set different bounty for each unit this way.

You need variables for
Every hero with bounty - Unit type Variable

Alternatively

  • Events
    • Unit - A unit Dies
    • Conditions
      • (Dying unit) Equal to No unit
    • Actions
      • Unit - Set the custom value of (Dying unit) to ((Custom value of (Dying unit)) + 1)
This trigger just sets custom value of dying unit + 1 so when you need to show gold just display game message that displays Custom value of hero of whom you want to know how much gold he gave times bounty (50)

Ex.
  • Game - Display to (All players) the text: (Gold given : + (String(((Custom value of No unit) x 50))))
So basically it records how much times unit has died and when multiplied with bounty gives total bounty that unit gave.
 
Last edited:
Level 13
Joined
Mar 4, 2009
Messages
1,156
i already solved it but i dont know why is it not working with health

  • COUNT FEED
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Killing unit) belongs to an enemy of (Owner of (Dying unit))) Equal to True
    • Actions
      • Unit - Set mana of (Random unit from (Units owned by (Owner of (Dying unit)) of type FEED/LEAKED)) to ((Mana of (Random unit from (Units owned by (Owner of (Dying unit)) of type FEED/LEAKED))) + (Default flying height of (Dying unit)))/

So i put default flying height egual to gold bounghy of dying unit (unit will not fly becouse movement type is foot or if its a structure)

but i dont know why is this not working
  • Unit - Set life of (Random unit from (Units owned by Player 1 (Red) of type FEED/LEAKED)) to ((Life of (Random unit from (Units owned by Player 1 (Red) of type FEED/LEAKED))) + 1.00)


it workt only once ... :hohum: and than its same all the time ,i dont really need it not becouse my unit has 100 hp and i made it with percentage mana but i would like to know ....
 
Level 2
Joined
Mar 30, 2009
Messages
30
  • Unit - Set life of (Random unit from (Units owned by Player 1 (Red) of type FEED/LEAKED)) to ((Life of (Random unit from (Units owned by Player 1 (Red) of type FEED/LEAKED))) + 1.00)
It doesn't work because you are setting life for player 1 when you need to set life of owner of dying unit
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
  • Unit - Set life of (Random unit from (Units owned by Player 1 (Red) of type FEED/LEAKED)) to ((Life of (Random unit from (Units owned by Player 1 (Red) of type FEED/LEAKED))) + 1.00)
It doesn't work because you are setting life for player 1 when you need to set life of owner of dying unit

my bad.... i didnt say it workt once and EVENT is not when unit dies...
i dont know why it works once only:hohum:

{EDIT}
Theres an easier way to do it.
Use an upgrade. You can make it add mana and health if you wanted, and im pretty sure you could research it through triggers.
EDIT: Zubie beat me to it.
Upgrade is to slow and i would need some unit that would need to do that every time when unit dies witch is inpossible
 
Last edited by a moderator:
Level 2
Joined
Mar 30, 2009
Messages
30
Well, he's using mana for that so no need for abilities.
Can you paste that trigger with health here? (if unit dies is not an event, what is then?)

The Sorrow
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
The question was about the health trigger.
So if you still have it could you post it?


  • COUNT LEAKED GOLD COINTS Copy
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item being manipulated)) Equal to Gold Coin
        • Then - Actions
          • Unit - Set life of (Random unit from (Units owned by Player 1 (Red) of type FEED/LEAKED)) to ((Life of (Random unit from (Units owned by Player 1 (Red) of type FEED/LEAKED))) + 1.00)
        • Else - Actions
workt once....:hohum:
 
Status
Not open for further replies.
Top