Decrease base life bit by bit.

joohen

New Member
Reaction score
20
I met a problem, i created a hammer which can does 10 Dmg to the base life (max life). I used the bonus life ability( I added this ability to deacrese the max life), i want it to have hundred level, it is easy if i used the autofill, BUT! When i put in the negative value, it just turn to 0!!!So is there any other way to do it? Hope you understand what i am asking about......:(
 

avalya

New Member
Reaction score
37
Have you checked the allow negative values in object editor (or whatever that option is called)? Is it an item or ability that will have this effect? If it is an ability, is it a debuff to the target?
 

joohen

New Member
Reaction score
20
uh...i mean i can put negative value, but not in the auto fill thingy.I decrease their life by adding a ability to the "victim". So is there any way to make it stack? or i just have to put it 100 levels and put in -10,-20,-30,-40-------,-1000?
 

avalya

New Member
Reaction score
37
So, you can't auto-fill it, but it works to fill in into the fields? You want to reduce max health and not just health, correct?
 

millz-

New Member
Reaction score
25
Here's a trick, you only need 4 levels for your maximum health ability.

Level 1: 0
Level 2: -1
Level 3: -10
Level 4: -100

Set a variable to the amount of hp you want to reduce, example:

set amount = 200

Now make a loop to reduce the hp on a Hero:

JASS:
loop
    exitwhen amount == 0
    call UnitAddAbility(theHero, theAbility)
    if (amount>=100) then
        call SetUnitAbilityLevel(theHero,theAbility,4)
        set amount = amount - 100
    elseif (amount>=10) then
        call SetUnitAbilityLevel(theHero,theAbility,3)
        set amount = amount - 10
    else
        call SetUnitAbilityLevel(theHero,theAbility,2)
        set amount = amount - 1
    endif
    call UnitRemoveAbility(theHero,theAbility)
endloop


Edit: This can also be easily converted to GUI
 

joohen

New Member
Reaction score
20
o-o... I don't really understand any bit.... i am a real JASS-n00b.:( Can you help me write in GUI? Not that i am lazy, i just don't understand all the things...except for those like addAbility (something like that)
 

millz-

New Member
Reaction score
25
I don't know how you would want the hammer thingy to work, so here is what I think you want it to be:

Trigger:
  • DecreaseLife
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • ((Attacking unit) has HammerItem) Equal to True
    • Actions
      • Set amount = 10
      • Custom script: loop
      • Custom script: exitwhen udg_amount == 0
      • Unit - Add DecreaseHealthAbility to (Triggering unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • amount Greater than or equal to 100
        • Then - Actions
          • Unit - Set level of DecreaseHealthAbility for (Triggering unit) to 4
          • Set amount = (amount - 100)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • amount Greater than or equal to 10
            • Then - Actions
              • Unit - Set level of DecreaseHealthAbility for (Triggering unit) to 3
              • Set amount = (amount - 10)
            • Else - Actions
              • Unit - Set level of DecreaseHealthAbility for (Triggering unit) to 2
              • Set amount = (amount - 1)
      • Unit - Remove DecreaseHealthAbility from (Triggering unit)
      • Custom script: endloop



This triggers when a unit is attacked by another unit holding the Hammer item.
 

millz-

New Member
Reaction score
25
If it's increasing instead of decreasing, change the ability stats to:

Level 1: 0
Level 2: 1
Level 3: 10
Level 4: 100

It's weird but I don't know why.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top