• 🏆 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!
  • ✅ Time to vote for the top 3 models! The POLL for Hive's 6th HD Modeling Contest: Mechanical is now open! 📅 Poll close on July 16, 2024! 🔗 Cast your vote now!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

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