HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Spell: Time Stop

01-30-2003, 07:53 AM#1
Darky28
Hi All

This is my Time Stop Spell. I abused tranquility spell to do it... the slk is edited so the tranquility spells last only half a second and heals nothing.. so you wont see any of its effect.

This first function is used by the trigger initializion... its the condition for the spell. In this case: If the ordered spell is "tranquility" then start the actions.

Code:
//================================================
// Trigger:       TimeStop
// Script Author: Darky26 <[email protected]>
// Info:          Stops the time for 15 Seconds
//                only caster can move freely
//================================================

function Trig_Time_Stop_Conditions takes nothing returns boolean
    return ( GetIssuedOrderIdBJ() == String2OrderIdBJ("tranquility") )
endfunction

This function is used later for the two UnitGroup parsing commands.... this condition selects all units on the whole map exept the caster. (ordered unit = caster)

Code:
function Trig_Time_Stop_AllUnits takes nothing returns boolean
    return ( GetOrderedUnit() != GetFilterUnit() )
endfunction

This function is used by the first UnitGroup parsing. It first set the animation speed of the parsed unit to Zero and then pauses the unit. So it looks like frozen.

Code:
function Trig_Time_Stop_PauseUnits takes nothing returns nothing
    call SetUnitTimeScalePercent( GetEnumUnit(), 0.00 )
    call PauseUnitBJ( true, GetEnumUnit() )
endfunction

This function is used by the second UnitGroup parsing. First, it restores the units animation speed to 100% and then unpauses the unit.

Code:
function Trig_Time_Stop_UnpauseUnits takes nothing returns nothing
    call SetUnitTimeScalePercent( GetEnumUnit(), 100.00 )
    call PauseUnitBJ( false, GetEnumUnit() )
endfunction

This is the main part of our script. It containes all the actions of the trigger.
first I disable the usercontrol for 0.5 seconds to avoid abusing the shortcut (hitting the shortcut very fast so it releases the trigger several times)
Then I add the crystal ball effect on the overhead of the hero and safe the effect in our local TimeStop variable.
With a cinematic effect i'll let the whole screen appear in a yellow touch (3 second fade in)... I did this because of the "sand of time" so in my opinion yellow was best.

After that the first unit parsing routine declared above is called... it sets animation speed of all units to zero and pauses the units.

Then the Trigger waits 15 seconds (spell duration) and calls the second unit parsing function declared above which restores the speed of the units and unpauses them.

Now we only have to make a filter which reverses the yellow coloration of the screen (3 second fade out)
The last thing we have to do now is destroy the special effect on the hero which i've stored in our local variable and we're done

Code:
function Trig_Time_Stop_Actions takes nothing returns nothing
    local effect TimeStop
    call SetUserControlForceOff( GetPlayersAll() )
    call TriggerSleepAction( 0.50 )
    call AddSpecialEffectTargetUnitBJ( "overhead", GetOrderedUnit(), "Abilities\\Spells\\Items\\AIta\\CrystalBallCaster.mdl" )
    set TimeStop = GetLastCreatedEffectBJ()
    call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUT, 3.00, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 100.00, 100.00, 0, 50.00 )
    call ForGroup( GetUnitsInRectMatching(GetPlayableMapRect(), Condition(function Trig_Time_Stop_AllUnits)), function Trig_Time_Stop_PauseUnits )
    call SetUserControlForceOn( GetPlayersAll() )
    call TriggerSleepAction( 15.00 )
    call ForGroup( GetUnitsInRectMatching(GetPlayableMapRect(), Condition(function Trig_Time_Stop_AllUnits)), function Trig_Time_Stop_UnpauseUnits )
    call CinematicFadeBJ( bj_CINEFADETYPE_FADEIN, 3.00, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 100.00, 100.00, 0, 50.00 )
    call DestroyEffectBJ( TimeStop )
endfunction

This function creates our trigger with the "Event", "Condition" and "Action" functiones declared above....

Code:
//================================================
function InitTrig_Time_Stop takes nothing returns nothing
    set gg_trg_Time_Stop = CreateTrigger(  )
    call TriggerRegisterPlayerUnitEventSimple( gg_trg_Time_Stop, Player(0), EVENT_PLAYER_UNIT_ISSUED_ORDER )
    call TriggerAddCondition( gg_trg_Time_Stop, Condition( function Trig_Time_Stop_Conditions ) )
    call TriggerAddAction( gg_trg_Time_Stop, function Trig_Time_Stop_Actions )
endfunction

You can use my trigger in your own projects if you want but please add the credit lines above

Greetings Darky26