• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] HashTable stack system problem!!!

Status
Not open for further replies.
Level 5
Joined
Nov 17, 2010
Messages
28
Hello people, I'm new hash tables, and I have no idea todabia quite complex on I can do.

On this map I want to make a system of accumulation, but as you can see is bugged and no longer hurt.

:vw_sad:

PLEASE HELPME


  • Attack
    • Events
      • Unit - A unit is attacked
    • Conditions
      • ((Attacking unit) is in (Units owned by Player 1 (red))) Equal to True
    • Actions
      • Set Attacking = (Attacking unit)
      • Set Attacked = (Attacked unit)
      • Set Damage = 2.00 in Set
      • Special Effect - Create a special effect attached to the chest of (Attacked unit) using Abilities\Spells\Other\BreathOfFire\BreathOfFireDamage.mdl
      • Set Effect = (Last created special effect)
      • Set Time = 0.00
      • Set Boolean = True
      • Set Attacks = (Attacks + 1)
      • Hash table - Save Handle OfAttacking as 0 of (Key (Attacked unit)) in HashTable
      • Hash table - Save Handle OfAttacked as 1 of (Key (Attacked unit)) in HashTable
      • Hash table - Save Damage as 2 of (Key (Attacked unit)) in HashTable
      • Hash table - Save as OfEffect Handle 3 of (Key (Attacked unit)) in HashTable
      • Hash table - Save Time as 4 of (Key (Attacked unit)) in HashTable
      • Hash table - Save Boolean as 5 of (Key (Attacked unit)) in HashTable
      • Hash table - Save Attacks as 6 of (Key (Attacked unit)) in HashTable
      • If (All Conditions Are True) then do (Then Actions) else do (Else Actions)
        • If: Conditions
          • (Group is empty) Equal to True
        • Then: Actions
          • Trigger - Turn on Damage <gen>
        • Other: Actions
      • Unit Group - Add to Group Attacked
  • Damage
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick Every unit in Group and do (Actions)
        • Loop: Actions
          • Set Attacking = (Load 0 of (Key (Picked unit)) in HashTable)
          • Set Attacked = (Load 1 of (Key (Picked unit)) in HashTable)
          • Set Damage = (Load 2 of (Key (Picked unit)) from HashTable)
          • Set Effect = (Load 3 of (Key (Picked unit)) in HashTable)
          • Set Time = (Load 4 of (Key (Picked unit)) from HashTable)
          • Set Boolean = (Load 5 of (Key (Picked unit)) from HashTable)
          • Set Attacks = (Load 6 of (Key (Picked unit)) from HashTable)
          • If (All Conditions Are True) then do (Then Actions) else do (Else Actions)
            • If: Conditions
              • Time Less than 5.00
            • Then: Actions
              • Set Time = (Time + 1.00)
              • Unit - Cause Attacked Attacking to damage, dealing (Damage x (Real (Attacks))) damage "type of attack HÃ © roe and Damage type Normal
            • Other: Actions
              • Special Effect - Destroy Effect
              • Unit Group - Remove from Group Attacked
      • If (All Conditions Are True) then do (Then Actions) else do (Else Actions)
        • If: Conditions
          • (Group is empty) Equal to True
        • Then: Actions
          • Trigger - Turn off (This trigger)
        • Other: Actions


:vw_wtf:
 

Attachments

  • test.w3x
    10.5 KB · Views: 66
Level 37
Joined
Mar 6, 2006
Messages
9,240
I improved it a bit:

*Now there can be only one special effect on a unit
*Flushes the child hashtable
*Doesn't save the unit for itself. There's no need, the attacked is the picked unit.
*Only loads the effect when neede. The separete load action is still unnecessary, it could be combined with the destroy action.
*Correctly updates the time
*Moved the group empty -check to correct place

http://www.hiveworkshop.com/forums/pastebin.php?id=svo3iv
 
Status
Not open for further replies.
Top