1. Are you planning to upload your awesome spell or system to Hive? Please review the rules here.
    Dismiss Notice
  2. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  3. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  4. Ride into the sunset with the 32nd Modeling Contest.
    Dismiss Notice
  5. This adventure has come to an end. Congratulate our heroes in the 16th Mini Mapping Contest Results.
    Dismiss Notice
  6. From the gates of hell, the 5th Special Effect Contest Results have emerged.
    Dismiss Notice
  7. Race against the odds and Reforge, Don't Refund. The 14th Techtree Contest has begun!
    Dismiss Notice
  8. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Trigger Viewer

Simple Temporary Ability System v0.0.1.w3x
Variables
Inicialización
Test
ComboSystem Config
ComboSystem Cast
Escribe debajo el código del guión personalizado especial para el mapa. El texto se incluirá en el guión del mapa después de declarar las variables y antes de los códigos de los detonadores.

		
Name Type Is Array Initial Value
Test
  Events
    Map initialization
  Conditions
  Actions
    Visibility - Disable fog of war
    Visibility - Disable black mask
    Game - Display to (All players) the text: |cffffff00Credits to|r: ALLKNOWLEDGE AKA IAM20842|cffffff00Simple Temporary Ability System|r
globals
    hashtable comboSystemSkills = InitHashtable()
    hashtable comboSystemIndexer = InitHashtable()
endglobals

function ComboSystemConfigActions takes nothing returns nothing
    // Configuring the spell, in this example you have baseSpell (Q) -> comboSpell (Q) -> womboSpell (Q)

    // Save the spell ID in integer vars, better in order like base -> next -> next -> n..., base --> next --> next
    local integer baseSpell = 'A000'
    local integer comboSpell = 'A001'
    local integer womboSpell = 'A002'


    // DO THIS FOR EVERY THREE SPELL COMBO //
    // 1. Save the spell ID for baseSpell -> comboSpell
    call SaveInteger(comboSystemSkills, baseSpell, StringHash("comboSpell"), comboSpell)

    // 2. Save the spell EXPIRATION TIME for baseSpell -> comboSpell
    call SaveReal(comboSystemSkills, baseSpell, StringHash("expirationTime"), 3.00)
   
    // 3. Save the spell ID for comboSpell -> womboSpell
    call SaveInteger(comboSystemSkills, comboSpell, StringHash("comboSpell"), womboSpell)
   
      // 4. Save the spell EXPIRATION TIME for comboSpell -> womboSpell
    call SaveReal(comboSystemSkills, comboSpell, StringHash("expirationTime"), 1.00)

endfunction

//===========================================================================
function InitTrig_ComboSystem_Config takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterTimerEventSingle(t, 0.00)
    call TriggerAddAction(t, function ComboSystemConfigActions)
endfunction

 
GetSpellAbilityId
function ComboSystemHandler takes nothing returns nothing
    // USE: On timer expiration, remove the combo/wombo spell

    // Get the expired timer
    local timer t = GetExpiredTimer()

    // Get the caster unit through timer ID

    local unit caster = LoadUnitHandle(comboSystemIndexer, GetHandleId(t), StringHash("caster"))

    // Get the combo/wombo spell ID

    local integer comboSpell = LoadInteger(comboSystemIndexer, GetHandleId(t), StringHash("comboSpell"))

    // Remove the spell
    call UnitRemoveAbility(caster, comboSpell)

    // For avoid bugs of timer, pause it

    call PauseTimer(t)

    // Destroy the timer

    call DestroyTimer(t)

    // Remove leak

    set t = null

    set caster = null

endfunction

function ComboSystemActions takes nothing returns nothing
    // USE: create a timer to every unit that cast a spell that have combo/wombo

    // Get the caster unit
    local unit caster = GetSpellAbilityUnit()

    // Get the casted spell
    local integer baseSpell = GetSpellAbilityId()

    // Later will save the expiration time of the combo / wombo spell

    local real expirationTime

    // Create a timer
    local timer t

    // Get the combo/wombo spell that correspond to the cast spell

    local integer comboSpell = LoadInteger(comboSystemSkills, baseSpell, StringHash("comboSpell"))
   
    // Check if combo/wombo spell ID is greather than zero (have combo spell)
   
    if (comboSpell != 0) then
        // Initialize the timer
        set t = CreateTimer()

        // Save expiration time
        set expirationTime = LoadReal(comboSystemSkills, baseSpell, StringHash("expirationTime"))
       
        // Save to hashtable the unit that cast the spell
        call SaveUnitHandle(comboSystemIndexer, GetHandleId(t), StringHash("caster"), caster)

        // Save the combo/wombo spell ID
        call SaveInteger(comboSystemIndexer, GetHandleId(t), StringHash("comboSpell"), comboSpell)

        // Add new spell to caster
        call UnitAddAbility(caster, comboSpell)

        // Start the timer
       
        call TimerStart(t, expirationTime, false, function ComboSystemHandler)
    else
         return
    endif
   
    // Avoid leaks
    set caster = null
    set t = null

endfunction

function InitTrig_ComboSystem_Cast takes nothing returns nothing
    local trigger t = CreateTrigger()
    local integer i = 0

    call TriggerAddAction(t, function ComboSystemActions)

    // Set all players
    loop
        call TriggerRegisterPlayerUnitEvent(t, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
        set i = i + 1
    exitwhen i == bj_MAX_PLAYERS
    endloop
endfunction