hmm... there is one problem that makes this trigger pretty long.
You cannot order a unit to cast an ability from a variable normally I guess.
Anyway, this should work:
-
Ability Multicast
-
Events
-
Unit - A unit Starts the effect of an ability
-
Conditions
-
Actions
-
Custom script: set udg_TempReal[0] = GetGameTime()
-
Set TempUnit[0] = (Triggering unit)
-
Set TempInteger[0] = (Custom value of TempUnit[0])
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Level of Multicast for TempUnit[0]) Greater than 0
-
Multicast_CooldownTime[TempInteger[0]] Less than or equal to TempReal[0]
-
Or - Any (Conditions) are true
-
Conditions
-
(Ability being cast) Equal to Firebolt (Neutral Hostile)
-
(Ability being cast) Equal to Storm Bolt
-
(Ability being cast) Equal to Holy Light
-
(Ability being cast) Equal to Death Coil
-
Then - Actions
-
Else - Actions
-
-------- !!!!! Set Change in percentage here !!!!! --------
-
Set TempReal[1] = 15.00
-
Set TempReal[2] = (Random real number between 0.00 and 100.00)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
TempReal[1] Greater than or equal to TempReal[2]
-
Then - Actions
-
-------- set the new cooldown time --------
-
Set Multicast_CooldownTime[TempInteger[0]] = (TempReal[0] + 10.00)
-
-------- order unit to cast --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Ability being cast) Equal to Firebolt (Neutral Hostile)
-
Then - Actions
-
Unit - Order TempUnit[0] to Neutral - Firebolt (Target unit of ability being cast)
-
Skip remaining actions
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Ability being cast) Equal to Storm Bolt
-
Then - Actions
-
Unit - Order TempUnit[0] to Human Mountain King - Storm Bolt (Target unit of ability being cast)
-
Skip remaining actions
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Ability being cast) Equal to Holy Light
-
Then - Actions
-
Unit - Order TempUnit[0] to Human Paladin - Holy Light (Target unit of ability being cast)
-
Skip remaining actions
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Ability being cast) Equal to Death Coil
-
Then - Actions
-
Unit - Order TempUnit[0] to Undead Death Knight - Death Coil (Target unit of ability being cast)
-
Skip remaining actions
-
Else - Actions
-
Else - Actions
When a unit starts the effect of an ability, you check if that unit has Multicast.
You also check if the ability being cast is one of the supporting abilities (Firebolt, Storm Bolt, Holy Light and Death Coil in this case).
If not, you skip the remaining actions meaning the trigger will just stop.
Then you set TempReal[1] to the amount that you want your chance to be.
(15 in this example is 15% chance to double cast.)
TempReal[2] will be used to have a random number to make the chance calculation work.
If TempReal[1] is greater than TempReal[2], then the unit will be ordered to cast the ability again.
However this is where you have to make an If/Then/Else for every single ability that you support because you cannot load the order id from the ability.
You also set a global real variable to the current gametime + 10 (meaning 10 seconds), so when you cast another ability, it will also check if the current gametime is higher than that real.
You can use
Bribe's GUI Unit Indexer.
Also, create another trigger and call it "GTS System".
Convert it to custom text (Edit -> Convert to Custom Text).
Then remove all text inside it and replace it with this:
JASS:
library gtsSystem
globals
timer udg_GTS_Timer
real udg_GTS_Hours = 0.
endglobals
function GetGameTime takes nothing returns real
return 3600*udg_GTS_Hours + TimerGetElapsed(udg_GTS_Timer)
endfunction
function GameTimeWait takes real duration returns nothing
local timer t
local real timeRemaining
if duration > 0. then
set t = CreateTimer()
call TimerStart(t, duration, false, null)
loop
set timeRemaining = TimerGetRemaining(t)
exitwhen timeRemaining <= 0
if timeRemaining > bj_POLLED_WAIT_SKIP_THRESHOLD then
call TriggerSleepAction(0.1 * timeRemaining)
else
call TriggerSleepAction(bj_POLLED_WAIT_INTERVAL)
endif
endloop
call DestroyTimer(t)
set t = null
endif
endfunction
endlibrary
function GTS_Add_Hour takes nothing returns nothing
set udg_GTS_Hours = udg_GTS_Hours + 1.
endfunction
function InitTrig_GTS_System takes nothing returns nothing
set udg_GTS_Timer = CreateTimer()
call TimerStart(udg_GTS_Timer, 3600, true, function GTS_Add_Hour)
endfunction
If you havent gor
JNGP 2.0 yet, then I really suggest you to download it. (It is also required for this trigger.)
(Be aware that you have to save the map before testing.)