Name | Type | is_array | initial_value |
DrainButton | button | Yes | |
FastSpawn | dialog | No | |
foggrp | group | No | |
fogmods | fogmodifier | Yes | |
Group1 | group | No | |
Group2 | group | No | |
Group3 | group | No | |
InnerFire | group | No | |
Integer1 | handle | No | |
integer3 | integer | No | |
LifeButton | dialog | No | |
NoobTimer | timer | No | |
NoobTimerW | timerdialog | No | |
NormalSpawn | dialog | No | |
Point | location | No | |
Point2 | location | No | |
pointtorch | location | No | |
SlowSpawn | dialog | No | |
SpawnButton | button | Yes | |
Team1 | group | No | |
Team2 | group | No | |
Team3 | group | No | |
test | rect | No | |
torch | unit | No | |
Tot1 | group | No | |
Tot2 | group | No | |
Tot3 | group | No | |
trap1 | group | No | |
trap2 | group | No | |
trap3 | group | No | |
Unit | unit | Yes |
function Trig_Item_Stack_Conditions takes nothing returns boolean
return GetItemCharges(GetManipulatedItem()) > 0
endfunction
function Trig_Item_Stack_Actions takes nothing returns nothing
local integer i = 0
local item iteminslot
loop
set iteminslot = UnitItemInSlot(GetManipulatingUnit(), i)
if ( GetItemTypeId(iteminslot) == GetItemTypeId(GetManipulatedItem()) and iteminslot != GetManipulatedItem()) then
call SetItemCharges( iteminslot, ( GetItemCharges(iteminslot) + GetItemCharges(GetManipulatedItem()) ) )
call RemoveItem( GetManipulatedItem() )
set i = 5
// To end the loop i is increased
endif
set i = i + 1
exitwhen i > 5
endloop
set i = 0
set iteminslot = null
endfunction
// ==================
function InitTrig_Item_Stack takes nothing returns nothing
set gg_trg_Item_Stack = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Item_Stack, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Item_Stack, Condition( function Trig_Item_Stack_Conditions ) )
call TriggerAddAction( gg_trg_Item_Stack, function Trig_Item_Stack_Actions )
endfunction
function Trig_Item_Move_Conditions takes nothing returns boolean
return GetIssuedOrderId() > 852001 and GetIssuedOrderId() < 852008
endfunction
function Trig_Item_Move_Actions takes nothing returns nothing
local integer i = GetItemCharges(GetOrderTargetItem())
if GetOrderTargetItem() == UnitItemInSlot(GetOrderedUnit(), GetIssuedOrderId()-852002) then
// Clicked on the same field again
if i > 1 then
set i = i/2
call SetItemCharges(GetOrderTargetItem(), GetItemCharges(GetOrderTargetItem()) - i)
call DisableTrigger(gg_trg_Item_Stack)
call UnitAddItemByIdSwapped(GetItemTypeId(GetOrderTargetItem()), GetTriggerUnit())
call EnableTrigger(gg_trg_Item_Stack)
call SetItemCharges(bj_lastCreatedItem, i)
endif
else
// Clicked on another field
if i > 0 and GetItemTypeId(GetOrderTargetItem()) == GetItemTypeId(UnitItemInSlot(GetOrderedUnit(), GetIssuedOrderId()-852002)) then
call SetItemCharges(GetOrderTargetItem(), GetItemCharges(GetOrderTargetItem()) + GetItemCharges(UnitItemInSlot(GetOrderedUnit(), GetIssuedOrderId()-852002)))
call RemoveItem(UnitItemInSlot(GetOrderedUnit(), GetIssuedOrderId()-852002))
endif
endif
set i = 0
endfunction
//==============
function InitTrig_Item_Move takes nothing returns nothing
set gg_trg_Item_Move = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Item_Move, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
call TriggerAddCondition( gg_trg_Item_Move, Condition( function Trig_Item_Move_Conditions ) )
call TriggerAddAction( gg_trg_Item_Move, function Trig_Item_Move_Actions )
endfunction