- Joined
- Nov 25, 2008
- Messages
- 1,309
Hi again, this trigger works properly but lags once per game when first run with a certain if true, but everytime after that, no lag. Strange right? Well, heres the whole trigger, if you need anything else let me know.
The laggy if is:
-Thanks
JASS:
function Trig_Item_Upgrades_Conditions takes nothing returns boolean
return GetUnitTypeId(GetTriggerUnit())!='H00B'
endfunction
function ai takes integer i,unit u returns item
return UnitAddItemByIdSwapped(i,u)
endfunction
function ri takes unit u,integer i returns nothing
call RemoveItem(GetItemOfTypeFromUnitBJ(u,i))
endfunction
function Trig_Item_Upgrades_Actions takes nothing returns nothing
local unit u=GetTriggerUnit()
local integer i=GetItemTypeId(GetManipulatedItem())
if i=='rde1'then
call RemoveItem(GetManipulatedItem())
if UnitHasItemOfTypeBJ(u,'I004')==true then
call ri(u,'I004')
call ai('I000',u)
elseif UnitHasItemOfTypeBJ(u,'I003')==true then
call ri(u,'I003')
call ai('I004',u)
elseif UnitHasItemOfTypeBJ(u,'I002')==true then
call ri(u,'I002')
call ai('I003',u)
elseif UnitHasItemOfTypeBJ(u,'I001')==true then
call ri(u,'I001')
call ai('I002',u)
else
call ai('I001',u)
endif
elseif i=='rat3'then
call RemoveItem(GetManipulatedItem())
if UnitHasItemOfTypeBJ(u,'I008')==true then
call ri(u,'I008')
call ai('I009',u)
elseif UnitHasItemOfTypeBJ(u,'I007')==true then
call ri(u,'I007')
call ai('I008',u)
elseif UnitHasItemOfTypeBJ(u,'I006')==true then
call ri(u,'I006')
call ai('I007',u)
elseif UnitHasItemOfTypeBJ(u,'I005')==true then
call ri(u,'I005')
call ai('I006',u)
else
call ai('I005',u)
endif
elseif i=='rst1'then
call RemoveItem(GetManipulatedItem())
if UnitHasItemOfTypeBJ(u,'I00B')==true then
call ri(u,'I00B')
call ai('I00A',u)
elseif UnitHasItemOfTypeBJ(u,'I00E')==true then
call ri(u,'I00E')
call ai('I00B',u)
elseif UnitHasItemOfTypeBJ(u,'I00C')==true then
call ri(u,'I00C')
call ai('I00E',u)
elseif UnitHasItemOfTypeBJ(u,'I00D')==true then
call ri(u,'I00D')
call ai('I00C',u)
else
call ai('I00D',u)
endif
elseif i=='rin1'then
call RemoveItem(GetManipulatedItem())
if UnitHasItemOfTypeBJ(u,'I00G')==true then
call ri(u,'I00G')
call ai('I00J',u)
elseif UnitHasItemOfTypeBJ(u,'I00H')==true then
call ri(u,'I00H')
call ai('I00G',u)
elseif UnitHasItemOfTypeBJ(u,'I00I')==true then
call ri(u,'I00I')
call ai('I00H',u)
elseif UnitHasItemOfTypeBJ(u,'I00F')==true then
call ri(u,'I00F')
call ai('I00I',u)
else
call ai('I00F',u)
endif
elseif i=='lhst'then
call UnitAddAbility(u,'A00N')
return
endif
endfunction
function InitTrig_Item_Upgrades takes nothing returns nothing
set gg_trg_Item_Upgrades=CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(gg_trg_Item_Upgrades,EVENT_PLAYER_UNIT_PICKUP_ITEM)
call TriggerAddCondition(gg_trg_Item_Upgrades,Condition(function Trig_Item_Upgrades_Conditions))
call TriggerAddAction(gg_trg_Item_Upgrades,function Trig_Item_Upgrades_Actions)
endfunction
JASS:
elseif i=='lhst'then
call UnitAddAbility(u,'A00N')
return
endif