how do you get a spell cooldown for like 30 seconds or 5 minutes? if some one could explain and give a demo that would be greatly appreciated.
None.
We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch
You can't block a unit's spells (or special abilities) if it has the energy to cast them. Spells usually have a built in cooldown of something near a second which cannot be changed.
If you want to prevent a unit from casting spells you would need to set its energy to 0 and set it to any desired amount of energy after your custom cooldown ended. Preserving the energy it had before setting it to 0 is not possible.
The problem here is to detect when a player has cast a spell. This is usually not possible. Exceptions are Disruption Web and Dark Swarm.
But if you talk about custom spells like in rpgs (e.g. hallucinations created for the hero when he trains a marine in his spell barracks) implementing a cooldown is not hard to do.
When a spell is cast set a
death counter to for example
15 to have a cooldown of
30 game seconds when not using hyper triggers.
Have another trigger always subtract 1 from that
counter.
Then make 2 triggers
1) that casts the spell if the
counter is
02) that removes the Marine (or w/e) and gives the player his money/mana back when the
counter is
at least 1.
Agreed, the cooldowns of spells imbedded into units is not changable (that is playable on battle.net).
For custom triggers, there is a method to have a counter with hyper triggers, but it requires you have a resource open only for the use (rather it be caster's slot ore/gas or a computer's ore/gas slot).
In the condition list for the spell trigger add "'switch 99' is set"
In the action list for the spell trigger add "clear 'switch 99'"
In the same action list add "however minerals to the slot/player of your choosing"
In the same action list cast add "set 'switch 100'"
Make another trigger...
[players]
Use the player slot you planned on using for minerals.
[conditions]
-switch '100 is set'
[Actions]
-subtract 1 ore/gas for current player
-preserver trigger
And another trigger
[players]
Use the player slot you planned on using for minerals.
[conditions]
-switch '100 is set'
-Current player accumulates 0 ore/gas
[actions]
-clear 'switch 100'Or if you want your map to have hyper triggers as much as possible, you may give your hyper triggers a condition of a switch, and toggle that switch as you need to use timers. Though a duration as long as that toggling probably won't be viable.
None.
You don't have to use ore/gas for counter waits, death counts are much easier because there are so many unused units.
A hypertrigger executes about eleven actions per second.
None.
We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch
You don't have to use ore/gas for counter waits, death counts are much easier because there are so many unused units.
Yeah... your (@ZugZugZealot) method seems very complicated compared to what I suggested.
Ofc you
could add minerals or gas to show the player how long he has to wait but thats optional.
If your minerals are already used for another purpose you could make a square where 15 units are created on spell casting and remove 1 of them everytime a death counters is subtracted. Again that would only be for the visual and thus is optional.
A hypertrigger executes about eleven actions per second.
It's quite exactly 12 counts per real time second (Lag-free, Speed 7) and 8 counts per ingame second.
Conditions:
Current Player has suffered exactly 0 deaths of Independant Command Center(or otherwise unused unit)
(Other Conditions, i.e. accumulates 100 vespene gas)
Actions:
Spell Actions
Add 24 deaths of Independant Command Center for Current Player
Preserve Trigger
Conditions:
Current Player has suffered at least 1 deaths of Independant Command Ceneter
Actions:
Subtract 1 death of Independant Command Center for Current Player
Preserve trigger
With hyper triggers, this will be a 2 second cooldown, and without hyper's this will be 24 seconds.
None.