- Joined
- Jun 11, 2017
- Messages
- 760
Hey guys, I have next spell that does alot of things depending on targets global group (animals, humans, etc).
But right now I don't know why it doesn't work - my spell simply doesn't call and I don't know why.
I tried different approaches but currently I don't found the answer.
But right now I don't know why it doesn't work - my spell simply doesn't call and I don't know why.
I tried different approaches but currently I don't found the answer.
- Init 10 Spells
-
Events
- Time - Elapsed game time is 0.55 seconds
- Conditions
-
Actions
- Custom script: RodOfDiscordEffect()
Lua:
function RodOfDiscordEffect()
local function AbilityId(id)
return id:byte(1) * 0x1000000 + id:byte(2) * 0x10000 + id:byte(3) * 0x100 + id:byte(4)
end
--SFX Settings:
local ABILITY_ID = AbilityId('A00V')
local ExplosionEffect = 'Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl'
local UnitAshesEffect = 'Abilities\\Spells\\Human\\FlameStrike\\FlameStrike1.mdl'
local TransformationEffect = 'Abilities\\Spells\\Orc\\FeralSpirit\\feralspiritdone.mdl'
local LightningEffect = 'Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl'
-- Event & Trigger Creation
local TT = CreateTrigger()
for i = 0, bj_MAX_PLAYER_SLOTS, 1 do
TriggerRegisterPlayerUnitEvent(TT, Player(i), EVENT_PLAYER_UNIT_SPELL_EFFECT)
end
TriggerAddCondition(TT, Condition(function()
return GetSpellAbilityID() == ABILITY_ID
end))
TriggerAddAction(TT, function()
local TargetUnit = GetSpellTargetUnit()
local UnitX = GetUnitX(TargetUnit)
local UnitY = GetUnitY(TargetUnit)
local UnitOwner = GetOwningPlayer(TargetUnit)
if IsUnitInGroup(TargetUnit, udg_DiscordAnimal) then
SetUnitFacingToFaceUnitTimed(TargetUnit, GetTriggerUnit(), 0.0)
local randomizeEffect = GetRandomInt(1, 7)
if randomizeEffect == 1 then
local scaleUnit = 100;
for i = 1, 15, 2 do
SetUnitScale(TargetUnit, scaleUnit + i, scaleUnit + i, scaleUnit + i)
BlzSetUnitMaxHP(TargetUnit, BlzGetUnitMaxHP(TargetUnit) + i * 10)
end
SetUnitExploded(TargetUnit, true)
DestroyEffect(AddSpecialEffect(ExplosionEffect, UnitX, UnitY))
KillUnit(TargetUnit)
elseif randomizeEffect == 2 then
local scaleUnit = 100
for i = 1, 25, 3 do
SetUnitScale(TargetUnit, scaleUnit - i, scaleUnit - i, scaleUnit - i)
BlzSetUnitMaxHP(TargetUnit, BlzGetUnitMaxHP(TargetUnit) - i * 2)
end
SetUnitExploded(TargetUnit, true)
KillUnit(TargetUnit)
AddSpecialEffect(UnitAshesEffect, UnitX, UnitY)
elseif randomizeEffect == 3 then
local heroType = GetUnitTypeId(FourCC(GetTriggerUnit()))
DestroyEffect(AddSpecialEffect(TransformationEffect, UnitX, UnitY))
ReplaceUnitBJ(TargetUnit, heroType, 3)
GroupRemoveUnit(udg_DiscordAnimal)
RemoveUnit(TargetUnit)
elseif randomizeEffect == 4 then
local elfReplaceUnit = 'n00M'
DestroyEffect(AddSpecialEffect(TransformationEffect, UnitX, UnitY))
ReplaceUnitBJ(TargetUnit, elfReplaceUnit, 3)
GroupRemoveUnit(udg_DiscordAnimal)
SetUnitExploded(TargetUnit, true)
DestroyEffect(AddSpecialEffect(ExplosionEffect, UnitX, UnitY))
KillUnit(TargetUnit)
elseif randomizeEffect == 5 then
elseif randomizeEffect == 6 then
local dummy = CreateUnit(Player(1), 'u001', UnitX, UnitY, 0)
UnitAddAbility(dummy, FourCC('A00T'))
UnitShareVision(TargetUnit, GetLocalPlayer(), true)
IssueTargetOrderById(dummy, 852074, TargetUnit)
UnitShareVision(TargetUnit, GetLocalPlayer(), false)
else
DestroyEffect(AddSpecialEffect(LightningEffect, UnitX, UnitY))
UnitAddAbility(TargetUnit, FourCC('A00U'))
end
end
if IsUnitInGroup(TargetUnit, udg_DiscordUndead) then
SetUnitFacingToFaceUnitTimed(TargetUnit, GetTriggerUnit(), 0.0)
local randomizeEffect = GetRandomInt(1, 4)
if randomizeEffect == 1 then
SetUnitExploded(TargetUnit, true)
DestroyEffect(AddSpecialEffect(UnitAshesEffect, UnitX, UnitY))
KillUnit(TargetUnit)
elseif randomizeEffect == 2 then
local unitType = GetUnitTypeId(FourCC('n00P'))
DestroyEffect(AddSpecialEffect(TransformationEffect, UnitX, UnitY))
local MorphedUnit = ReplaceUnitBJ(TargetUnit, unitType, 3)
SetUnitExploded(MorphedUnit, true)
DestroyEffect(AddSpecialEffect(ExplosionEffect, UnitX, UnitY))
KillUnit(MorphedUnit)
end
end
end)
end