scope SEF initializer Init
//*==============================================================
//* Storm, earth and fire
//* Made by DarkWatcher
//*
//* Requirements: None (except JNGP ofc)
//*
//* Only works for patch 1.23b+
//*
//* How to use:
//* 1)Copy this trigger into you map
//* 2)Copy the Storm,earth and fire, monsoon(dummy) and EarthQuake(dummy) abilities into your map
//* 3)Check spell rawcodes matching ones below
//* 4)Set the DUMMY field to your dummy rawcode
//*==============================================================
globals
private constant integer DUMMY = 'h001'
private constant integer SPELLID = 'A004'
private constant integer MONSOONID = 'A007'
private constant integer EQID = 'A005'
endglobals
//==========================================================
globals
private hashtable hT
endglobals
private struct Spell
real X
real Y
player id
static method create takes real x, real y, player id returns Spell
local Spell spell = Spell.allocate()
set spell.X = x
set spell.Y = y
set spell.id = id
return spell
endmethod
endstruct
private function Cond takes nothing returns boolean
return GetSpellAbilityId() == SPELLID
endfunction
private function Actions takes nothing returns nothing
local Spell spell = Spell.create( GetSpellTargetX(), GetSpellTargetY(), GetOwningPlayer(GetTriggerUnit()))
//Play storm,earth and fire
local sound s = CreateSound("Units\\Orc\\Shaman\\ShamanReady1.wav", false, false, true, 10, 10, "")
call SetSoundPosition(s, GetSpellTargetX(), GetSpellTargetY(), 0)
call SetSoundVolume(s, 127)
call StartSound(s)
call KillSoundWhenDone(s)
set s = null
call SaveInteger(hT, 0, GetHandleId(GetTriggerUnit()), spell)
endfunction
private function Actions2 takes nothing returns nothing
local Spell spell = LoadInteger(hT, 0, GetHandleId(GetTriggerUnit()))
local unit dummy = CreateUnit( spell.id, DUMMY, spell.X, spell.Y, 270 )
call UnitAddAbility(dummy, MONSOONID)
call IssuePointOrder( dummy, "monsoon", spell.X, spell.Y)
set dummy = CreateUnit( spell.id, DUMMY, spell.X, spell.Y, 270 )
call UnitAddAbility( dummy, EQID)
call IssuePointOrder( dummy, "earthquake", spell.X, spell.Y)
set dummy = null
endfunction
private function Actions3 takes nothing returns nothing
local Spell spell = LoadInteger(hT, 0, GetHandleId(GetTriggerUnit()))
call TriggerSleepAction(0.10)
call spell.destroy()
endfunction
function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Cond ) )
call TriggerAddAction( t, function Actions )
set t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_FINISH )
call TriggerAddCondition( t, Condition( function Cond ) )
call TriggerAddAction( t, function Actions2 )
set t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_ENDCAST )
call TriggerAddCondition( t, Condition( function Cond ) )
call TriggerAddAction( t, function Actions3 )
set hT = InitHashtable()
endfunction
endscope