• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Defense related question. (GUI )

Status
Not open for further replies.
Level 25
Joined
Apr 27, 2008
Messages
2,512
I am basically making an ability that is point-click on an enemy unit causing him to lose PERCENTAGE (the problem) Defense (like 50% of his defense).
The second part of the spell is making it spread like a plague when the enemy is in contact with other enemies (not really a problem, just an AOE and Dummy units triggering).
Also since I got rusty after a long break from WE, what were the keyboard buttons that allowed us to put negative values?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Detecting armor goes something like this in GUI:

  • Actions
    • Set tempReal = (Life of targettedUnit)
    • Unit - Cause damageDummy to damage targettedUnit, dealing 10.00 damage of attack type Chaos and damage type Normal
    • Set damage = (tempReal - (Life of targettedUnit))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • damage Greater than 10.00
      • Then - Actions
        • Set armor = ((-1.00 x (10.00 - damage)) / (damage x ARMOR_CONSTANT))
      • Else - Actions
        • Set armor = ((10.00 - damage) / (damage x ARMOR_CONSTANT))
    • Unit - Set life of targrettedUnit to tempReal
Then the variable "armor" will be set to the armor of "targettedUnit" (it's a real, because armor is a real value).
"ARMOR_CONSTANT" is generally 0.06 (unless you changed that, of course).

Once this is done, you can use Item - armor bonus (with negative values, which Super-Sheep already explained :D).
That part shouldn't cause too much trouble: give the ability to the unit and set it to the level "armor / 2" (rounded up, probably).

Edit: oh, and make sure that the damage type "Chaos" still does 100% damage against all damage types, otherwise the values will be incorrect.
 
Level 25
Joined
Apr 27, 2008
Messages
2,512
  • Holy Fire
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Holy Fire
    • Actions
      • Set HolyFireTempReal = (Life of (Targeted unit))
      • Unit - Cause (Casting unit) to damage (Targeted unit), dealing 10.00 damage of attack type Chaos and damage type Normal
      • Set HolyFireDamage = (HolyFireTempReal - (Life of (Targeted unit)))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HolyFireDamage Greater than 10.00
        • Then - Actions
          • Set HolyFireDefense = ((-1.00 x (10.00 - HolyFireDamage)) / (HolyFireDamage x 0.60))
        • Else - Actions
          • Set HolyFireDefense = ((10.00 - HolyFireDamage) / (HolyFireDamage x 0.60))
      • Unit - Set life of (Targeted unit) to HolyFireTempReal
      • Unit - Create 1 Holy Fire for (Owner of (Casting unit)) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
      • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
      • Unit - Set level of HolyFire negative armor for (Last created unit) to (Integer(HolyFireDefense))
      • Unit - Order (Last created unit) to Human Priest - Inner Fire (Target unit of ability being cast)
Does not work D: I think the problem is in the " Unit - Set level of HolyFire negative armor for (Last created unit) to (Integer(HolyFireDefense)) " line.
any thoughts?

Also, the dummy have a 100 level ability, each level = -1
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
The default value is "0.06" :p
I thought you just made a typo in your previous post ^^

If it doesn't do anything at all, then let me just think about it for a while :X

(You also leak a location, just saying...).

Edit: oh, and because you only want to reduce half the armor, you should divide "HolyFireDefense" by 2 as well ;)
 
Level 25
Joined
Apr 27, 2008
Messages
2,512
Bump: Ability have 100 levels, each level is -1 armor, maybe when I " Unit - Set level of HolyFire negative armor for (Last created unit) to (Integer(HolyFireDefense)) " the number is not perfect and have .X in it, that is why the spell is not working D:
How can I round it up?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Aha! I think I may get it.
When you convert a real to an integer, it rounds down (so an armor value of 3.9 becomes 3).
A simple method of rounding up is rounding (real + 0.5) down.

My example of 3.9 becomes 4.4, rounded down, that's 4 (which is also 3.9 rounded up :D).
2.4 --> 2.9 --> 2 (2.9 rounded down, 2.4 rounded up)
2.6 --> 3.1 --> 3 (3.1 rounded down, 2.6 rounded up)

Okay, so now I've made the trigger myself and this does work:

  • Defense Break
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Shield Break
      • (Level of Shield Break Dummy for (Target unit of ability being cast)) Equal to 0
    • Actions
      • Set defenseTempReal = (Life of (Target unit of ability being cast))
      • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing 10.00 damage of attack type Chaos and damage type Normal
      • Set defenseDamage = (defenseTempReal - (Life of (Target unit of ability being cast)))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • defenseDamage Greater than 10.00
        • Then - Actions
          • -------- Armor is a negative value, setting it to 0 would actually benefit the target... --------
          • Unit - Set life of (Target unit of ability being cast) to defenseTempReal
        • Else - Actions
          • Set defenseArmor = ((10.00 - defenseDamage) / (defenseDamage x 0.06))
          • Unit - Set life of (Target unit of ability being cast) to defenseTempReal
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • defenseArmor Greater than 0.50
            • Then - Actions
              • Unit - Add Shield Break Dummy to (Target unit of ability being cast)
              • Unit - Set level of Shield Break Dummy for (Target unit of ability being cast) to (Integer((defenseArmor + 0.50)))
            • Else - Actions
              • -------- Armor is 0, reducing it by 100% is futile (besides, the first level of the spell decreases armor by 1) --------
Up to you to see where you went wrong now :) (I hope you already changed the 0.6 to 0.06).
Test-map attached.
 

Attachments

  • Defense Break.w3x
    14.5 KB · Views: 99
Level 25
Joined
Apr 27, 2008
Messages
2,512
Just to share with you my stupid mistake because you deserve to know XD
it was the target unit, of the dummy inner fire spell, it was allies instead of enemies
while the original spell was enemies alone. everything is working like it should be now, I am trying to make it spread on nearby units (25% armor lose spread on level 1 and 75% on level 3) :p I'll get back to you with results later, hope it wont be something buggy.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
w8.. Dont you need Logarithm to get Armor :O
Hello there, mighty necromancer. Would you care elaborating your post? As you have currently used your necro-skills for naught (look at the previous triggers, it determines the armor of a unit).
What kind of Logarithms? Does it require a huge amount of variables/arrays? And in which way (aside from the 'can't die if HP is less than 10') is it better than the method above?
 
Status
Not open for further replies.
Top