• 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.
  • 💡 We're thrilled to announce that our upcoming texturing contest is in the works, and we're eager to hear your suggestions! Please take this opportunity to share your ideas in this theme discussion thread for the Texturing Contest #34!
  • 🏆 Hive's 7th HD Modeling Contest: Icecrown Creature is now open! The frozen wastes of Icecrown are home to some of Azeroth’s most terrifying and resilient creatures. For this contest, your challenge is to design and model a HD 3D monster that embodies the cold, undead, and sinister essence of Icecrown! 📅 Submissions close on April 13, 2025. Don't miss this opportunity to let your creativity shine! Enter now and show us your frozen masterpiece! 🔗 Click here to enter!

How to do actions for the owner of an expiring timer?

Status
Not open for further replies.
Level 6
Joined
Jan 8, 2009
Messages
140
if i've got a timer array (1-12 for each player) how can i check which player's timer has expired?
 
Level 6
Joined
Jan 8, 2009
Messages
140
You need jass. Use a timer variable and do
JASS:
set udg_timer_variable = GetExpiredTimer()

and then check if timer_variable is equal to timer [x]
  • Events
    • Time - f_Timer1[1] expires
    • Time - f_Timer1[2] expires
    • Time - f_Timer1[3] expires
    • Time - f_Timer1[4] expires
    • Time - f_Timer1[5] expires
    • Time - f_Timer1[6] expires
    • Time - f_Timer1[7] expires
    • Time - f_Timer1[8] expires
    • Time - f_Timer1[9] expires
    • Time - f_Timer1[10] expires
    • Time - f_Timer1[11] expires
    • Time - f_Timer1[12] expires
  • Conditions
  • Actions
    • Custom script: set udg_tmpTimer = GetExpiredTimer()
    • For each (Integer loopA) from 1 to 12, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
          • Then - Actions
          • Else - Actions
i'm not sure how to check though? there's no timer conditions anywhere as far as i can see? Is there a way to set whatever number it is in the array to an int, then use it for actions?

EDIT:

am I on the right track? I've never used jass before lol
  • For each (Integer loopA) from 1 to 12, do (Actions)
    • Loop - Actions
      • Custom script: if udg_tmpTimer == udg_f_Timer1[loopA]
 
Level 6
Joined
Jan 8, 2009
Messages
140
yes but loop a should be ForIndexA or something. I cant check atm since im on my phone but you can search in the function list and im sure you will find it.

Or create a new trigger and do something random with integer A and convert to jass.
You are certainly close

If by forindexa you mean using a variable rather and integer a, it is a variable, i just named it loopa haha. can i do then then and else lines in custom script with gui inbetween?

i'd rather keep as much of it in gui as possible so if it can be avoided i don't want to convert it.
 
Level 6
Joined
Jan 8, 2009
Messages
140
Yes. That is working.
My bad on the loopa did not see xd

edit:
Dont forget, you need the endif after your gui actions.

thankyou i think it should work, I didn't get a compile error after adding endif.

  • Bobber
    • Events
      • Time - f_Timer1[1] expires
      • Time - f_Timer1[2] expires
      • Time - f_Timer1[3] expires
      • Time - f_Timer1[4] expires
      • Time - f_Timer1[5] expires
      • Time - f_Timer1[6] expires
      • Time - f_Timer1[7] expires
      • Time - f_Timer1[8] expires
      • Time - f_Timer1[9] expires
      • Time - f_Timer1[10] expires
      • Time - f_Timer1[11] expires
      • Time - f_Timer1[12] expires
    • Conditions
    • Actions
      • Custom script: set udg_tmpTimer = GetExpiredTimer()
      • For each (Integer loopA) from 1 to 12, do (Actions)
        • Loop - Actions
          • Set tmpPoint = (Position of f_Bobber[loopA])
          • Custom script: if udg_tmpTimer == udg_f_Timer1[udg_loopA] then
          • Set f_Catch[loopA] = True
          • Special Effect - Create a special effect at tmpPoint using Abilities\Spells\Other\CrushingWave\CrushingWaveDamage.mdl
          • Custom script: else
          • Custom script: endif
      • Custom script: call RemoveLocation(udg_tmpPoint)
