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

[Solved] Hash tables #2

Status
Not open for further replies.
First of all, I feel bad for posting so many threads. I'll try my best not to make a new thread for the next 3 days.
on topic: I created a custom spell based on shadow strike. For every second the target loses 75 HP, it takes 25 extra damage. lasts 8 seconds. (Ignore HashVoid, thats a diffirent spell)
  • Varibles
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set HashVoid = (Last created hashtable)
      • Hashtable - Create a hashtable
      • Set HashDevolate = (Last created hashtable)
  • Devolate spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Devolate
    • Actions
      • Set DevolateCaster = (Casting unit)
      • -------- Give time --------
      • Hashtable - Save 8 as 0 of (Key (Target unit of ability being cast)) in HashDevolate
      • -------- Save health --------
      • Hashtable - Save (Integer((Life of (Target unit of ability being cast)))) as 1 of (Key (Target unit of ability being cast)) in HashDevolate
      • Unit Group - Add (Target unit of ability being cast) to DevolateGroup
  • Devolate loop
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in DevolateGroup and do (Actions)
        • Loop - Actions
          • -------- Load time --------
          • Set Devolate_remaining = (Load 0 of (Key (Picked unit)) from HashDevolate)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Devolate_remaining Greater than 0
            • Then - Actions
              • -------- Load life --------
              • Set DevolateFactor = (Load 1 of (Key (Picked unit)) from HashDevolate)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Integer((Life of (Picked unit)))) Less than or equal to (DevolateFactor - 75)
                • Then - Actions
                  • -------- Save new life --------
                  • Hashtable - Save (Integer((Life of (Picked unit)))) as 1 of (Key (Target unit of ability being cast)) in HashDevolate
                  • Unit - Cause DevolateCaster to damage (Picked unit), dealing 25.00 damage of attack type Spells and damage type Normal
                  • Special Effect - Create a special effect attached to the orign of (Picked unit) using Abilities\Spells\Demon\DarkPortal\DarkPortalTarget.mdl
                  • Special Effect - Destroy (Last created special effect)
                • Else - Actions
            • Else - Actions
              • Unit Group - Remove (Picked unit) from DevolateGroup
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in HashDevolate
Once the target passed the 75 HP mark, it leads to a chain effect that damge the unit every 0.1 secs of game time. Any help please?
 
I recommend not creating so many hashtables.
One hastable can have 2^31 spaces inside it,which is very big enough for so many spells.
Also,because of the hashtable slot size,you can only have 256 hashtables per map.

On-Topic
  • Hashtable - Save (Integer((Life of (Picked unit)))) as 1 of (Key (Target unit of ability being cast)) in HashDevolate
This is the reason why it doesn't work.
You must use Key(Picked Unit).

Also,i think you do not care about computer interpretation speed so nvm what will i suggest
 
Status
Not open for further replies.
Top