Hashtable problem

ultimate11

Active Member
Reaction score
25
So i have some doubts with hashtable use on buildings.It seems that hashtable dont save data corectly when use triggering unit (building).
whats my problem? lets start.
i have some towers.when a tower kill a unit he gain 4 ability of different type (water..fire etc).So when tower start an abiliity for ex fire ability all thoose ability are removed and saved variable fire = fire + 1 in hashtable.
Trigger:
  • Skill learn
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to Ele_ab[1]
          • (Ability being cast) Equal to Ele_ab[2]
          • (Ability being cast) Equal to Ele_ab[3]
          • (Ability being cast) Equal to Ele_ab[4]
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Ele_ab[1]
        • Then - Actions
          • Set Fire = (Load 1 of (Key (Triggering unit)) from Table)
          • Set Fire = (Fire + 1)
          • Hashtable - Save Fire as 1 of (Key (Triggering unit)) in Table
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Ele_ab[2]
        • Then - Actions
          • Set Water = (Load 2 of (Key (Triggering unit)) from Table)
          • Set Water = (Water + 1)
          • Hashtable - Save (Water + 1) as 2 of (Key (Triggering unit)) in Table
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Ele_ab[3]
        • Then - Actions
          • Set Air = (Load 3 of (Key (Triggering unit)) from Table)
          • Set Air = (Air + 1)
          • Hashtable - Save Air as 3 of (Key (Triggering unit)) in Table
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Ele_ab[4]
        • Then - Actions
          • Set Earth = (Load 4 of (Key (Triggering unit)) from Table)
          • Set Earth = (Earth + 1)
          • Hashtable - Save Earth as 4 of (Key (Triggering unit)) in Table
        • Else - Actions
      • -------- Getting ability code --------
      • If (Fire Greater than 0) then do (Set String_read[1] = (String(1))) else do (Set String_read[1] = <Empty String>)
      • If (Water Greater than 0) then do (Set String_read[2] = (String(2))) else do (Set String_read[2] = <Empty String>)
      • If (Air Greater than 0) then do (Set String_read[3] = (String(3))) else do (Set String_read[3] = <Empty String>)
      • If (Earth Greater than 0) then do (Set String_read[4] = (String(4))) else do (Set String_read[4] = <Empty String>)
      • Set String_read[5] = (String_read[1] + (String_read[2] + (String_read[3] + String_read[4])))
      • Set AB_code[1] = (Load 5 of (Key (Triggering unit)) from Table)
      • Set AB_code[2] = (Integer(String_read[5]))
      • -------- add/remove ab --------
      • Set Skill_points = ((Load 7 of (Key (Triggering unit)) from Table) - 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Skill_points Equal to 0
        • Then - Actions
          • Set Fx_dummy = (Load 6 of (Key (Triggering unit)) in Table)
          • Unit Group - Remove Fx_dummy from Fx_gr
          • Unit - Remove Fx_dummy from the game
          • For each (Integer A) from 1 to 4, do (Actions)
            • Loop - Actions
              • Unit - Remove Ele_ab[(Integer A)] from (Triggering unit)
        • Else - Actions
          • Floating Text - Create floating text that reads (String(Skill_points)) above (Triggering unit) with Z offset 0.00, using font size 12.00, color ((Random real number between 1.00 and 100.00)%, (Random real number between 1.00 and 100.00)%, (Random real number between 1.00 and 100.00)%), and 0.00% transparency
          • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
          • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
          • Floating Text - Change the fading age of (Last created floating text) to 2.00 seconds
          • Floating Text - Change (Last created floating text): Disable permanence
      • Hashtable - Save Skill_points as 7 of (Key (Triggering unit)) in Table
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • AB_code[1] Not equal to AB_code[2]
        • Then - Actions
          • Unit - Remove T_ab[AB_code[1]] from (Triggering unit)
          • Unit - Add T_ab[AB_code[2]] to (Triggering unit)
          • Hashtable - Save AB_code[2] as 5 of (Key (Triggering unit)) in Table
        • Else - Actions
      • -------- Ruler element --------
      • Game - Display to (All players) the text: (String(AB_code[2]))

So this trigger should save at the end a code coresponding to an ability.Problem is that if i have just one tower work great,but if i use multiple tower it messed up.the ability code is saved for every tower that i have.Wtf i used (key(triggerring unit))
whats wrong?

EDIT: FIXED
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top