Name | Type | is_array | initial_value |
Abducties | integer | Yes | |
AbductionPoint | location | Yes | |
BuildPoint | location | No | |
CameraPoint | location | No | |
Center | location | No | |
Civilian | unitcode | Yes | |
CraterPoint | location | No | |
Debris | group | No | |
DebrisPoint | location | No | |
Irradiate | unit | No | |
IrradiateItem | itemcode | Yes | |
IrradiatePoint | location | No | |
IrradiateTrigger | trigger | Yes | |
IrradiateUnit | unitcode | Yes | |
ItemPoint | location | No | |
ItemType | itemcode | Yes | |
Level | integer | No | |
MapExit | location | No | |
MapExitRegion | rect | Yes | |
MechUnit | unitcode | Yes | |
MilitaryBuilding | unitcode | Yes | |
MilitaryBuildingGroup | group | No | |
RandomPlayer | player | Yes | |
Ships | group | No | |
SpawnTroops | boolean | No | |
Timer | timer | No | |
TroopType | unitcode | Yes | |
UnitPoint | location | No | |
VictoryGroup | group | No | |
WarpinPoint | location | No | |
WarpinUnit | group | No |
function Trig_Combine_Items_Conditions takes nothing returns boolean
if ( not ( GetItemCharges(GetManipulatedItem()) > 0 ) ) then
return false
endif
return true
endfunction
function Trig_Combine_Items_Actions takes nothing returns nothing
local integer ITEMCOUNT
local integer ITEMLOOP
local integer CHARGES
local integer MAXIMUM
local item NEWITEM
local unit OURUNIT
set MAXIMUM = 15
set ITEMCOUNT = 0
set ITEMLOOP = 0
set CHARGES = 0
set NEWITEM = GetManipulatedItem()
set OURUNIT = GetManipulatingUnit()
loop
exitwhen ITEMLOOP > 6
if ((GetItemTypeId(NEWITEM)) == (GetItemTypeId(UnitItemInSlotBJ(OURUNIT, ITEMLOOP)))) then
if ((GetItemCharges(UnitItemInSlotBJ(OURUNIT, ITEMLOOP)) + GetItemCharges(NEWITEM)) <= MAXIMUM) then
if not ( (UnitItemInSlotBJ(OURUNIT, ITEMLOOP)) == (NEWITEM)) then
set CHARGES = (GetItemCharges(UnitItemInSlotBJ(OURUNIT, ITEMLOOP))) + GetItemCharges(NEWITEM)
call SetItemCharges( UnitItemInSlotBJ(OURUNIT, ITEMLOOP), CHARGES )
call RemoveItem( NEWITEM )
set ITEMLOOP=7
endif
endif
endif
if ( ITEMLOOP < 7 ) then
set ITEMLOOP = ITEMLOOP + 1
endif
endloop
endfunction
//===========================================================================
function InitTrig_Combine_Items takes nothing returns nothing
set gg_trg_Combine_Items = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Combine_Items, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddCondition( gg_trg_Combine_Items, Condition( function Trig_Combine_Items_Conditions ) )
call TriggerAddAction( gg_trg_Combine_Items, function Trig_Combine_Items_Actions )
endfunction