GUI stuff

Status
Not open for further replies.
You can't get it directly, but there is one way at least.

Create a dummy(1) unit with chaos attack type, then set attack backswing and damage point set to zero. Create another dummy(2) with zero armor and lots of health.

When a unit acquires/loses item, make a trigger run. Create that dummy(2) unit and a few of dummy(1) units around the dummy(2). Give the dummies(2) the same items the original unit has. Set the str, int and agility of dummies(2) to the str, int and agi of the units who manipulates items. Order the dummies(2) to attack dummy(1). After one second, remove the units.

You detect the damage with damage detection, and store the highest and lowest damage numbers.

I use this kind of system in a campaign that I'm making, and it works well.
 
There are a couple of downsides to this system.

1) Does not factor in the effect of buffs. I'll maybe try to add that next.
2) You need to create a dummy for each unit type which damage you want to detect.



  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: set udg_DamageHash = InitHashtable()
      • -------- -------------------------------------------------- --------
      • -------- The copies of each unit type that you want to detect the damage of --------
      • -------- -------------------------------------------------- --------
      • Set Dummies[0] = Paladin - (str)
      • Set Dummies[1] = Blademaster - (agi)
      • Set Dummies[2] = Blood Mage - (int)
      • -------- -------------------------------------------------- --------
      • -------- The target dummy's unit type --------
      • -------- -------------------------------------------------- --------
      • Set Dummies[100] = Paladin - (target)
      • -------- -------------------------------------------------- --------
      • -------- Unit types of units whose damage you want to detect --------
      • -------- -------------------------------------------------- --------
      • Set DamageAttackers[0] = Paladin
      • Set DamageAttackers[1] = Blademaster
      • Set DamageAttackers[2] = Blood Mage
      • -------- -------------------------------------------------- --------
      • -------- The coordinates of the spawn point of the dummy and attackers --------
      • -------- -------------------------------------------------- --------
      • Set SpawnCoordinates[0] = 0.00
      • Set SpawnCoordinates[1] = 0.00
      • -------- -------------------------------------------------- --------
      • -------- How many attackers per target are created --------
      • -------- -------------------------------------------------- --------
      • Set SpawnAmount = 8
      • -------- -------------------------------------------------- --------
      • -------- How many hit to get the damage amount --------
      • -------- -------------------------------------------------- --------
      • Set DamageHits = 100
      • -------- -------------------------------------------------- --------
      • -------- The max index of Dummies and DamageAttackers --------
      • -------- -------------------------------------------------- --------
      • Set DamageUnitTypes = 2
  • AcquireLose Items
    • Events
      • Unit - A unit Acquires an item
      • Unit - A unit Loses an item
    • Conditions
      • (Unit-type of (Triggering unit)) Not equal to Paladin - (str)
      • (Unit-type of (Triggering unit)) Not equal to Blademaster - (agi)
      • (Unit-type of (Triggering unit)) Not equal to Blood Mage - (int)
    • Actions
      • Set u1 = (Triggering unit)
      • Custom script: set udg_i1 = GetHandleId(udg_u1)
      • -------- -------------------------------------------------- --------
      • For each (Integer loopA) from 1 to SpawnAmount, do (Actions)
        • Loop - Actions
          • Custom script: set udg_u3 = LoadUnitHandle( udg_DamageHash , udg_i1 , udg_loopA )
          • Unit - Remove u3 from the game
      • -------- -------------------------------------------------- --------
      • Wait 0.00 seconds
      • -------- -------------------------------------------------- --------
      • Set u1 = (Triggering unit)
      • Custom script: set udg_i1 = GetHandleId(udg_u1)
      • -------- -------------------------------------------------- --------
      • Custom script: set udg_u2 = LoadUnitHandle( udg_DamageHash , udg_i1 , StringHash("dummy") )
      • -------- -------------------------------------------------- --------
      • Custom script: call SaveInteger(udg_DamageHash , udg_i1 , StringHash("hits") , 0 )
      • Custom script: call SaveReal(udg_DamageHash , udg_i1 , StringHash("TempMax") , 0 )
      • Custom script: call SaveReal(udg_DamageHash , udg_i1 , StringHash("TempMin") , 100000 )
      • -------- -------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • u2 Equal to No unit
        • Then - Actions
          • Custom script: set udg_u2 = CreateUnit( Player(15) , udg_Dummies[100] , udg_SpawnCoordinates[0] , udg_SpawnCoordinates[1] , 0 )
          • Custom script: call SaveUnitHandle( udg_DamageHash , GetHandleId(udg_u2) , StringHash("owner") , udg_u1 )
          • Custom script: call SaveUnitHandle( udg_DamageHash , udg_i1 , StringHash("dummy") , udg_u2 )
          • Custom script: call TriggerRegisterUnitEvent( gg_trg_Detect_Damage, udg_u2, EVENT_UNIT_DAMAGED )
        • Else - Actions
          • Unit - Unhide u2
      • -------- -------------------------------------------------- --------
      • For each (Integer loopC) from 0 to DamageUnitTypes, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of u1) Equal to DamageAttackers[loopC]
            • Then - Actions
              • Set UnitType = Dummies[loopC]
              • For each (Integer loopA) from 1 to SpawnAmount, do (Actions)
                • Loop - Actions
                  • Custom script: set udg_u3 = CreateUnit( Player(15) , udg_UnitType , udg_SpawnCoordinates[0] , udg_SpawnCoordinates[1] , 0 )
                  • Hero - Set u3 Hero-level to (Level of u1), Hide level-up graphics
                  • Hero - Modify Strength of u3: Set to (Strength of u1 (Exclude bonuses))
                  • Hero - Modify Agility of u3: Set to (Agility of u1 (Exclude bonuses))
                  • Hero - Modify Intelligence of u3: Set to (Intelligence of u1 (Exclude bonuses))
                  • For each (Integer loopB) from 1 to 6, do (Actions)
                    • Loop - Actions
                      • Hero - Create (Item-type of (Item carried by u1 in slot loopB)) and give it to u3
                  • Custom script: call SaveUnitHandle( udg_DamageHash , udg_i1 , udg_loopA , udg_u3 )
                  • Animation - Change u3's animation speed to 1000.00% of its original speed
                  • Unit - Order u3 to Attack u2
              • Skip remaining actions
            • Else - Actions
  • Detect Damage
    • Events
    • Conditions
    • Actions
      • Set r1 = (Damage taken)
      • Unit - Set life of (Triggering unit) to 100.00%
      • Custom script: set udg_i1 = GetHandleId( LoadUnitHandle( udg_DamageHash , GetHandleId( GetTriggerUnit() ) , StringHash ("owner") ) )
      • Custom script: set udg_i2 = LoadInteger( udg_DamageHash , udg_i1 , StringHash ("hits") )
      • Custom script: set udg_r2 = LoadReal( udg_DamageHash , udg_i1 , StringHash("TempMax") )
      • Custom script: set udg_r3 = LoadReal( udg_DamageHash , udg_i1 , StringHash("TempMin") )
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • r1 Greater than r2
        • Then - Actions
          • Custom script: call SaveReal(udg_DamageHash , udg_i1 , StringHash("TempMax") , udg_r1 )
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • r1 Less than r3
            • Then - Actions
              • Custom script: call SaveReal(udg_DamageHash , udg_i1 , StringHash("TempMin") , udg_r1 )
            • Else - Actions
      • Set i2 = (i2 + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • i2 Equal to DamageHits
        • Then - Actions
          • For each (Integer loopA) from 1 to SpawnAmount, do (Actions)
            • Loop - Actions
              • Custom script: set udg_u3 = LoadUnitHandle( udg_DamageHash , udg_i1 , udg_loopA )
              • Unit - Remove u3 from the game
          • Unit - Hide (Triggering unit)
          • Custom script: call SaveReal(udg_DamageHash , udg_i1 , StringHash("Max") , LoadReal( udg_DamageHash , udg_i1 , StringHash("TempMax") ) )
          • Custom script: call SaveReal(udg_DamageHash , udg_i1 , StringHash("Min") , LoadReal( udg_DamageHash , udg_i1 , StringHash("TempMin") ) )
        • Else - Actions
          • Custom script: call SaveInteger( udg_DamageHash , udg_i1 , StringHash("hits") , udg_i2 )


When the detection is done, select a unit and hit esc. It will show the min and max damages.

EDIT: New version here: https://www.hiveworkshop.com/forums/world-editor-help-zone-98/damage-multiboard-183741/
 
Last edited:
Status
Not open for further replies.
Back
Top