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

Timer and Hashtable

Status
Not open for further replies.
Level 9
Joined
Sep 28, 2004
Messages
365
**yeap, i used search and look through other threads, i even looked through Pharoah_'s earth fury spell.

But i still don't get how to save Timer into Hashtable and make it MUI. I tried and here is the code. Please let me know what is wrong. It is still not MUI.

**Please note that the spell i made can be simplified with locals or i can just use periodic timer. But the main point here is for me to understand Timer in a Hashtable. This is just a simple code i do to understand how to store Timer in hashtable but unfortunately it didn't work. :[

  • Delay Blast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Delay Blast
    • Actions
      • -------- ---------------------------------------------- --------
      • -------- Globals --------
      • -------- ---------------------------------------------- --------
      • Set db_Pos = (Target point of ability being cast)
      • Set db_DelayDuration = 3.00
      • -------- ---------------------------------------------- --------
      • -------- Spell --------
      • -------- ---------------------------------------------- --------
      • Unit - Create 1 Footman for Player 1 (Red) at db_Pos facing Default building facing degrees
      • Hashtable - Save Handle Ofdb_Timer as (Key time) of (Key (Last created unit)) in db_Table
      • Countdown Timer - Start (Load (Key time) of (Key (Last created unit)) in db_Table) as a One-shot timer that will expire in db_DelayDuration seconds
      • Set db_X = (X of db_Pos)
      • Set db_Y = (Y of db_Pos)
      • Hashtable - Save db_X as (Key x) of (Key (Last started timer)) in db_Table
      • Hashtable - Save db_Y as (Key y) of (Key (Last started timer)) in db_Table
      • Hashtable - Save Handle Of(Last created unit) as (Key dummy) of (Key (Last started timer)) in db_Table
      • -------- ---------------------------------------------- --------
      • -------- Clear --------
      • -------- ---------------------------------------------- --------
      • Custom script: call RemoveLocation(udg_db_Pos)
  • DB timer ends
    • Events
      • Time - db_Timer expires
    • Conditions
    • Actions
      • Set db_X = (Load (Key x) of (Key (Expiring timer)) from db_Table)
      • Set db_Y = (Load (Key y) of (Key (Expiring timer)) from db_Table)
      • Special Effect - Create a special effect at (Point(db_X, db_Y)) using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
      • Special Effect - Destroy (Last created special effect)
      • Unit - Kill (Load (Key dummy) of (Key (Expiring timer)) in db_Table)
      • Hashtable - Clear all child hashtables of child (Key (Expiring timer)) in db_Table
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
I don't think you can use timers like this.

I checked Pharaoh's Hoist of Seven Conundrums where he uses timers like this and it's not MUI.

I mean, you're starting the same timer over and over again. It's not a different timer you're using. When another unit starts the effect of the ability, you start the timer again, if the timer is already running it will be reset.
 
Last edited:
Level 13
Joined
Mar 16, 2008
Messages
941
Making timers MUI via hashtables is impossible (okay, there might be ways, but they suck). MUI GUI uses arrays in combination with timers, or hashtables if you want to attach data to units. This can be combined however, like adding all affected units in a group, loop through this group in the timer callback and use the hashtable to get the data from the unit.
 
Status
Not open for further replies.
Top