|
发表于 2008-8-5 17:35:00
|
显示全部楼层
单位做..
这个的话无法保留物品效果
一下是一个我写的双重背包..在1.22下可以保留效果也保留CD的双背包
[jass]//=====================双重背包初始化===========================
function doublebag_start takes unit U returns nothing
local integer I=-1
local item array Item
loop
exitwhen(I==5)
set I=I+1
set Item[I]=UnitItemInSlot(U,I)
call SetItemPosition(UnitItemInSlot(U,I),0,0)
endloop
call UnitRemoveAbility(U,'A00A')
call UnitAddAbility(U,'A009')
set I=-1
loop
exitwhen(I==5)
set I=I+1
call UnitAddItemByIdSwapped('I001',U)
endloop
call UnitAddAbility(U,'A00A')
set I=-1
loop
exitwhen(I==5)
set I=I+1
call UnitAddItem(U,Item[I])
call UnitDropItemSlot(U,Item[I],I)
endloop
set I=-1
loop
exitwhen(I==5)
set I=I+1
set Item[I]=null
endloop
set U=null
endfunction
//=========================================
//===============切换背包技能==============
function doublebag_del takes nothing returns nothing
call RemoveItem( GetManipulatedItem() )
endfunction
function doublebag_tab takes unit U returns nothing
local integer I=-1
local item array Item
local trigger T=CreateTrigger()
loop
exitwhen(I==5)
set I=I+1
set Item[I]=I2ITEM(GetStoredInteger(udg_GC,I2S(H2I(U)),I2S(I)))
call StoreInteger(udg_GC,I2S(H2I(U)),I2S(I+6),H2I(Item[I]))
endloop
set I=-1
loop
exitwhen(I==5)
set I=I+1
set Item[I]=UnitItemInSlot(U,I)
call StoreInteger(udg_GC,I2S(H2I(U)),I2S(I),H2I(Item[I]))
call SetItemPosition(UnitItemInSlot(U,I),0,0)
endloop
call TriggerRegisterUnitEvent( T, U, EVENT_UNIT_DROP_ITEM )
call TriggerAddAction(T, function doublebag_del )
call UnitRemoveAbility(U,'A00A')
call UnitRemoveAbility(U,'A009')
call DestroyTrigger( T )
set T=null
call UnitAddAbility(U,'A009')
set I=-1
loop
exitwhen(I==5)
set I=I+1
set Item[I]=I2ITEM(GetStoredInteger(udg_GC,I2S(H2I(U)),I2S(I)))
if (Item[I]!=null)then
call UnitAddItemByIdSwapped( GetItemTypeId(Item[I]), U )
else
call UnitAddItemByIdSwapped('I001',U)
endif
endloop
call UnitAddAbility(U,'A00A')
set I=-1
loop
exitwhen(I==5)
set I=I+1
set Item[I]=I2ITEM(GetStoredInteger(udg_GC,I2S(H2I(U)),I2S(I+6)))
call UnitAddItem(U,Item[I])
call UnitDropItemSlot(U,Item[I],I)
endloop
set I=-1
loop
exitwhen(I==5)
set I=I+1
set Item[I]=null
endloop
endfunction[/jass]
给你个参考 |
|