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

[Trigger] HELP! request "Gui MUI Armour system"

Status
Not open for further replies.
Level 5
Joined
Oct 8, 2010
Messages
134
Hi reader

I am currently working on a orpg and i need some help with an idea for a system.

the idea is that the amount of armour equals the damage reduced.
So for example; you have 10 armour and you take damage, then that damage will be reduced by 10 (but not below zero).

Could someone please help me with a GUI system for this, (MuI ofcourse)
and maybe create one so I can use it in my project (u get credits in my orpg)

My humble thanks:goblin_good_job:
Vlad727:goblin_yeah:
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
I created this kind of system once.

Create a dummy ability that does nothing. You can hide it with disabled spellbook or use Channel as base ability.
EDIT: Use Hardened Skin. It reduces damage by flat amount.

You can initialize every unit type like this:


  • Init Enemies
    • Events
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to *some unit type*)) and do (Actions)
        • Loop - Actions
          • Custom script: set udg_i1 = GetHandleId(GetEnumUnit() )
          • Custom script: call SaveStringBJ( "2", StringHash("defence") , udg_i1, udg_Enemy_Hash ) // Could be saved as integer
          • Custom script: call SaveStringBJ( "1", StringHash("attack") , udg_i1, udg_Enemy_Hash ) // Could be saved as integer
          • Custom script: call SaveStringBJ( "ATTACK_TYPE_NORMAL", StringHash("attack_type") , udg_i1, udg_Enemy_Hash )
          • Unit - Set level of *Armor ability* for (Picked unit) to 9
          • Trigger - Add to Show Damage <gen> the event (Unit - (Picked unit) Takes damage)


Then you can init damage/armor multiplier table:


Damage Types Armor Types
1 = Normal 1 = Light
2 = Pierce 2 = Medium
3 = Siege 3 = Heavy
4 = Magic 4 = Fortified
5 = Chaos 5 = Hero
6 = Spells 6 = Unarmored
7 = Hero

  • Init Damage Armor System
    • Events
    • Conditions
    • Actions
      • -------- [11] = Normal damage to light armor --------
      • Set Damage_Modifier[11] = 1.00
      • Set Damage_Modifier[12] = 1.50
      • Set Damage_Modifier[13] = 1.00
      • Set Damage_Modifier[14] = 0.70
      • Set Damage_Modifier[15] = 1.00
      • Set Damage_Modifier[16] = 1.00
      • -------- --Pierce damage-- --------
      • Set Damage_Modifier[21] = 2.00
      • Set Damage_Modifier[22] = 0.75
      • Set Damage_Modifier[23] = 1.00
      • Set Damage_Modifier[24] = 0.35
      • Set Damage_Modifier[25] = 0.50
      • Set Damage_Modifier[26] = 1.50
      • -------- --Siege damage-- --------
      • Set Damage_Modifier[31] = 1.00
      • Set Damage_Modifier[32] = 0.50
      • Set Damage_Modifier[33] = 1.00
      • Set Damage_Modifier[34] = 1.50
      • Set Damage_Modifier[35] = 0.50
      • Set Damage_Modifier[36] = 1.50
      • -------- --Magic damage-- --------
      • Set Damage_Modifier[41] = 1.25
      • Set Damage_Modifier[42] = 0.75
      • Set Damage_Modifier[43] = 2.00
      • Set Damage_Modifier[44] = 0.35
      • Set Damage_Modifier[45] = 0.50
      • Set Damage_Modifier[46] = 1.00
      • -------- --Chaos damage-- --------
      • Set Damage_Modifier[51] = 1.00
      • Set Damage_Modifier[52] = 1.00
      • Set Damage_Modifier[53] = 1.00
      • Set Damage_Modifier[54] = 1.00
      • Set Damage_Modifier[55] = 1.00
      • Set Damage_Modifier[56] = 1.00
      • -------- --Hero damage-- --------
      • Set Damage_Modifier[51] = 1.00
      • Set Damage_Modifier[52] = 1.00
      • Set Damage_Modifier[53] = 1.00
      • Set Damage_Modifier[54] = 0.50
      • Set Damage_Modifier[55] = 1.00
      • Set Damage_Modifier[56] = 1.00


