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

Attack Speed detect.

Status
Not open for further replies.
Level 11
Joined
Dec 5, 2009
Messages
846
Hello. How can i detect attack speed? I have to create a timer or something like that and then count it in how fast the unit hits. But its hard. Can someone help me with this please?

Ty and advance!
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
Here you go.

One could improve the code a bit. But it works.

Do you want me to modify it somehow?


  • Attack
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Set u1 = (Attacking unit)
      • Custom script: set udg_i1 = GetHandleId(udg_u1)
      • Custom script: set udg_TempTimer = LoadTimerHandle( udg_hash , udg_i1 , StringHash("timer") )
      • Custom script: if udg_TempTimer == null then
      • Custom script: set udg_TimerIndex = udg_TimerIndex + 1
      • Custom script: call SaveTimerHandle( udg_hash , udg_i1 , StringHash("timer") , udg_Timer[udg_TimerIndex] )
      • Custom script: call SaveUnitHandle( udg_hash , GetHandleId( udg_Timer[udg_TimerIndex] ) , StringHash("unit") , udg_u1 )
      • Custom script: else
      • Custom script: if LoadBoolean( udg_hash , udg_i1 , StringHash("boolean") ) != false then
      • Custom script: set udg_r1 = TimerGetElapsed( LoadTimerHandle( udg_hash , udg_i1 , StringHash("timer") ) )
      • Game - Display to Player Group - Player 1 (Red) the text: (Attack interval was: + (String(r1)))
      • Custom script: endif
      • Custom script: endif
      • Custom script: call TimerStart( LoadTimerHandle( udg_hash , udg_i1 , StringHash("timer") ) , 30. , false , null )
      • Custom script: call SaveBoolean( udg_hash , udg_i1 , StringHash("boolean") , true )
  • Error
    • Events
      • Unit - A unit Is issued an order with no target
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order targeting an object
    • Conditions
    • Actions
      • Custom script: if LoadBoolean( udg_hash , udg_i1 , StringHash("boolean") ) == true then
      • Custom script: call SaveBoolean( udg_hash , udg_i1 , StringHash("boolean") , false )
      • Custom script: endif
 

Attachments

  • Attack_Speed_Detection.w3x
    24.9 KB · Views: 132
Level 11
Joined
Dec 5, 2009
Messages
846
It's very nice! But when i change anything in this map i can't test it. it just goes to the main page of TFT.
I got JNGP. I save map before test. Nothing works. Help please!


EDIT: I tested to remove the JASS script the trigger named "TimerUtils" and then it worked. So i don't need that trigger to use yours? Cuz as i said it worked without that JASS trigger
 
Status
Not open for further replies.
Top