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

Get timer array from starting event timer

Status
Not open for further replies.
Level 3
Joined
Apr 11, 2010
Messages
35
Hi guys,

I've got a short question:

I am doing a trigger that when a timer expires, the trigger is run and I want to use the timer's it's array integer (for example, when the expiring timer is MyTimer[1], it should use '1', if MyTimer[7], it should use '7') in the actions.
  • Events
    • Time - uniTimer[1] expires
    • Time - uniTimer[2] expires
    • Time - uniTimer[3] expires
    • Time - uniTimer[4] expires
    • Time - uniTimer[5] expires
    • Time - uniTimer[6] expires
    • .... all the way to ....
    • Time - uniTimer[12] expires
  • Conditions
  • Actions
    • Unit - Unpause (Load 1 in 1 in stunHash[X])
    • Special Effect - Destroy (Load 1 of 2 in stunHash[[X])
    • Hashtable - Clear stunHash[X]
Where X is suposed to be the array integer of the expiring timer.

But in the integer functions I can't find any function call that would return the array of the triggering variable.

Is there any way of doing this?
 
That is not pure MPI.
  • (Load 1 in 1 in stunHash[X])
I hate this type of script. Why don't you have some clear and decent value?

So, it should be like this. Let's say you fire the timer up:
  • Trigger0
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • For each (IntegerA) from 1 to 12, do (Actions)
      • Loop - Actions
        • Trigger - Add to Trigger2 <gen> the event (Timer - uniTimer[(IntegerA)] expires)
  • Trigger
  • Events
    • Unit - A unit starts the effect of an ability
  • Conditions
  • Actions
    • Countdown Timer - Start Timer[Player Number of (Owner of (Triggering unit))] as a one-shot timer that will expire in 10.00 seconds
    • Hashtable - Save (Triggering unit) as 0 of (Key(Last started timer)) in stunHash
    • Unit - Pause (Triggering unit)
    • Special Effect - Create a special effect on chest of (Triggering unit) using x.mdl
    • Hashtable - Save Handle of (Last created effect) as 1 of (Key(Last started timer)) in stunHash
  • Trigger2
  • Events
  • Conditions
  • Actions
    • Unit - Unpause (Load 0 of (Key(Expiring timer)) in stunHash)
    • Special Effect - Destroy (Load 1 of (Key(Expiring timer)) in stunHash)
    • Hashtable - Clear all child values of (Key(Expiring timer)) in stunHash
Hashtable - Clear stunHash: Do not use this action. Just clear the values of theobject you no longer want involved with the specified hashtable. The action you used clears every value of every object that it attached to it. So, if I cast a spell and the timer fires and after 2 seconds another unit casts it, the effect will end for both of us, when my 10.00 seconds expire, because every other related object is deleted from the Hashtable.

Note: Hashtables don't have to follow your MPI pattern. One hashtable can store 12 players at a time, just make sure you make your references right.
 
Level 3
Joined
Apr 11, 2010
Messages
35
Thanks, Pharaoh :)

I was going to use separate hashtable for every player, so that mess-up with more cast wouldn't happen. But your method seems more simple and better, and it seems it will work - I couldn't say that for my script :D
And that for each integer 1 - 12 add event, that's wonderful, I had done multiple events with copy&paste, this is much easier :)

Many thanks again, rep+
 
Status
Not open for further replies.
Top