The trigger methode just works for 1 boot only too -.-
0.02 just for a slowing item is a bit to much
scope BigScaleSlow initializer Init
// gain it
private function Conditions_A takes nothing returns boolean
return GetItemTypeId(GetManipulatedItem()) == 'rde4'
endfunction
private function Actions_A takes nothing returns nothing
local unit u = GetTriggerUnit()
local item i = GetManipulatedItem()
local integer c = 0
local integer itemIndex = UnitInventorySize(u)
loop
exitwhen 0 > itemIndex
if UnitItemInSlot(u,itemIndex) != null and GetItemTypeId(i) == 'rde4' then
set c = c + 1
endif
set itemIndex = itemIndex - 1
endloop
if GetTriggerEventId() == EVENT_PLAYER_UNIT_DROP_ITEM then
set c = c - 1
endif
call SetUnitMoveSpeed(u,GetUnitDefaultMoveSpeed(u)-50*c)
set u = null
set i = null
endfunction
private function Init takes nothing returns nothing
local trigger trg = CreateTrigger()
call TriggerAddAction(trg, function Actions_A)
call TriggerAddCondition(trg, Condition(function Conditions_A))
call TriggerRegisterAnyUnitEventBJ( trg, EVENT_PLAYER_UNIT_PICKUP_ITEM )
call TriggerRegisterAnyUnitEventBJ( trg, EVENT_PLAYER_UNIT_DROP_ITEM )
//call TriggerRegisterAnyUnitEventBJ( trg, EVENT_PLAYER_UNIT_SELL_ITEM )
//call TriggerRegisterAnyUnitEventBJ( trg, EVENT_PLAYER_UNIT_PAWN_ITEM )
set trg = null
endfunction
endscope
JASS:scope BigScaleSlow initializer Init private function Actions_A takes nothing returns nothing local unit u local item i local integer c = 0 local integer itemIndex if GetItemTypeId(GetManipulatedItem()) == 'rde4' then set u = GetTriggerUnit() set i = GetManipulatedItem() set itemIndex = = UnitInventorySize(u) loop exitwhen 0 > itemIndex if UnitItemInSlot(u,itemIndex) != null and GetItemTypeId(i) == 'rde4' then set c = c + 1 endif set itemIndex = itemIndex - 1 endloop if GetTriggerEventId() == EVENT_PLAYER_UNIT_DROP_ITEM then set c = c - 1 endif call SetUnitMoveSpeed(u,GetUnitDefaultMoveSpeed(u)-50*c) set u = null set i = null endif endfunction private function Init takes nothing returns nothing local trigger trg = CreateTrigger() call TriggerAddCondition(trg, Condition(function Actions_A)) call TriggerRegisterAnyUnitEventBJ( trg, EVENT_PLAYER_UNIT_PICKUP_ITEM ) call TriggerRegisterAnyUnitEventBJ( trg, EVENT_PLAYER_UNIT_DROP_ITEM ) //call TriggerRegisterAnyUnitEventBJ( trg, EVENT_PLAYER_UNIT_SELL_ITEM ) //call TriggerRegisterAnyUnitEventBJ( trg, EVENT_PLAYER_UNIT_PAWN_ITEM ) set trg = null endfunction endscope