Faust
You can change this now in User CP.
- Reaction score
- 123
JASS:
scope Relocation initializer I
private struct Relocation
//! runtextmacro PUI()
unit mover
real x
real y
integer xp
timer clock = CreateTimer()
integer unitid
method onDestroy takes nothing returns nothing
call PauseTimer(.clock)
//call DestroyTimer(.clock)
endmethod
endstruct
private function C2 takes nothing returns boolean
return GetIssuedOrderId() == 852165
endfunction
private function C3 takes nothing returns boolean
return GetIssuedOrderId() == 852166 and IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true
endfunction
private function RootHandle takes nothing returns nothing
local Relocation dat = GetTimerStructA(GetExpiredTimer())
if GetUnitX(dat.mover) == dat.x and GetUnitY(dat.mover) == dat.y then
call ReplaceTower(dat.mover, dat.unitid, 039;h01C039;)
set Relocation[bj_lastCreatedUnit] = dat
//set dat.mover = bj_lastCreatedUnit
call SetHeroXP(bj_lastCreatedUnit, dat.xp, false)
call PauseTimer(dat.clock)
call DestroyTimer(dat.clock)
endif
if GetUnitCurrentOrder(dat.mover) != 852165 then
call PauseTimer(dat.clock)
call DestroyTimer(dat.clock)
endif
endfunction
private function Root takes nothing returns nothing
local Relocation dat = Relocation[GetTriggerUnit()]
local location l = GetOrderPointLoc()
set dat.mover = GetTriggerUnit()
set dat.x = GetLocationX(l)
set dat.y = GetLocationY(l)
set dat.clock = CreateTimer()
call SetTimerStructA(dat.clock, dat)
call TimerStart(dat.clock, 0.2, true, function RootHandle)
call RemoveLocation(l)
set l = null
endfunction
private function Uproot takes nothing returns nothing
local Relocation dat = Relocation[GetTriggerUnit()]
if dat == null then
call BJDebugMsg("Dat is null")
set dat = Relocation.create()
//call SetTimerStructA(dat.clock, dat)
else
call BJDebugMsg("dat is not null")
endif
set dat.xp = GetHeroXP(GetTriggerUnit())
call KillDummy(GetTriggerUnit())
set dat.unitid = GetUnitTypeId(GetTriggerUnit())
call ReplaceTower(GetTriggerUnit(), 039;h02A039;, 039;none039;)
call IssueImmediateOrderById(bj_lastCreatedUnit, 852166)
set Relocation[bj_lastCreatedUnit] = dat
//set dat.mover = bj_lastCreatedUnit
endfunction
private function C1 takes nothing returns boolean
return GetUnitTypeId(GetFilterUnit()) == 039;H029039;
endfunction
private function EntryUproot takes nothing returns nothing
local Relocation dat = Relocation[GetTriggerUnit()]
if dat == null then
call IssueImmediateOrderById(GetTriggerUnit(), 852166)
else
endif
endfunction
//===========================================================================
private function I takes nothing returns nothing
local trigger t = CreateTrigger()
local region r = CreateRegion()
call RegionAddRect(r, bj_mapInitialPlayableArea)
call TriggerRegisterEnterRegion(t, r, Condition(function C1))
call TriggerAddAction(t, function EntryUproot)
set t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER)
call TriggerAddCondition(t, Condition(function C2))
call TriggerAddAction(t, function Root)
set t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ISSUED_ORDER)
call TriggerAddCondition(t, Condition(function C3))
call TriggerAddAction(t, function Uproot)
endfunction
endscope
The old thread's title wasn't very related to the problem, so I thought bumping wouldn't be a good idea, as the problem quite different too.
Well, the problem is I get the error message: Double free of type Relocation__Relocation
I don't know what it means or how to fix it, after a few uses the "system" bugs up, sometimes not replacing the unit or replacing it with another one.
Please help I really need this very much ><