1. Are you planning to upload your awesome spell or system to Hive? Please review the rules here.
    Dismiss Notice
  2. The long-awaited results for Concept Art Contest #11 have finally been released!
    Dismiss Notice
  3. Join Texturing Contest #30 now in a legendary battle of mythological creatures!
    Dismiss Notice
  4. The 20th iteration of the Terraining Contest is upon us! Join and create exquisite Water Structures for it.
    Dismiss Notice
  5. Hivers united and created a bunch of 2v2 melee maps. Vote for the best in our Melee Mapping Contest #4 - Poll!
    Dismiss Notice
  6. Check out the Staff job openings thread.
    Dismiss Notice

Trigger Viewer

Spirit Protection v1.06.w3x
Variables
spell spirit protection
readme
spirit protection ini
spirit protection effect
for map
You dont need it
info
restore
Введите ниже нестандартный код для указанной карты. Этот текст будет включен в код карты после объявления переменных и до кода любого триггера.

		
Name Type Is Array Initial Value
ChanceArray real Yes
Factor_max integer No
Factor_min integer No
Order string Yes
Random_Spell abilcode Yes
Random_spell_Count integer No
Random_Value integer No
Random_Value2 integer No
TempPoint location No
How to copy?
- To import spell you only should make a tick in -Preferences\Create variables for the unknow variables and then the copy and past the Folder.
Next, copy dummy unit to your map, spell, dummy spells(you may make dummy spells ny yourself).
Setup spell and you could use it!


____________________________________________________
Don`t forget to give credits if you use it in your map!




Credits to Anachron for the icon to the spell.
spirit protection ini
  Events
    Map initialization
  Conditions
  Actions
    -------- Choose the number of your dummy spells --------
    Set Random_spell_Count = 8
    -------- *-* --------
    -------- enter a chances that make ability work --------
    Set ChanceArray[1] = 0.20
    Set ChanceArray[2] = 0.40
    Set ChanceArray[3] = 0.60
    -------- choose your dummy spells --------
    Set Random_Spell[1] = Shadow Strike random spell
    Set Random_Spell[2] = Polymorph random spell
    Set Random_Spell[3] = Chain Lightning random spell
    Set Random_Spell[4] = Purge random spell
    Set Random_Spell[5] = Frost Nova random spell
    Set Random_Spell[6] = Entangling Roots random spell
    Set Random_Spell[7] = Curse random spell
    Set Random_Spell[8] = Mana Burn random spell
    -------- --------
    -------- --------
    -------- choose ordercodes of your spells --------
    -------- In the same procedure --------
    Set Order[1] = shadowstrike
    Set Order[2] = polymorph
    Set Order[3] = chainlightning
    Set Order[4] = purge
    Set Order[5] = frostnova
    Set Order[6] = entanglingroots
    Set Order[7] = curse
    Set Order[8] = manaburn
spirit protection effect
  Events
    Unit - A unit Is attacked
  Conditions
    (Level of Spirit protection for (Triggering unit)) Not equal to 0
  Actions
    If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      If - Conditions
        (Random real number between 0 and 1) Less than or equal to ChanceArray[(Level of Spirit protection for (Triggering unit))]
      Then - Actions
        -------- This is a random value beetween 1 and the count of your random spells --------
        Set Random_Value = (Random integer number between 1 and Random_spell_Count)
        Set TempPoint = (Position of (Triggering unit))
        Unit - Create 1 dummy for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
        Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
        -------- order to cast your chose spell with the correspond orders --------
        Unit - Add Random_Spell[Random_Value] to (Last created unit)
        Unit - Set level of Random_Spell[Random_Value] for (Last created unit) to (Level of Spirit protection for (Triggering unit))
        Custom script: call IssueTargetOrder( bj_lastCreatedUnit, udg_Order[udg_Random_Value], GetAttacker() )
        Custom script: call RemoveLocation(udg_TempPoint)
      Else - Actions
function Trig_You_dont_need_it_Actions takes nothing returns nothing
    call CreateFogModifierRectBJ( true, Player(0), FOG_OF_WAR_VISIBLE, GetPlayableMapRect() )
    call SelectUnitForPlayerSingle( gg_unit_Hblm_0001, Player(0) )
    set udg_TempPoint = GetUnitLoc(gg_unit_Hblm_0001)
    call PanCameraToTimedLocForPlayer( Player(0), udg_TempPoint, 0 )
    call RemoveLocation(udg_TempPoint)
endfunction

//===========================================================================
function InitTrig_You_dont_need_it takes nothing returns nothing
    set gg_trg_You_dont_need_it = CreateTrigger(  )
    call TriggerAddAction( gg_trg_You_dont_need_it, function Trig_You_dont_need_it_Actions )
endfunction

 
function Trig_info_Actions takes nothing returns nothing
    call DisplayTimedTextToForce( GetPlayersAll(), 15.00, "TRIGSTR_035" )
endfunction

//===========================================================================
function InitTrig_info takes nothing returns nothing
    set gg_trg_info = CreateTrigger(  )
    call TriggerAddAction( gg_trg_info, function Trig_info_Actions )
endfunction

 
function Trig_restore_Actions takes nothing returns nothing
    call SetUnitLifePercentBJ( gg_unit_Hblm_0001, 100 )
endfunction

//===========================================================================
function InitTrig_restore takes nothing returns nothing
    set gg_trg_restore = CreateTrigger(  )
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_restore, Player(0) )
    call TriggerAddAction( gg_trg_restore, function Trig_restore_Actions )
endfunction