Then you have damage detection, which calculates the correct damage.


  • Show Damage
    • Events
    • Conditions
    • Actions
      • Set u1 = (Triggering unit)
      • Set u2 = (Damage source)
      • -------- How much armor the targer has. Ability level 1 = 0 armor, level 2 = 1 armor and so on. --------
      • Set i1 = ((Level of *armor ability* for u1) - 1)
      • -------- Load defence type --------
      • Custom script: set udg_String1 = LoadStringBJ( StringHash("defence") , GetHandleId(udg_u1) , udg_Enemy_Hash )
      • -------- Load attack type --------
      • Custom script: set udg_String2 = LoadStringBJ( StringHash("attack") , GetHandleId(udg_u2) , udg_Enemy_Hash )
      • Set r1 = (Damage taken)
      • -------- Damage modifier --------
      • Custom script: set udg_r2 = udg_Damage_Modifier[ S2I( udg_String2 + udg_String1 ) ]
      • -------- Damage should be --------
      • Custom script: set udg_r3 = udg_r1 * udg_r2 - I2R( udg_i1 )
      • -------- If the modifier was greater than 1, deal more damage, if less than 1, give life back (reduce damage) --------
      • Custom script: if udg_r3 > udg_r1 then
      • Unit - Set life of u1 to ((Life of u1) - (r3 - r1))
      • Custom script: else
      • Custom script: if udg_r3 < udg_r1 then
      • Unit - Set life of u1 to ((Life of u1) + (r1 - r3))
      • Custom script: endif
      • Custom script: endif


Set Combat - Armor reduction in gameplay constants to 0.

I've used some custom scripts here, but all this can be done in GUI.
 
Last edited:
Level 5
Joined
Oct 8, 2010
Messages
134
whoa thx
I tried someshit and got something but....
i' m almost sure mine isn' t MUI.
Maybe a hashtable to fix this?
any suggestions for that?

BTW. the armour type doesn 't reduce anything it only tells you what your maximum armour type is "warriors can equip cloth,leather and mail, mage can only wear cloth)

as soon as i know how to post trigger i will give demo to show.
 
Level 5
Joined
Oct 8, 2010
Messages
134
And rather impossible in GUI. First of all you need a damage detection which GUI isn't meant for either, JASS is the key (or vJASS).

sry im not so into jass:goblin_jawdrop::goblin_boom:
I try to prove that it is possible to create some awsome stuff without jass.:ogre_haosis:
 
Level 5
Joined
Oct 8, 2010
Messages
134
I created this kind of system once.

Create a dummy ability that does nothing. You can hide it with disabled spellbook or use Channel as base ability.
EDIT: Use Hardened Skin. It reduces damage by flat amount.

You can initialize every unit type like this:


  • Init Enemies
    • Events
    • Conditions
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to *some unit type*)) and do (Actions)
        • Loop - Actions
          • Custom script: set udg_i1 = GetHandleId(GetEnumUnit() )
          • Custom script: call SaveStringBJ( "2", StringHash("defence") , udg_i1, udg_Enemy_Hash ) // Could be saved as integer
          • Custom script: call SaveStringBJ( "1", StringHash("attack") , udg_i1, udg_Enemy_Hash ) // Could be saved as integer
          • Custom script: call SaveStringBJ( "ATTACK_TYPE_NORMAL", StringHash("attack_type") , udg_i1, udg_Enemy_Hash )
          • Unit - Set level of *Armor ability* for (Picked unit) to 9
          • Trigger - Add to Show Damage <gen> the event (Unit - (Picked unit) Takes damage)


Then you can init damage/armor multiplier table:


Damage Types Armor Types
1 = Normal 1 = Light
2 = Pierce 2 = Medium
3 = Siege 3 = Heavy
4 = Magic 4 = Fortified
5 = Chaos 5 = Hero
6 = Spells 6 = Unarmored
7 = Hero

  • Init Damage Armor System
    • Events
    • Conditions
    • Actions
      • -------- [11] = Normal damage to light armor --------
      • Set Damage_Modifier[11] = 1.00
      • Set Damage_Modifier[12] = 1.50
      • Set Damage_Modifier[13] = 1.00
      • Set Damage_Modifier[14] = 0.70
      • Set Damage_Modifier[15] = 1.00
      • Set Damage_Modifier[16] = 1.00
      • -------- --Pierce damage-- --------
      • Set Damage_Modifier[21] = 2.00
      • Set Damage_Modifier[22] = 0.75
      • Set Damage_Modifier[23] = 1.00
      • Set Damage_Modifier[24] = 0.35
      • Set Damage_Modifier[25] = 0.50
      • Set Damage_Modifier[26] = 1.50
      • -------- --Siege damage-- --------
      • Set Damage_Modifier[31] = 1.00
      • Set Damage_Modifier[32] = 0.50
      • Set Damage_Modifier[33] = 1.00
      • Set Damage_Modifier[34] = 1.50
      • Set Damage_Modifier[35] = 0.50
      • Set Damage_Modifier[36] = 1.50
      • -------- --Magic damage-- --------
      • Set Damage_Modifier[41] = 1.25
      • Set Damage_Modifier[42] = 0.75
      • Set Damage_Modifier[43] = 2.00
      • Set Damage_Modifier[44] = 0.35
      • Set Damage_Modifier[45] = 0.50
      • Set Damage_Modifier[46] = 1.00
      • -------- --Chaos damage-- --------
      • Set Damage_Modifier[51] = 1.00
      • Set Damage_Modifier[52] = 1.00
      • Set Damage_Modifier[53] = 1.00
      • Set Damage_Modifier[54] = 1.00
      • Set Damage_Modifier[55] = 1.00
      • Set Damage_Modifier[56] = 1.00
      • -------- --Hero damage-- --------
      • Set Damage_Modifier[51] = 1.00
      • Set Damage_Modifier[52] = 1.00
      • Set Damage_Modifier[53] = 1.00
      • Set Damage_Modifier[54] = 0.50
      • Set Damage_Modifier[55] = 1.00
      • Set Damage_Modifier[56] = 1.00


Then you have damage detection, which calculates the correct damage.


  • Show Damage
    • Events
    • Conditions
    • Actions
      • Set u1 = (Triggering unit)
      • Set u2 = (Damage source)
      • -------- How much armor the targer has. Ability level 1 = 0 armor, level 2 = 1 armor and so on. --------
      • Set i1 = ((Level of *armor ability* for u1) - 1)
      • -------- Load defence type --------
      • Custom script: set udg_String1 = LoadStringBJ( StringHash("defence") , GetHandleId(udg_u1) , udg_Enemy_Hash )
      • -------- Load attack type --------
      • Custom script: set udg_String2 = LoadStringBJ( StringHash("attack") , GetHandleId(udg_u2) , udg_Enemy_Hash )
      • Set r1 = (Damage taken)
      • -------- Damage modifier --------
      • Custom script: set udg_r2 = udg_Damage_Modifier[ S2I( udg_String2 + udg_String1 ) ]
      • -------- Damage should be --------
      • Custom script: set udg_r3 = udg_r1 * udg_r2 - I2R( udg_i1 )
      • -------- If the modifier was greater than 1, deal more damage, if less than 1, give life back (reduce damage) --------
      • Custom script: if udg_r3 > udg_r1 then
      • Unit - Set life of u1 to ((Life of u1) - (r3 - r1))
      • Custom script: else
      • Custom script: if udg_r3 < udg_r1 then
      • Unit - Set life of u1 to ((Life of u1) + (r1 - r3))
      • Custom script: endif
      • Custom script: endif


Set Combat - Armor reduction in gameplay constants to 0.

I've used some custom scripts here, but all this can be done in GUI.

Nice idea with harden skin but how will i update the spell if heroes drop and equip all the time?
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Totally forgot that part of the system.

Each armor piece has an ability that grants +armor so the green armor value bonus is the same as your total armor.

You must also set all armor values to an array, and item types to an array.

