Is there a reason for them to be initialised later? Can they be initialised earlier, using a module maybe?the .onCreate method of my AIDS struct requires some values that are calculated in a library which gets initialized much later.
Might also help you solve your own problem. But I can't help you without a concise (ie. shred off as much code as you can without stopping the bug) demo map.It would probably greatly help Jesus4Lyf if you simplified your code as much as you can with the bug still happening, upload the map you are using, and make it as easy to remake as possible.
Might also help you solve your own problem. But I can't help you without a concise (ie. shred off as much code as you can without stopping the bug) demo map.
// Called in AIDS structs when units do not pass the initial AIDS filter.
// Called in AIDS structs when units have passed the initial AIDS filter.
// The unit did not pass the filters, so does not need to be auto indexed.
// However, for certain AIDS structs, it may still require indexing.
// These structs may index the unit on their creation.
// We flag that an index must be assigned by setting the current index to 0.
//Enum every non-filtered unit on the map during initialization and assign it a unique
//index. By using GroupEnumUnitsOfPlayer, even units with Locust can be detected.
no offense intended, but i feel like you're asking me to find the source of the bug myself.
i could be wrong but i think the cause is some unforeseen conflict with another system.
//Enum every non-filtered unit on the map during initialization and assign it a unique
//index. By using GroupEnumUnitsOfPlayer, even units with Locust can be detected.
scope BlackWhirlpool initializer init
private struct swirl
group g
unit caster
boolean stop
real range
private method onDestroy takes nothing returns nothing
call DestroyGroup(.g)
set .g=null
set .caster = null
endmethod
endstruct
private struct damager
unit caster
boolean stop
real damage
group g
real range
private method onDestroy takes nothing returns nothing
call DestroyGroup(.g)
set .g=null
set .caster = null
endmethod
endstruct
private function damages takes nothing returns boolean
local damager d = KT_GetData()
local unit u = null
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Weapons\\AvengerMissile\\AvengerMissile.mdl",d.caster,"weapon"))
call GroupEnumUnitsInRange(d.g,GetUnitX(d.caster),GetUnitY(d.caster),d.range,Condition(function LiveUnitFilter))
loop
set u = FirstOfGroup(d.g)
call GroupRemoveUnit(d.g,u)
exitwhen u==null
if IsUnitEnemy(u,GetOwningPlayer(d.caster)) then
call Damage_Spell(d.caster,u,d.damage)
call SetUnitState(d.caster,UNIT_STATE_LIFE,GetUnitState(d.caster,UNIT_STATE_LIFE)+(d.damage/4))
call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Orc\\Devour\\DevourEffectArt.mdl",u,"chest"))
endif
endloop
call GroupClear(d.g)
set u = null
set d.stop = OrderId2String(GetUnitCurrentOrder(d.caster)) != "starfall"
return d.stop
endfunction
private function spin takes nothing returns boolean
local swirl s = KT_GetData()
local integer i = 0
local real x
local real y
local real angle
local real dist
local unit u
call GroupEnumUnitsInRange(s.g,GetUnitX(s.caster),GetUnitY(s.caster), s.range, Condition(function LiveUnitFilter))
loop
set u = FirstOfGroup(s.g)
call GroupRemoveUnit(s.g,u)
exitwhen u == null
if IsUnitEnemy(u,GetOwningPlayer(s.caster))==true then
set dist = UnitDistance(s.caster,u)
set angle = UnitAngle(s.caster,u)
set x = GetUnitX(s.caster) + Cos(bj_DEGTORAD*(angle-1))*(dist-4)
set y = GetUnitY(s.caster) + Sin(bj_DEGTORAD*(angle-1))*(dist-4)
if PCCheck(x,y,u) then
call SetUnitX(u,x)
call SetUnitY(u,y)
else
set dist = UnitDistance(s.caster,u)
set angle = UnitAngle(s.caster,u)
set x = GetUnitX(s.caster) + Cos(bj_DEGTORAD*(angle))*(dist-4)
set y = GetUnitY(s.caster) + Sin(bj_DEGTORAD*(angle))*(dist-4)
if PCCheck(x,y,u) then
call SetUnitX(u,x)
call SetUnitY(u,y)
endif
endif
endif
endloop
call GroupClear(s.g)
set u = null
set s.stop = OrderId2String(GetUnitCurrentOrder(s.caster)) != "starfall"
return s.stop
endfunction
private function Trig_BlackWhirlpool_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 039;A01B039;
endfunction
private function Trig_BlackWhirlpool_Actions takes nothing returns nothing
local unit caster = GetTriggerUnit()
local integer level = GetUnitAbilityLevel(caster,039;A01B039;)
local HeroData h = HeroData[caster]
local swirl s = swirl.create()
local unit d = CreateUnit(GetOwningPlayer(caster),039;e001039;,GetUnitX(caster),GetUnitY(caster),0)
local effect e
local damager r = damager.create()
set s.range = 320+80*level
set s.stop = false
set s.caster = caster
set s.g = CreateGroup()
set r.range = s.range
set r.stop = false
set r.caster = caster
set r.g = CreateGroup()
set r.damage = (10+(20*level)+(0.2*h.GetTotal("sp")))/2
call SetUnitScale(d,10,10,10)
set e = AddSpecialEffectTarget("Abilities\\Spells\\Human\\Thunderclap\\ThunderclapTarget.mdl",d,"origin")
call SetUnitVertexColor(d,100,100,100,235)
call KT_Add(function spin, s, 0.03125)
call KT_Add(function damages, r, .5)
loop
exitwhen s.stop
call TriggerSleepAction(0)
endloop
call DestroyEffect(e)
set e = null
call KillUnit(d)
set d = null
call s.destroy()
call r.destroy()
set caster = null
endfunction
//===========================================================================
private function init takes nothing returns nothing
local trigger t = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( t, Condition( function Trig_BlackWhirlpool_Conditions ) )
call TriggerAddAction( t, function Trig_BlackWhirlpool_Actions )
endfunction
endscope
True (but I'd still avoid periodic checks) and true. Try an event for unit's life becomes 0, condition being unit is not dead and is not a hero, and see if that will give you the starts reincarnation event - then use a trigger to detect when a unit's life becomes greater than 0 to see when it has revived. These should give you the correct points, if it works.1. With Resurrection and AnimateDead you still detect when the unit dies, so you can run just add the dead units to a periodic timer that fires an event if/when UnitAlive returns true.
2. I think hero revive has a native event, but not 100% sure on this one.