- Joined
- Jul 14, 2011
- Messages
- 3,213
I'm making a TD where a Wisp can upgrade to several elemental tower types. I create a Special effect and do some stuff when that happens, and I take the order of the first upgrade (custom_UpgradeUnitID) and then the name (Substring 0,4 = "...."), however, whenever I order one of the units to "stop" this runs and displays the special effect.
I'm a bit new to JASS so, please, be patient.
I'm a bit new to JASS so, please, be patient.
JASS:
function TowerEffects_Conditions takes nothing returns boolean
return GetPlayerId(GetTriggerPlayer()) <= 3
endfunction
function TowerEffects_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer s = GetIssuedOrderId()
local string name = SubString(GetUnitName(u), 0, 4)
if s == String2OrderIdBJ("custom_h00P") or name == "Dark"
set udg_RealEffect = (udg_RealEffect + 1.00)
set udg_SfxQ = (udg_SfxQ + 1)
set udg_Sfx[udg_SfxQ] = AddSpecialEffect("war3mapImported\\s_ShadowEruption_Rain.mdx", GetUnitX(u), GetUnitY(u))
elseif s == String2OrderIdBJ("custom_h01I") or name == "Eart"
set udg_RealEffect = (udg_RealEffect + 1.00)
set udg_SfxQ = (udg_SfxQ + 1)
set udg_Sfx[udg_SfxQ] = AddSpecialEffect("Abilities\\Spells\\Other\\Volcano\\VolcanoDeath.mdl", GetUnitX(u), GetUnitY(u))
elseif s == String2OrderIdBJ("custom_h01Q") or name == "Elec"
set udg_RealEffect = (udg_RealEffect + 1.00)
set udg_SfxQ = (udg_SfxQ + 1)
call TriggerSleepAction(0.35)
set udg_Sfx[udg_SfxQ] = AddSpecialEffect("war3mapImported\\LightningsLong.mdx", GetUnitX(u), GetUnitY(u))
elseif s == String2OrderIdBJ("custom_h00U") or name == "Fire"
set udg_RealEffect = (udg_RealEffect + 1.00)
set udg_SfxQ = (udg_SfxQ + 1)
set udg_Sfx[udg_SfxQ] = AddSpecialEffect("war3mapImported\\NewGroundEX.mdx", GetUnitX(u), GetUnitY(u))
elseif s == String2OrderIdBJ("custom_h00V") or name == "Fros"
set udg_RealEffect = (udg_RealEffect + 1.00)
set udg_SfxQ = (udg_SfxQ + 1)
set udg_Sfx[udg_SfxQ] = AddSpecialEffect("Abilities\\Spells\\Undead\\FrostNova\\FrostNovaTarget.mdl", GetUnitX(u), GetUnitY(u))
elseif s == String2OrderIdBJ("custom_h01P") or name == "Wind"
set udg_RealEffect = (udg_RealEffect + 1.00)
set udg_SfxQ = (udg_SfxQ + 1)
set udg_Sfx[udg_SfxQ] = AddSpecialEffect("war3mapImported\\CyclonExplosion.mdx", GetUnitX(u), GetUnitY(u))
endif
set u = null
set name = null
endfunction
//===========================================================================
function InitTrig_Tower_Effects takes nothing returns nothing
set gg_trg_Tower_Effects = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Tower_Effects, EVENT_PLAYER_UNIT_ISSUED_ORDER )
call TriggerAddCondition(gg_trg_Tower_Effects, function TowerEffects_Conditions)
call TriggerAddAction( gg_trg_Tower_Effects, function TowerEffects_Actions )
endfunction