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

[Solved] [System] Custom Unit Stats System

Status
Not open for further replies.
Level 9
Joined
Aug 7, 2009
Messages
380
Hello,
I have triggers like these:

  • CS Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: set udg_CS_Hashtable = InitHashtable()
      • Set CS_ItemType = Crown of Kings +5
      • Set CS_CritDamage = 0.00
      • Set CS_BlockChance = 100.00
      • Set CS_EvasionChance = 0.00
      • Set CS_BlockDamage = 30.00
      • Trigger - Run CS Save <gen> (ignoring conditions)
  • CS Save
    • Events
    • Conditions
    • Actions
      • Custom script: set udg_CS_Key = udg_CS_ItemType
      • Set CS_PlusUp = (CS_PlusUp + 1)
      • Hashtable - Save CS_EvasionChance as CS_PlusUp of CS_Key in CS_Hashtable
      • Set CS_PlusUp = (CS_PlusUp + 1)
      • Hashtable - Save CS_BlockDamage as CS_PlusUp of CS_Key in CS_Hashtable
      • Set CS_PlusUp = (CS_PlusUp + 1)
      • Hashtable - Save CS_BlockChance as CS_PlusUp of CS_Key in CS_Hashtable
      • Set CS_PlusUp = (CS_PlusUp + 1)
      • Hashtable - Save CS_CritChance as CS_PlusUp of CS_Key in CS_Hashtable
      • Set CS_PlusUp = (CS_PlusUp + 1)
      • Hashtable - Save CS_CritDamage as CS_PlusUp of CS_Key in CS_Hashtable
      • Set CS_PlusUp = (CS_PlusUp + 1)
      • Hashtable - Save CS_SpellPower as CS_PlusUp of CS_Key in CS_Hashtable
      • Set CS_PlusUp = (CS_PlusUp + 1)
      • Hashtable - Save CS_SpellCritChance as CS_PlusUp of CS_Key in CS_Hashtable
      • Set CS_PlusUp = 0
      • Set CS_SpellPower = 0.00
      • Set CS_SpellCritChance = 0.00
      • Set CS_CritDamage = 0.00
      • Set CS_CritChance = 0.00
      • Set CS_BlockChance = 0.00
      • Set CS_EvasionChance = 0.00
      • Set CS_BlockDamage = 0.00
  • CS Get
    • Events
    • Conditions
    • Actions
      • Custom script: set udg_CS_Key = GetHandleId(udg_CS_Unit)
      • Set CS_PlusUp = (CS_PlusUp + 1)
      • Set CSC_EvasionChance = (Load CS_PlusUp of CS_Key from CS_Hashtable)
      • Set CS_PlusUp = (CS_PlusUp + 1)
      • Set CS_BlockDamage = (Load CS_PlusUp of CS_Key from CS_Hashtable)
      • Set CS_PlusUp = (CS_PlusUp + 1)
      • Set CSC_BlockChance = (Load CS_PlusUp of CS_Key from CS_Hashtable)
      • Set CS_PlusUp = (CS_PlusUp + 1)
      • Set CSC_CritChance = (Load CS_PlusUp of CS_Key from CS_Hashtable)
      • Set CS_PlusUp = (CS_PlusUp + 1)
      • Set CSC_CritDamage = (Load CS_PlusUp of CS_Key from CS_Hashtable)
      • Set CS_PlusUp = (CS_PlusUp + 1)
      • Set CSC_SpellPower = (Load CS_PlusUp of CS_Key from CS_Hashtable)
      • Set CS_PlusUp = (CS_PlusUp + 1)
      • Set CSC_SpellCritChance = (Load CS_PlusUp of CS_Key from CS_Hashtable)
      • Set CS_PlusUp = 0
  • Block
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • Set CS_Unit = DamageEventTarget
      • Trigger - Run CS Get <gen> (ignoring conditions)
      • Set DMGS_BlockChance = CSC_BlockChance
      • Set DMGS_BlockDamage = CSC_BlockDamage
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Random percentage) Less than or equal to (<=) DMGS_BlockChance
          • Then - Actions
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • DMGS_BlockDamage Less than (<) DamageEventAmount
              • Then - Actions
                • Set DMGS_BlockEvent = 1.00
                • Set DamageEventAmount = (DamageEventAmount - DMGS_BlockDamage)
              • Else - Actions
                • Set DamageEventAmount = 0.00
            • Set DMGS_BlockEvent = 2.00
          • Else - Actions
I'm wondering why my Crit Chance, Crit Damage, Evasion Chance,etc... all worked out except the block chance and block damage (after picking up the item). And of course, i have DamageModification system.
Hopefully someone can help me out.
Credits and rep shall come
 
Status
Not open for further replies.
Top