Exide
I am amazingly focused right now!
- Reaction score
- 448
Hi.
As the thread name says, I've got yet another trigger that crashes my game, and I don't know why..
The trigger is for a spell that is supposed to pick all units in *area* and have a dummy unit cast entangling roots on them.
The dummies manages to cast the entangle roots (I can see the spell effect, and hear the sound) but less than half a second after they've cast their spells, the game crashes.
Here's my trigger:
'A00B' = Entangling Roots (Dummy, target ability)
-I was also wonder if there's a way to "GetSpellTargetX" (and Y), so that I don't have to use a local point variable?
EDIT: The crash is immidiate. (The game just shuts down, no error messages, no nothing.)
EDIT #2: I discovered that if I add a 0.5 sec (and higher, 0.4 and shorter crashes) wait between call UnitApplyTimedLife(u, 'BTLF', 3) and set t = FirstOfGroup(g), the game does not crash.. -Why?
As the thread name says, I've got yet another trigger that crashes my game, and I don't know why..
The trigger is for a spell that is supposed to pick all units in *area* and have a dummy unit cast entangling roots on them.
The dummies manages to cast the entangle roots (I can see the spell effect, and hear the sound) but less than half a second after they've cast their spells, the game crashes.
Here's my trigger:
JASS:
function Trig_Entangling_Roots_Conditions takes nothing returns boolean
return (GetSpellAbilityId() == 039;A00A039;)
endfunction
function EnemiesInRange_func takes nothing returns boolean
return (IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(GetTriggerUnit())) == true) and (GetUnitState(GetFilterUnit(), UNIT_STATE_LIFE) > 0.405) and (IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == false)
endfunction
function Trig_Entangling_Roots_Actions takes nothing returns nothing
local location loc = GetSpellTargetLoc()
local real x = GetLocationX(loc)
local real y = GetLocationY(loc)
local unit u
local unit t
local group g = CreateGroup()
local integer i = GetUnitAbilityLevel(GetTriggerUnit(), 039;A00A039;)
local real range
if (i == 1) then
set range = 400
elseif (i == 2) then
set range = 450
elseif (i == 3) then
set range = 500
elseif (i == 4) then
set range = 600
endif
call GroupEnumUnitsInRange(g, x, y, range, Filter(function EnemiesInRange_func))
if (CountUnitsInGroup(g) > 0) then
loop
exitwhen CountUnitsInGroup(g) == 0
set u = CreateUnit(GetOwningPlayer(GetTriggerUnit()), 039;h005039;, x, y, 270)
call UnitAddAbility(u, 039;A00B039;)
call SetUnitAbilityLevel(u, 039;A00B039;, i)
call UnitApplyTimedLife(u, 039;BTLF039;, 3)
set t = FirstOfGroup(g)
call IssueTargetOrder(u, "entanglingroots", t)
call GroupRemoveUnit(g, t)
set u = null
set t = null
endloop
endif
call DestroyGroup(g)
call RemoveLocation(loc)
set loc = null
set g = null
endfunction
//===========================================================================
function InitTrig_Entangling_Roots takes nothing returns nothing
local trigger Entangling_Roots = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( Entangling_Roots, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( Entangling_Roots, Condition( function Trig_Entangling_Roots_Conditions ) )
call TriggerAddAction( Entangling_Roots, function Trig_Entangling_Roots_Actions )
endfunction
'A00B' = Entangling Roots (Dummy, target ability)
-I was also wonder if there's a way to "GetSpellTargetX" (and Y), so that I don't have to use a local point variable?
EDIT: The crash is immidiate. (The game just shuts down, no error messages, no nothing.)
EDIT #2: I discovered that if I add a 0.5 sec (and higher, 0.4 and shorter crashes) wait between call UnitApplyTimedLife(u, 'BTLF', 3) and set t = FirstOfGroup(g), the game does not crash.. -Why?