• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Does Reforged has a method to force passive into cooldown?

Level 26
Joined
Sep 26, 2009
Messages
2,417
As far as I know Reforged does not have anything specifically for passives.
There is a new action "Unit - Start Unit Ability Cooldown" but it does not work for passives. Even if it did, I don't think the internal implementation of passives take cooldown into account (except for passives like Exhume Corpses, which by default use cooldown).

The resource you linked should work even on Reforged. But there is a potential issue because of the following:
JASS:
//inside Trig_Passive_Cooldown_System_Execute function
call SetPlayerAlliance(Player(14), GetOwningPlayer(udg_PCD_Unit), ALLIANCE_PASSIVE, true)
which I imagine was one of the neutral players in old WC3, but in Reforged this matches one of actual players.

Looking a bit deeper, the resource uses "Spell Shield" passive to display cooldown, but that spell's cooldown is shared globally. So if one unit triggers it, all the other do as well.
So in that respect Reforge does improve the situation because the action "Unit - Start Unit Ability Cooldown" affects only single unit.

You can use the following approach on Reforged:
  • have passive ability
  • have a dummy active ability which visually matches the passive and will be used to show cooldown
  • when passive should go on cooldown, replace it with the active dummy ability and use the "Unit - Start Unit Ability Cooldow" action to force it into cooldown.
  • You don't need to remove the passive ability from the unit, you can hide it using the "Unit - Disable Ability" action.

As for how to detect when cooldown ends - I don't think you have many options. You can either:
  • use standard indexing approach, where you track the cooldown in an integer array and have a loop trigger that runs every 0.1 seconds (in case its fine if there is slight inaccuracy in when you swap abilities back)
  • use same approach as in the resource you linked: managed timers
 
Level 40
Joined
Feb 27, 2007
Messages
5,091
Exhume Corpses is a far superior method to whatever is going on with spell shield there. You can detect when the cooldown is over because it will automatically cast again (which you can reset).


Ability field natives allow the cooldown to be dynamic as you desire.
 
Top