- Joined
- Jul 14, 2011
- Messages
- 3,213
NVM, solved it. But a question remains.
I was using a loop to pick units in small circles in a straigth line and adding all these units to a unit group. Then i have a loop to deal damage to units inside that group. The thing is, when the local real Damage variable had no value it was creating the groups constantly and all the specials effects (for testing purposes) every 0.5 to the facing of the caster, even when it wasn't casting anymore... It all worked out when I added a value to Damage... How's that the Damage Loop bugs the other loop that's before it if Damage = null?
I was using a loop to pick units in small circles in a straigth line and adding all these units to a unit group. Then i have a loop to deal damage to units inside that group. The thing is, when the local real Damage variable had no value it was creating the groups constantly and all the specials effects (for testing purposes) every 0.5 to the facing of the caster, even when it wasn't casting anymore... It all worked out when I added a value to Damage... How's that the Damage Loop bugs the other loop that's before it if Damage = null?
JASS:
loop // Through Small circles in a line to add these units to the SolarBeamDamageGroup
exitwhen i > 15
call BJDebugMsg("Index i: " + I2S(i))
set OffsetX = CasterX + (i*75) * Cos(Facing * bj_DEGTORAD)
set OffsetY = CasterY + (i*75) * Sin(Facing * bj_DEGTORAD)
call AddSpecialEffect("Abilities\\Spells\\Other\\TalkToMe\\TalkToMe.mdl", OffsetX, OffsetY) // Just to test
call GroupEnumUnitsInRange(g, OffsetX, OffsetY, 100, null)
loop // Add the Enum units to the SolarBeamDamagedGroup
set u = FirstOfGroup(g)
exitwhen u == null
if IsUnitEnemy(u, p) == true and IsUnitType(g, UNIT_TYPE_DEAD) == false then
call GroupAddUnit(udg_SolarBeamDamagedGroup, u)
endif
call GroupRemoveUnit(g, u)
endloop
set i = i + 1
endloop
loop // Damage the Units in the SolarBeamGroup
set u = FirstOfGroup(udg_SolarBeamDamagedGroup)
exitwhen u == null
call UnitDamageTarget(Caster, u, Damage, true, false, ATTACK_TYPE_MAGIC, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS)
call GroupRemoveUnit(udg_SolarBeamDamagedGroup, u)
endloop