prismpirate
New Member
- Reaction score
- 2
My map fatal errors when I use a certain spell too much (Code found below)
I suspect that "call somefunctioname.execute() " causes this. Is it due to this or is it because of other reasons.
I suspect that "call somefunctioname.execute() " causes this. Is it due to this or is it because of other reasons.
JASS:
scope tornado initializer Init
globals
private constant integer spellid = 039;A014039;
private constant integer spellid2 = 039;A01O039;
private constant integer tornadodummyid = 039;u009039;
private constant integer tornadodummyspellid = 039;A016039;
private constant real tornadodummylifespan = 8.0 //Lifespan of Tornado
private constant real periodicinterval = 0.02 //How often the trigger runs. Lower values for smoother movement. Higher values for less lag
endglobals
private function tornadomovementint takes unit tornado returns nothing
local integer index = 0
local real angle = GetUnitFacing(tornado)
local real xoffset = 300*Cos(Deg2Rad(angle))
local real yoffset = 300*Sin(Deg2Rad(angle))
local group tempgroup
local location temppoint
loop
exitwhen index > 50
call IssuePointOrder(tornado,"move",GetUnitX(tornado) + xoffset,GetUnitY(tornado) + yoffset)
call TriggerSleepAction(0.025)
call SetUnitX(tornado, GetUnitX(tornado) + xoffset)
call SetUnitY(tornado, GetUnitY(tornado) + yoffset)
set index = index+1
endloop
call RemoveLocation(temppoint)
call DestroyGroup(tempgroup)
endfunction
private function tornadoactions takes nothing returns nothing
local unit tornado
local real x = GetUnitX(GetTriggerUnit())
local real y = GetUnitY(GetTriggerUnit())
local real angle = GetUnitFacing(GetTriggerUnit())
set tornado = CreateUnit(GetOwningPlayer(GetTriggerUnit()),tornadodummyid,x,y,angle)
call UnitAddAbility(tornado,tornadodummyspellid)
call UnitApplyTimedLife(tornado, 039;BTLF039;, 3)
call tornadomovementint.execute(tornado)
set tornado = null
endfunction
private function tornadocondition takes nothing returns boolean
return GetSpellAbilityId() == spellid or GetSpellAbilityId() == spellid2
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
local integer index = 0
loop
call TriggerRegisterPlayerUnitEvent(t, Player(index), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
set index = index + 1
exitwhen index == 15
endloop
call TriggerAddCondition(t, Condition(function tornadocondition))
call TriggerAddAction(t, function tornadoactions)
endfunction
endscope