- Joined
- Nov 3, 2004
- Messages
- 79
Hello i need help with this Jass script its a system "when a unit gets 3 items from type campaign each next gets dropped" pls i need badly help!
JASS:
function Trig_DropOnGet3 takes nothing returns nothing
local integer CountItemSlots = 1
local integer CountReagsInventory
local item ReagMani = GetManipulatedItem()
local unit manipulator = GetManipulatingUnit()
if ( GetItemType(ReagMani) == ITEM_TYPE_CAMPAIGN ) then
loop
exitwhen CountItemSlots == 6
if ( CountReagsInventory == 3 ) then
call UnitRemoveItem(manipulator, ReagMani)
else
endif
if ( GetItemType(UnitItemInSlotBJ(manipulator, CountItemSlots)) == ITEM_TYPE_CAMPAIGN ) then
set CountReagsInventory = CountReagsInventory + 1
else
endif
set CountItemSlots = CountItemSlots + 1
endloop
else
endif
endfunction
//===========================================================================
function InitTrig_Reag_System takes nothing returns nothing
set gg_trg_Reag_System = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Reag_System, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddAction( gg_trg_Reag_System, function Trig_DropOnGet3 )
endfunction