- Joined
- Feb 11, 2011
- Messages
- 1,860
Hello,
I have this minor issue where the sound for my effect does not play. This occurs in my hero picking system. The hero is moved instantly to the correct rect and the camera pans there instantly. However, the effect's sound (Mass Teleport - caster) does not play when I create the effect on the unit's origin. Here is the code:
Any ideas? This is strange because the sound does play in a slightly different version of this system in my other map.
I have this minor issue where the sound for my effect does not play. This occurs in my hero picking system. The hero is moved instantly to the correct rect and the camera pans there instantly. However, the effect's sound (Mass Teleport - caster) does not play when I create the effect on the unit's origin. Here is the code:
JASS:
scope PickHero initializer onInit
private function Actions takes nothing returns nothing
local unit u = GetSoldUnit()
local player p = GetOwningPlayer(u)
local real x
local real y
call RemoveUnit(Hero_Selector[GetPlayerId(p)])
call UnitPoolRemoveUnitType(Heroes, GetUnitTypeId(u))
if IsPlayerInForce(p, Stormwind) then
set x = GetRandomReal(GetRectMinX(Stormwind_Base), GetRectMaxX(Stormwind_Base))
set y = GetRandomReal(GetRectMinY(Stormwind_Base), GetRectMaxY(Stormwind_Base))
endif
if GetLocalPlayer() == p then
call PanCameraToTimed(x, y, 0)
call ClearSelection()
call SelectUnit(u, true)
endif
call SetUnitX(u, x)
call SetUnitY(u, y)
call SetUnitFacing(u, 270)
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl", u, "origin"))
set u = null
set p = null
endfunction
private function Conditions takes nothing returns boolean
if IsUnitType(GetSoldUnit(), UNIT_TYPE_HERO) then
call Actions()
endif
return false
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerAddCondition(t, Condition(function Conditions))
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SELL)
set t = null
endfunction
endscope