looking okay to you?
 
Level 6
Joined
Jan 8, 2009
Messages
140
alright cool, one more quick question is there a jass function to kill a timer so it can't expire. either that or force expire it? would setting the timer to null do that? at the moment the timer can bug out and overlap if i cast before it's expired.

EDIT: tried nulling the timers but it doesn't stop them ><
 
Level 6
Joined
Jan 8, 2009
Messages
140
change this
  • Custom script: if udg_tmpTimer == udg_f_Timer1[loopA]
to this
  • Custom script: if udg_tmpTimer == udg_f_Timer1[bj_forLoopAIndex]

i'm not on my computer at the moment, but what exactly is bj_forLoopAIndex? is it referencing the for each integer a loop variable?
 
Level 6
Joined
Jan 8, 2009
Messages
140
The bj is loop integer A. When ur using it like this it's ok but the reason it's bad to use is whenever u use it in GUI actions it calls a function which returns the bj that's y it is slower to use than ur own integer

i am using my own integer, i named it loopA
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
Here's another option.

  • RevInit Copy 2
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Hash = (Last created hashtable)
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Custom script: if udg_RTIM[bj_forLoopAIndex] == null then
          • Custom script: set udg_RTIM[bj_forLoopAIndex] = CreateTimer()
          • Custom script: endif
          • Trigger - Add to RevRevive <gen> the event (Time - RTIM[(Integer A)] expires)
          • Custom script: call SaveInteger(udg_Hash, GetHandleId(udg_RTIM[bj_forLoopAIndex]), 0, bj_forLoopAIndex)
  • RevRevive
    • Events
    • Conditions
    • Actions
      • Custom script: set udg_i1 = LoadInteger(udg_Hash, GetHandleId(GetExpiredTimer()), 0)
 
Level 6
Joined
Jan 8, 2009
Messages
140
Here's another option.

  • RevInit Copy 2
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Hash = (Last created hashtable)
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Custom script: if udg_RTIM[bj_forLoopAIndex] == null then
          • Custom script: set udg_RTIM[bj_forLoopAIndex] = CreateTimer()
          • Custom script: endif
          • Trigger - Add to RevRevive <gen> the event (Time - RTIM[(Integer A)] expires)
          • Custom script: call SaveInteger(udg_Hash, GetHandleId(udg_RTIM[bj_forLoopAIndex]), 0, bj_forLoopAIndex)
  • RevRevive
    • Events
    • Conditions
    • Actions
      • Custom script: set udg_i1 = LoadInteger(udg_Hash, GetHandleId(GetExpiredTimer()), 0)

using that custom script will set i1 as the index of the expiring timer?
 
The one I thought was integer A was in the trigger action. U shouldn't use integer A it is slower and less efficient and u already know this. Y show other ppl the wrong way to do it ?

Also if u have a problem w my typing that's ur problem. Idc about the spelling. There's no reason to. If someone can't read it all they have to do is ask. So plz refrain from tryin to make fun of the way I type. It is honestly pathetic lol
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
U shouldn't use integer A it is slower and less efficient and u already know this. Y show other ppl the wrong way to do it ?

Using integer A is just fine. You can not even measure the speed difference between that an a custom integer. It is not a wrong way to do things.

Should I advice people to use jass instead of GUI because GUI is slower and "wrong". No, of course not.
 
Using integer A is just fine. You can not even measure the speed difference between that an a custom integer. It is not a wrong way to do things.

u cant see the speed difference but u can see the how much faster it causes u to hit the op-limit. which is explained in my tutorial its a simple test.

just create a unit in a loop and display the integer A.

in another trigger use a custom integer and display that integer.

u can then see how much faster u hit the op-limit. so it is inefficient and slower. anything that requires more processing is slower and less efficient.
 
Status
Not open for further replies.
Top