Set Armors[1] = Ũber armor
Set Armors[2] = Even more über armor

Set Armor_Values[1] = 1
Set Armor_Values[2] = 3

When you acquite an item, loop through the item type array, then you get the armor value based on the index.

You character has an integer stored which represents the total armor. You update it when you lose/acquire armor, and set the level of the armor ability based on that.

I've almost completed map 1 of a campaign that uses this system, and it does work.
 
Level 5
Joined
Oct 8, 2010
Messages
134
Totally forgot that part of the system.

Each armor piece has an ability that grants +armor so the green armor value bonus is the same as your total armor.

You must also set all armor values to an array, and item types to an array.

Set Armors[1] = Ũber armor
Set Armors[2] = Even more über armor

Set Armor_Values[1] = 1
Set Armor_Values[2] = 3

When you acquite an item, loop through the item type array, then you get the armor value based on the index.

You character has an integer stored which represents the total armor. You update it when you lose/acquire armor, and set the level of the armor ability based on that.

I've almost completed map 1 of a campaign that uses this system, and it does work.

cool
would you mind if I used that?
just post the trigger in a map so i can test it and see for my self, If you mind ofcourse...

just one last question...
does your armour system also work for creeps? just to be sure
 
Level 15
Joined
Oct 18, 2008
Messages
1,588
Maker-nice system! :) But I think your trigger is a bit messy for only-GUI ppl, and I could solve it fully in GUI (yeah, would get the same results, so anyway, nice work! :) Mine would like: Unit-type array, 3 real arrays (min/max dmg&def) but I prefer this because I can avoid custom scripts :D)

But to the point: +rep for you :D
 
Level 5
Joined
Oct 8, 2010
Messages
134
make sure units get kill credit, this can either be done by making unit damage unit a certain amount or by using an additional exp system.

What exacly do you mean with ''credit''
Is is like a floating-text wich shows the amount of damage dealt?
Or is it a floating-text wich shows the amount of xp gained?

Explain it a bit.....
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
When a unit A deals damage to unit B, leading to unit B's death, then A is marked as the killer and he gets exp and is the Killing Unit (event response).

In that system, one must not use "set life of unit to life of unit - x", one must use " unit - damage target ( chaos, universal for full damage). And turn off/on the trigger so it doesn't cause an infinite loop.
 
Level 5
Joined
Oct 8, 2010
Messages
134
BTW ''Maker''
does your system also support armour increasing/decreasing skills?

if not, it would mean that you need a trigger to check the armour value every second (better less).

just wondered about that last night.
 
Level 5
Joined
Oct 8, 2010
Messages
134
so normal armour reduction spells (acidbomb from alchemist) wont work unless I trigger them...Correct?
 
Level 3
Joined
Dec 9, 2009
Messages
35
You can try to use my system of armor detection. And then you create spell Hardened Skin and make it ex. 1lvl-1 damage reduces, 2lvl-2 damage reduces,... and so on. Set the maximum level to ability to maximum armor some unit can have. Set normal and pierce damage deal 100% to all armor types. Then every second set level of ability to unit armor.
Note : this won't work for magic attack, but in basic warcraft 3 magic attack is not reduced by armor i think. Also this does not work for negative armor.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,192
Or the maker could advance to Starcraft II where the armor system defaults to this functionality.

Anyway, GUI is too inefficent to properly execute such a fundimental system. As this will run often you need to make sure it is as efficent and leakless as possible. Problem is GUI and leakless are muturally exclussive as many GUI actions leak local handle indexes.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,192
Tools like vexorian's optimizer can combat the GUI leaks by replacing the function calls with custom function calls which do not leak.

However this still does not make up for the unefficent coding that GUI automatically generates. Additionally GUI does not give you as good flow control as you have access to with pure JASS code so many optimizations are unavailbe to GUI.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
EDIT: Revising the system.

Here's the system. I posted it to the OP a few days ago.

It's GUI, I may release it even and create a JASS version.

The map is protected.

Hit ESC to create a creep unit on the grass to your right. You can attack your own units, and use Blizzard on own units too.
 
Last edited:
Status
Not open for further replies.
Top