- Joined
- May 17, 2005
- Messages
- 6
Alright, I'm gonna preface this with a "I'm really rusty at JASS at the moment". Anyway, what I'm trying to do with this trigger is check if the target of the spell ("target") is an enemy; if it is, cast a Storm Bolt-like ability at it. If it isn't, cast a Bloodlust-like ability on the target. It always gets up to the point of my unit casting, then wc3 crashes to desktop. WE and JASSCraft say I don't have any kinda syntax error. Help, please?
Thanks in advance. Also, if there's an easier way, either GUI or JASS, If I could see that, it'd be awesome.
JASS:
function PiousStrike takes nothing returns nothing
local unit caster
local unit target
local unit temp
local player CastOwner
local player TargOwner
set caster = GetSpellAbilityUnit()
set target = GetSpellTargetUnit()
set CastOwner = GetOwningPlayer(caster)
set TargOwner = GetOwningPlayer(target)
if (IsPlayerEnemy(CastOwner, TargOwner)) then
set temp = CreateUnitAtLoc (CastOwner, 'h000', GetUnitLoc(target), 0.00)
call SetUnitAbilityLevelSwapped ('A005', temp, GetUnitAbilityLevelSwapped('A004', caster))
call IssueTargetOrderBJ(temp, "thunderbolt", target)
call RemoveUnit(temp)
else
set temp = CreateUnitAtLoc (CastOwner, 'h000', GetUnitLoc(target), 0.00)
call SetUnitAbilityLevelSwapped ('Ablo', temp, GetUnitAbilityLevelSwapped('A004', caster))
call IssueTargetOrderBJ(temp, "bloodlust", target)
call RemoveUnit(temp)
endif
set caster = null
set target = null
set temp = null
set CastOwner = null
set TargOwner = null
endfunction
Thanks in advance. Also, if there's an easier way, either GUI or JASS, If I could see that, it'd be awesome.
Last edited: