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

"refresh" variable in timer

Status
Not open for further replies.
Level 1
Joined
Oct 30, 2013
Messages
2
i would like to create a dot whose tick-interval is based on the intelligence of an unit, meaning if the intelligence of an unit increase, the dot should tick quicker

i've tried with the periodic event, but the problem is that you can't set variables into this event and if you use the "add trigger - event periodic timer", the variable will always stay the same, even if it changes inside the game

i also tried with the countdown timer, but there is still the problem that the variable doesn't change (if the intelligence of the unit increase, the dot should tick quicker, but it doesn't), pls can someone help me! :)
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
Instead of using periodic event, you can try this.

  • Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Set Caster = (Triggering unit)
      • Set Target = (Target unit of ability being cast)
      • Set Int = (Intelligence of Caster (Include bonuses))
      • Set MaxDuration = 10.00
      • Countdown Timer - Start ExecuteTimer as a One-shot timer that will expire in (100.00 / (Real(Int))) seconds
      • Set ElapsedTime = (ElapsedTime + (100.00 / (Real(Int))))


  • Periodic
    • Events
      • Time - ExecuteTimer expires
    • Conditions
    • Actions
      • Unit - Cause Caster to damage Target, dealing 40.00 damage of attack type Spells and damage type Normal
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ElapsedTime Greater than or equal to MaxDuration
        • Then - Actions
          • Countdown Timer - Pause ExecuteTimer
          • Set ElapsedTime = 0.00
        • Else - Actions
          • Set Int = (Intelligence of Caster (Include bonuses))
          • Countdown Timer - Start ExecuteTimer as a One-shot timer that will expire in (100.00 / (Real(Int))) seconds
          • Set ElapsedTime = (ElapsedTime + (100.00 / (Real(Int))))
1 second for 100 int
2 for 50 etc...
 
Status
Not open for further replies.
Top