- Joined
- May 20, 2006
- Messages
- 43
Well, here we go:
There seems to be an exploit to this coding that allows people to go from 1 item in the stack to 5 items, just by adding on a 2nd item. Just curious if someone could pinpoint the source of this problem. I believe it is here. Thanks!
JASS:
function Trig_Item_Charge_Actions takes nothing returns nothing
local item i = GetManipulatedItem()
local unit u = GetTriggerUnit()
local integer a = 1
local integer it = GetItemTypeId(i)
local integer ci = GetItemCharges(i)
local integer cr
if GetItemTypeId(i) == 'I024' or GetItemTypeId(i) == 'I027' or GetItemTypeId(i) == 'I026' or GetItemTypeId(i) == 'I01A' or GetItemTypeId(i) == 'I00X' or GetItemTypeId(i) == 'I00K' or GetItemTypeId(i) == 'I00V' or GetItemTypeId(i) == 'I01B' or GetItemTypeId(i) == 'I00R' or GetItemTypeId(i) == 'I019' or GetItemTypeId(i) == 'I00W' or GetItemTypeId(i) == 'I00Y' or GetItemTypeId(i) == 'I00I' or GetItemTypeId(i) == 'I00A' or GetItemTypeId(i) == 'I00C' or GetItemTypeId(i) == 'I00H' or GetItemTypeId(i) == 'I016' or GetItemTypeId(i) == 'I00Z' or GetItemTypeId(i) == 'I009' or GetItemTypeId(i) == 'I00T' or GetItemTypeId(i) == 'I00B' or GetItemTypeId(i) == 'I00S' or GetItemTypeId(i) == 'I00L' or GetItemTypeId(i) == 'I00Q' or GetItemTypeId(i) == 'I004' or GetItemTypeId(i) == 'I005' or GetItemTypeId(i) == 'I01M' or GetItemTypeId(i) == 'I01N' then
loop
exitwhen a > 6
if GetItemTypeId(UnitItemInSlotBJ(u,a)) == it and UnitItemInSlotBJ(u,a) != i and GetItemCharges(UnitItemInSlotBJ(u,a)) < 5 and GetItemCharges(UnitItemInSlotBJ(u,a)) > 0 then
set cr = GetItemCharges(UnitItemInSlotBJ(u,a))
if cr + ci > 5 then
call SetItemCharges(UnitItemInSlotBJ(u,a), 5)
call SetItemCharges(i, ci - (5 - cr))
else
call RemoveItem(i)
call SetItemCharges( UnitItemInSlotBJ(u,a),cr + ci)
endif
set a = 5
endif
set a = a + 1
endloop
endif
endfunction
//===========================================================================
function InitTrig_Item_Charge takes nothing returns nothing
set gg_trg_Item_Charge = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Item_Charge, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerAddAction( gg_trg_Item_Charge, function Trig_Item_Charge_Actions )
endfunction
There seems to be an exploit to this coding that allows people to go from 1 item in the stack to 5 items, just by adding on a 2nd item. Just curious if someone could pinpoint the source of this problem. I believe it is here. Thanks!
Last edited by a moderator: