• 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.

Trigger that identifies armor type and value

Level 30
Joined
Aug 29, 2012
Messages
1,386
We have one since reforged, but not available in the older versions

1722030789897.png


1722030983862.png
 
Level 30
Joined
Aug 29, 2012
Messages
1,386
Well good luck with that :p

Keep track of armor type is possible with workarounds, like giving a dummy ability representing each armor type to corresponding units then checking if unit has e.g. ability "large armor" level 1
But keeping track of armor... unless there was some JASS function I'm not aware of (which is likely), that would be a pain to set up

The inconvenients of staying on an outdated version are starting to outweight the advantages by a significant margin imo
 
Level 12
Joined
Jul 5, 2014
Messages
551
Well good luck with that :p

Keep track of armor type is possible with workarounds, like giving a dummy ability representing each armor type to corresponding units then checking if unit has e.g. ability "large armor" level 1
But keeping track of armor... unless there was some JASS function I'm not aware of (which is likely), that would be a pain to set up

The inconvenients of staying on an outdated version are starting to outweight the advantages by a significant margin imo
From what I've read, reforged is a bugfest, so updating to it would be like gaining one thing at the cost of ten other.
 
Prior to reforged, the main way people would calculate it is by:
  1. Adding an ability to the unit that increases their max health
  2. Dealing damage to the unit
  3. Calculating the armor based off the actual damage that was dealt to the target
  4. Restoring the health of the unit and removing the ability
There are a few systems that support this:
...but they are all written in vJass, so you would need JassNewGenPack to compile and use it.
 
there is unryze api has most of what reforged has, (in some cases it has more), and works for 1.26, but it is an custom launcher means when used only works with that launcher.
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
Thanks. Unfortunately, I'm not knowledgeable with JASS so I'm not comfortable using an advanced version. I guess I'll have to rethink the ability.
Chaosium's suggestion requires no JASS, just a reasonable amount of mucking with the Unit Editor. And you do have to remember to update/change the abilities if you change the armor type of a unit (or if it can transform or something).
like giving a dummy ability representing each armor type to corresponding units then checking if unit has e.g. ability "large armor" level 1
You can even automate some of this by using a single ability for this and then manipulating its level to represent the different armor types. Every time a unit enters the map check if it has this ability already; if not add it and set the correct level. You can make a parallel array of unit-types and integers (representing armor type as a level) to automatically assign them properly:
  • Events
    • Time - Elapsed game-time is 0.50 seconds
  • Conditions
  • Actions
    • Set AT_NORMAL = 1
    • Set AT_HEAVY = 2
    • Set AT_DIVINE = 3 //or whatever
    • //...
    • Set AT_FLESH = 8
    • -------- --------
    • Set AT_COUNT = (AT_COUNT + 1)
    • Set AT_UTYPE[AT_COUNT] = Footman //unit-type array
    • Set AT_ATYPE[AT_COUNT] = AT_NORMAL //integer-array holding armor type info
    • -------- --------
    • Set AT_COUNT = (AT_COUNT + 1)
    • Set AT_UTYPE[AT_COUNT] = Peasant
    • Set AT_ATYPE[AT_COUNT] = AT_FLESH
    • -------- --------
    • Set AT_COUNT = (AT_COUNT + 1)
    • Set AT_UTYPE[AT_COUNT] = Knight
    • Set AT_ATYPE[AT_COUNT] = AT_HEAVY
    • //etc. for all relevant unit-types
    • -------- --------
    • //this avoids code duplication by just running the trigger for all units that were preplaced and thus never 'enter' the map to fire the trigger themselves
    • //instead you would have to have a copy of the trigger actions here too inside of the unit group loop
    • Trigger - Turn on THE_ENTERS_TRIGGER <gen>
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in (Units in (Playable Map Area)) and do (Actions)
      • Loop - Actions
        • Set ArmorUnit = (Picked Unit)
        • Trigger - Run THE_ENTERS_TRIGGER <gen> (ignoring conditions)
  • Events
    • Unit - A unit enters (Playable Map Area)
  • Conditions
    • (Level of ARMOR_TYPE_ABILITY for (Triggering Unit)) equal to 0
  • Actions
    • If (All conditions are true) then do (Then actions) else do (Else actions)
      • If - Conditions
        • (Triggering Unit) not equal to (No Unit) //if TU exists the trigger wasn't manually run so we can update the variable safely
      • Then - Actions
        • Set ArmorUnit = (Triggering Unit)
      • Else - Actions
    • Set UT = (Unit-type of ArmorUnit)
    • For each (Integer A) from 1 to AT_COUNT do (Actions)
      • Loop - Actions
        • If (All conditions are true) then do (Then actions) else do (Else actions)
          • If - Conditions
            • UT equal to AT_UTYPE[(Integer A)]
          • Then - Actions
            • Unit - Add ARMOR_TYPE_ABILITY to ArmorUnit
            • Unit - Set level of ARMOR_TYPE_ABILITY for ArmorUnit to AT_ATYPE[(Integer A)]
          • Else - Actions
  • //now to check armor type you would do this:
  • Set AT = (Level of ARMOR_TYPE_ABILITY for (the relevant unit))
  • If (All conditions are true) then do (Then actions) else do (Else actions)
    • If - Conditions
      • Or - Any Conditions are true
        • Conditions
          • AT equal to AT_HEAVY
          • AT equal to AT_FORTIFIED
          • AT equal to AT_MAGIC
    • Then - Actions
      • //do whatever, this is just an example of how you can check; there are other ways to optimize a check depending on what you want to do
    • Else - Actions
This would be a good use of a hashtable, just for reference.
 
Last edited:
Level 12
Joined
Jul 5, 2014
Messages
551
Chaosium's suggestion requires no JASS, just a reasonable amount of mucking with the Unit Editor. And you do have to remember to update/change the abilities if you change the armor type of a unit (or if it can transform or something).

You can even automate some of this by using a single ability for this and then manipulating its level to represent the different armor types. Every time a unit enters the map check if it has this ability already; if not add it and set the correct level. You can make a parallel array of unit-types and integers (representing armor type as a level) to automatically assign them properly:
  • Events
    • Time - Elapsed game-time is 0.50 seconds
  • Conditions
  • Actions
    • Set AT_NORMAL = 1
    • Set AT_HEAVY = 2
    • Set AT_DIVINE = 3 //or whatever
    • //...
    • Set AT_FLESH = 8
    • -------- --------
    • Set AT_COUNT = (AT_COUNT + 1)
    • Set AT_UTYPE[AT_COUNT] = Footman //unit-type array
    • Set AT_ATYPE[AT_COUNT] = AT_NORMAL //integer-array holding armor type info
    • -------- --------
    • Set AT_COUNT = (AT_COUNT + 1)
    • Set AT_UTYPE[AT_COUNT] = Peasant
    • Set AT_ATYPE[AT_COUNT] = AT_FLESH
    • -------- --------
    • Set AT_COUNT = (AT_COUNT + 1)
    • Set AT_UTYPE[AT_COUNT] = Knight
    • Set AT_ATYPE[AT_COUNT] = AT_HEAVY
    • //etc. for all relevant unit-types
    • -------- --------
    • //this avoids code duplication by just running the trigger for all units that were preplaced and thus never 'enter' the map to fire the trigger themselves
    • //instead you would have to have a copy of the trigger actions here too inside of the unit group loop
    • Trigger - Turn on THE_ENTERS_TRIGGER <gen>
    • Custom script: set bj_wantDestroyGroup = true
    • Unit Group - Pick every unit in (Units in (Playable Map Area)) and do (Actions)
      • Loop - Actions
        • Set ArmorUnit = (Picked Unit)
        • Trigger - Run THE_ENTERS_TRIGGER <gen> (ignoring conditions)
  • Events
    • Unit - A unit enters (Playable Map Area)
  • Conditions
    • (Level of ARMOR_TYPE_ABILITY for (Triggering Unit)) equal to 0
  • Actions
    • If (All conditions are true) then do (Then actions) else do (Else actions)
      • If - Conditions
        • (Triggering Unit) not equal to (No Unit) //if TU exists the trigger wasn't manually run so we can update the variable safely
      • Then - Actions
        • Set ArmorUnit = (Triggering Unit)
      • Else - Actions
    • Set UT = (Unit-type of ArmorUnit)
    • For each (Integer A) from 1 to AT_COUNT do (Actions)
      • Loop - Actions
        • If (All conditions are true) then do (Then actions) else do (Else actions)
          • If - Conditions
            • UT equal to AT_UTYPE[(Integer A)]
          • Then - Actions
            • Unit - Add ARMOR_TYPE_ABILITY to ArmorUnit
            • Unit - Set level of ARMOR_TYPE_ABILITY for ArmorUnit to AT_ATYPE[(Integer A)]
          • Else - Actions
  • //now to check armor type you would do this:
  • Set AT = (Level of ARMOR_TYPE_ABILITY for (the relevant unit))
  • If (All conditions are true) then do (Then actions) else do (Else actions)
    • If - Conditions
      • Or - Any Conditions are true
        • Conditions
          • AT equal to AT_HEAVY
          • AT equal to AT_FORTIFIED
          • AT equal to AT_MAGIC
    • Then - Actions
      • //do whatever, this is just an example of how you can check; there are other ways to optimize a check depending on what you want to do
    • Else - Actions
