- Joined
- Jul 26, 2008
- Messages
- 1,009
Okay here's the spell description:
Each time you or any allied hero in range casts a spell, you have a chance to gain mana points back.
Now here's the trigger for the spell:
Now, because locals have to be at the top of the function, and because the if statement causes the function to split where RANDOM is, I have to convert it to JASS and place in a working IF function into the code.
For whatever reason, it criticals the game after the wait function. Doesn't even give a chance for the effect. Just criticals between .25 and 1.5 seconds after the spell is learned.
If someone knows how to make this more efficient as well, that'd be great. Any tips is appreciated.
Each time you or any allied hero in range casts a spell, you have a chance to gain mana points back.
Now here's the trigger for the spell:
-
Illuminaura
-
Events
- Unit - A unit Begins casting an ability
-
Conditions
-
Multiple ConditionsAnd - All (Conditions) are true
-
Conditions
- ((Triggering unit) has buff Illuminaura (lvl1)) Equal to (==) True
-
Conditions
-
Multiple ConditionsAnd - All (Conditions) are true
-
Actions
- Custom script: local integer random
- Custom script: set random = GetRandomInt(1, 100)
-
Wait 0.25 game-time seconds
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (random) Less than or equal to (<=) 25
-
Then - Actions
- Unit - Set mana of (Triggering unit) to ((Mana of (Triggering unit)) + (2.50 x (Real((random)))))
- Special Effect - Create a special effect attached to the origin of (Attacked unit) using Abilities\Spells\Human\DispelMagic\DispelMagicTarget.mdl
- Special Effect - Destroy (Last created special effect)
- Floating Text - Create floating text that reads (String((random))) above (Triggering unit) with Z offset 0.00, using font size 10.00, color (25.00%, 50.00%, 100.00%), and 0.00% transparency
- Floating Text - Change (Last created floating text): Disable permanence
- Floating Text - Set the velocity of (Last created floating text) to 10.00 towards 90.00 degrees
- Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
- Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
- Else - Actions
-
If - Conditions
-
Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Events
JASS:
function Trig_Illuminaura_Copy_Func001C takes nothing returns boolean
if ( not ( UnitHasBuffBJ(GetTriggerUnit(), 'Illu') == true ) ) then
return false
endif
return true
endfunction
function Trig_Illuminaura_Copy_Conditions takes nothing returns boolean
function Trig_Illuminaura_Copy_Func001C takes nothing returns boolean
if ( not ( UnitHasBuffBJ(GetTriggerUnit(), 'Illu') == true ) ) then
return false
endif
return true
endfunction
function Trig_Illuminaura_Copy_Conditions takes nothing returns boolean
if ( not Trig_Illuminaura_Copy_Func001C() ) then
return false
endif
return true
endfunction
function Trig_Illuminaura_Copy_Actions takes nothing returns nothing
local integer random
set random = GetRandomInt(1, 100)
call PolledWait( 0.25 )
if random <= 25 then
call SetUnitManaBJ( GetTriggerUnit(), ( GetUnitStateSwap(UNIT_STATE_MANA, GetTriggerUnit()) + ( 2.50 * I2R( (random)) ) ) )
call AddSpecialEffectTargetUnitBJ( "origin", GetAttackedUnitBJ(), "Abilities\\Spells\\Human\\DispelMagic\\DispelMagicTarget.mdl" )
call DestroyEffect( GetLastCreatedEffectBJ() )
call CreateTextTagUnitBJ( I2S( (random)), GetTriggerUnit(), 0, 10.00, 25.00, 50.00, 100.00, 0 )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 10.00, 90.00 )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 1.50 )
call SetTextTagFadepointBJ( GetLastCreatedTextTag(), 1.00 )
else
endif
endfunction
//===========================================================================
function InitTrig_Illuminaura_Copy takes nothing returns nothing
set gg_trg_Illuminaura_Copy = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Illuminaura_Copy, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Illuminaura_Copy, Condition( function Trig_Illuminaura_Copy_Conditions ) )
call TriggerAddAction( gg_trg_Illuminaura_Copy, function Trig_Illuminaura_Copy_Actions )
endfunction
For whatever reason, it criticals the game after the wait function. Doesn't even give a chance for the effect. Just criticals between .25 and 1.5 seconds after the spell is learned.
If someone knows how to make this more efficient as well, that'd be great. Any tips is appreciated.
Last edited: