TheCrystal
New Member
- Reaction score
- 36
I begun making an ability a few days ago, had some trouble figuring out events (thanks to this site) and now I'm not sure what's wrong.
The objective of the ability is to create a skull that attacks a unit, which gives it a temporary buff, then it creates another skull that moves to a different target and does the same action. Its damage is done off of a previous data, added to a variable, which is later used to increase the mana of the caster. I'll add comments since the ability seems a little confusing.
The effect is also never created.
The first part of the ability works till it comes to the big loop, where it doesn't create the unit.
The objective of the ability is to create a skull that attacks a unit, which gives it a temporary buff, then it creates another skull that moves to a different target and does the same action. Its damage is done off of a previous data, added to a variable, which is later used to increase the mana of the caster. I'll add comments since the ability seems a little confusing.
The effect is also never created.
JASS:
function NMCC takes nothing returns boolean
if (IsUnitEnemy(GetFilterUnit(), Player(udg_TempInteger)) == true) then
return true
else
return false
endif
endfunction
function ManaCoil takes nothing returns nothing
local group g = CreateGroup()
local unit c = GetTriggerUnit()
local unit u = null //Skull unit
local unit w = GetSpellTargetUnit()
local real r = 0
local integer i = 1
local location l = GetUnitLoc(c)
local location q = null
local effect e = null
local real px = 0
local real py = 0
local boolean b = false //No targets boolean
local integer twowait = 2 //Two second wait time.
local real DamageDone = 0
local integer TooLong = 0
if 039;A00D039; == GetSpellAbilityId() then //Condition
call DisplayTextToPlayer(Player(0),0,0,"A00D") //Debug
set u = CreateUnitAtLoc(Player(13),039;h001039;,l,0)
call IssueTargetOrder(u,"attack",w)
loop //Wait till target has buff
exitwhen UnitHasBuffBJ(w, 039;B006039;) == true
call IssueTargetOrder(u,"attack",w)
call Wait(.1)
endloop
call RemoveUnit(u)
set e = AddSpecialEffectTarget("Abilities/Spells/Undead/DeathCoil/DeathCoilMissile.mdl",w,"overhead")
call Wait(2)
call UnitRemoveBuffBJ( 039;B006039;, w )
call DestroyEffect(e)
call DamageUnit(udg_ZZZWisdom[GetPlayerId(GetOwningPlayer(c))+1],w,c,0)
set DamageDone = udg_ZZZWisdom[GetPlayerId(GetOwningPlayer(c))+1] //To add to caster mana
loop
call DisplayTextToPlayer(Player(0),0,0,"BigLoop") //debug
exitwhen GetUnitAbilityLevel(c,039;A00D039;) == i or b == true
set i = i+1
call RemoveLocation(l)
set l = GetUnitLoc(w)
set u = CreateUnitAtLoc(Player(13),039;h001039;,l,0)
set udg_TempInteger = GetPlayerId(GetOwningPlayer(c))
call GroupEnumUnitsInRange(g,GetLocationX(l),GetLocationY(l),350,Condition(function NMCC)) //All nearby enemy units who are enemy of caster
set w = null
set w = FirstOfGroup(g)
if w == null then //No targets
set b = true
call RemoveUnit(u)
call RemoveLocation(l)
set twowait = 0
endif
call IssueTargetOrder(u,"attack",w)
loop
exitwhen UnitHasBuffBJ(w, 039;B006039;) == true or b == true
call IssueTargetOrder(u,"attack",w)
call Wait(.1)
set TooLong = TooLong+1
if TooLong == 500 then
set b = true
endif
endloop
call RemoveUnit(u)
set e = AddSpecialEffectTarget("Abilities/Spells/Undead/DeathCoil/DeathCoilMissile.mdl",GetSpellTargetUnit(),"head")
call Wait(twowait)
call DestroyEffect(e)
if b == false then
call DamageUnit(udg_ZZZWisdom[GetPlayerId(GetOwningPlayer(c))+1],GetSpellTargetUnit(),c,0)
set DamageDone=DamageDone+udg_ZZZWisdom[GetPlayerId(GetOwningPlayer(c))+1]
endif
call GroupClear(g)
endloop
call SetUnitManaBJ(c, (GetUnitStateSwap(UNIT_STATE_MANA, GetTriggerUnit()) + DamageDone) ) //Addmana
endif
call RemoveLocation(l)
call RemoveLocation(q)
set g = null
set u = null
set c = null
endfunction
The first part of the ability works till it comes to the big loop, where it doesn't create the unit.