I have created a trigger which crashes the game, but I don't understand why.
Here is that trigger:
----
----
and looks like this in jass:
----
the memory leak calculator says that it has 2 leaks. But it doesn't say how can i fix it. :nuts: :banghead:
----
This trigger's function:
The heroes' weapon always stored in the first slot, and when you pick up a new weapon your old one will be dropped, and the new one will be exchaned for a suitable weapon for you (ranger get bow instead of sword), and you cannot move it from the first slot. So when you pick up another weapon the item in the first slot (your weapon) will be dropped.
----
Please post some solution for this trigger to don't crash. Thank you.
Here is that trigger:
----
----
and looks like this in jass:
Code:
function Trig_ranger1_Func006Func001C takes nothing returns boolean
if ( ( GetItemTypeId(GetManipulatedItem()) == 'I006' ) ) then
return true
endif
if ( ( GetItemTypeId(GetManipulatedItem()) == 'I00T' ) ) then
return true
endif
if ( ( GetItemTypeId(GetManipulatedItem()) == 'I00W' ) ) then
return true
endif
if ( ( GetItemTypeId(GetManipulatedItem()) == 'I00S' ) ) then
return true
endif
return false
endfunction
function Trig_ranger1_Func006C takes nothing returns boolean
if ( not Trig_ranger1_Func006Func001C() ) then
return false
endif
if ( not ( GetUnitTypeId(GetManipulatingUnit()) == 'H002' ) ) then
return false
endif
return true
endfunction
function Trig_ranger1_Conditions takes nothing returns boolean
if ( not Trig_ranger1_Func006C() ) then
return false
endif
return true
endfunction
function Trig_ranger1_Actions takes nothing returns nothing
call UnitRemoveItemSwapped( UnitItemInSlotBJ(GetManipulatingUnit(), 1), GetManipulatingUnit() )
call RemoveItem( GetManipulatedItem() )
call CreateItemLoc( 'I00T', GetRectCenter(GetPlayableMapRect()) )
call UnitAddItemSwapped( GetLastCreatedItem(), GetManipulatingUnit() )
call SetItemDroppableBJ( GetLastCreatedItem(), false )
endfunction
//===========================================================================
function InitTrig_ranger1 takes nothing returns nothing
set gg_trg_ranger1 = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_ranger1, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_ranger1, Condition( function Trig_ranger1_Conditions ) )
call TriggerAddAction( gg_trg_ranger1, function Trig_ranger1_Actions )
endfunction
the memory leak calculator says that it has 2 leaks. But it doesn't say how can i fix it. :nuts: :banghead:
----
This trigger's function:
The heroes' weapon always stored in the first slot, and when you pick up a new weapon your old one will be dropped, and the new one will be exchaned for a suitable weapon for you (ranger get bow instead of sword), and you cannot move it from the first slot. So when you pick up another weapon the item in the first slot (your weapon) will be dropped.
----
Please post some solution for this trigger to don't crash. Thank you.