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

Uncooperative hashtables

Status
Not open for further replies.
Level 7
Joined
May 11, 2010
Messages
278
Why is all returned values 0?
Dance is based on Channel.
I have created the hashtable.
DanceLevel, Dance Damage and AbilityDuration are Real variables.

  • Dance
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Dance (ChiKan)
    • Actions
      • Hashtable - Save (Level of Dance (ChiKan) for (Triggering unit)) as (Key dancelevel) of (Key (Target unit of ability being cast)) in AbilityTable
      • Set DanceLevel = (Load (Key dancelevel) of (Key (Target unit of ability being cast)) from AbilityTable)
      • Game - Display to (All players) the text: (Level of ability beeing cast is + (String(DanceLevel)))
      • Hashtable - Save 6.00 as (Key danceduration) of (Key (Target unit of ability being cast)) in AbilityTable
      • Unit Group - Add (Target unit of ability being cast) to ChiKanDanceGroup
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Dance Loop <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on Dance Loop <gen>
        • Else - Actions
  • Dance Loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in ChiKanDanceGroup and do (Actions)
        • Loop - Actions
          • Set AbilityDuration = (Load (Key danceduration) of (Key (Picked unit)) from AbilityTable)
          • Set DanceLevel = (Load (Key dancelevel) of (Key (Picked unit)) from AbilityTable)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • AbilityDuration Greater than 0.00
            • Then - Actions
              • Hashtable - Save (AbilityDuration - 1.00) as (Key danceduration) of (Key (Picked unit)) in AbilityTable
              • Game - Display to (All players) the text: (Level of Dance is + (String(DanceLevel)))
              • Set DanceDamage = ((Life of (Picked unit)) x (DanceLevel x 0.01))
              • Game - Display to (All players) the text: (Dance Damage is + (String(DanceDamage)))
              • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - DanceDamage)
            • Else - Actions
              • Unit Group - Remove (Picked unit) from ChiKanDanceGroup
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in ChiKanDanceGroup) Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
 
Level 7
Joined
May 11, 2010
Messages
278
still returns only zeroes.
I added messages to show name of "unit" and to show "number", they return correct strings.
String "Level of Dance for Triggering Unit" also returns the right number.

EDIT: I redesigned the trigger, and now it works. I changed the way damage was calculated and saved it as an initial value during the first trigger, rather than a varying value during the second one.
 
Last edited:
Status
Not open for further replies.
Top