• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

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,240
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: 128
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