This would be a good use of a hashtable, just for reference.
The problem is that without direct reference, that ability would require massive triggering. Tracking armor type would be extensive enough but it was meant to also consider the value. And tracking the value between 0-20 with changes like upgrades would take like half the time I spent on the map so far.
 
Level 10
Joined
Jan 26, 2019
Messages
90
Just use only green armor via Custom Stats System, you will have to give up all the standard abilities that affect armor, but you can know exactly how much armor a unit has.
You won't find a perfect solution anyway.

What is the problem with using the function suggested above - GetUnitArmor, you just need to copy one trigger to yourself and you can use a new function, a similar function was previously built into ydwe.
It has some drawbacks, but this is the simplest option that can be done in just a minute.
 
Level 12
Joined
Jul 5, 2014
Messages
551
Just use only green armor via Custom Stats System, you will have to give up all the standard abilities that affect armor, but you can know exactly how much armor a unit has.
You won't find a perfect solution anyway.

What is the problem with using the function suggested above - GetUnitArmor, you just need to copy one trigger to yourself and you can use a new function, a similar function was previously built into ydwe.
It has some drawbacks, but this is the simplest option that can be done in just a minute.
I need the armor modifying abilities.

GetUnitArmor needs some vJass related stuff too which not exactly a minute. I know nothing about that stuff and one aspect of a single skill doesn't worth downloading an entire new system.
 
Level 12
Joined
Jul 5, 2014
Messages
551
Yes, it was a little over a minute
In ydwe pk you wouldn’t even have to do anything, just use the gui function.
I have no idea what the video is about. I see a bunch of high armors which I'm not sure how it relates to my case. Plus the comment section of the GetUnitArmor mentions a number of issues. By now, I redesigned the spell to deal HP-related damage and identify a few very high armored units through a dummy ability.
 
Level 10
Joined
Jan 26, 2019
Messages
90
I have no idea what the video is about. I see a bunch of high armors which I'm not sure how it relates to my case. Plus the comment section of the GetUnitArmor mentions a number of issues. By now, I redesigned the spell to deal HP-related damage and identify a few very high armored units through a dummy ability.
You asked about how to get the amount of armor, and now you say that you don’t understand how getting the amount of armor applies to your case.
You also watched a detailed video on how to import and use this system, but you claim that you did not understand what the video was about, i wouldn’t be surprised if you didn’t even notice that when you select a unit, its armor amount is displayed to the chat.
Anyway, this was the last time i answer you, i already understood everything after your answer about leaks
 
Level 12
Joined
Jul 5, 2014
Messages
551
You asked about how to get the amount of armor, and now you say that you don’t understand how getting the amount of armor applies to your case.
You also watched a detailed video on how to import and use this system, but you claim that you did not understand what the video was about, i wouldn’t be surprised if you didn’t even notice that when you select a unit, its armor amount is displayed to the chat.
Anyway, this was the last time i answer you, i already understood everything after your answer about leaks
Sorry, I was more focused on the clicked unit as there was absolutely no explanation of the super fast triggering that was going on that I missed the small text on the side. Which no doubt you did in attempt to cram it into the "one minute".

Feel free to assume anything about me because I overlook something in a self-challenge video or my "answer about leaks".
 
As I understand it, you want to make an ability more effective against tanky units, that does not require the amor amount, nor def-type. You only need the resulting damage reduction.
That damage reduction you can get, by dealing test damage, compare life lost & restore life. Then scale your abiility with the reduction as less dmg the test dealt as more you real damage deals. I think your test damage should be 100.
 
Level 12
Joined
Jul 5, 2014
Messages
551
As I understand it, you want to make an ability more effective against tanky units, that does not require the amor amount, nor def-type. You only need the resulting damage reduction.
That damage reduction you can get, by dealing test damage, compare life lost & restore life. Then scale your abiility with the reduction as less dmg the test dealt as more you real damage deals. I think your test damage should be 100.
It would have required def type because the original idea was that heavy armor units receive extra hp-scaling damage while others just receive base damage+10x of their armor. But it's no longer actual because due to the nuisance, I redesigned the ability to just give hp-scaling damage.
 
Top