对战初始化
事件
Map initialization
环境
动作
Set NullItemId = Null
Set ChangeBag = 切换物品栏
Set ItemBagA = 物品栏 A
Set ItemBagB = 物品栏 B
Custom script: set bj_wantDestroyGroup = true
单位组 - Pick every unit in (Units in (Playable map area)) and do (Actions)
Loop - 动作
Set TempInt = (TempInt + 1)
单位 - Set the custom value of (Picked unit) to TempInt
单位 - Remove ItemBagA from (Picked unit)
单位 - Remove ItemBagB from (Picked unit)
单位 - Add ItemBagA to (Picked unit)
For each (Integer A) from 1 to 6, do (Actions)
Loop - 动作
英雄 - Create Null and give it to (Picked unit)
Set HeroItem[((12 x TempInt) + ((Integer A) - 1))] = (Last created item)
单位 - Add ItemBagB to (Picked unit)
ChangeBag
function Trig_ChangeBag_Conditions takes nothing returns boolean
return GetSpellAbilityId() == udg_ChangeBag
endfunction
function Trig_ChangeBag_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local integer data = GetUnitUserData(u)
local integer i = 0
loop
exitwhen i > 5
if UnitItemInSlot(u, i) == null then
call UnitAddItemToSlotById( u,udg_NullItemId,i )
endif
set udg_HeroItem[12*data + 6+i] = UnitItemInSlot(u, i)
set i = i + 1
endloop
call UnitRemoveAbility(u,udg_ItemBagA)
call UnitRemoveAbility(u,udg_ItemBagB)
call UnitAddAbility(u,udg_ItemBagA)
set i = 0
loop
exitwhen i > 5
call UnitAddItem(u,udg_HeroItem[12*data + 6+i])
set i = i + 1
endloop
call UnitAddAbility(u,udg_ItemBagB)
set i = 0
loop
exitwhen i > 5
if not UnitAddItem(u,udg_HeroItem[12*data + i]) then
call UnitAddItemToSlotById( u,udg_NullItemId,i )
endif
set udg_HeroItem[12*data + i] = udg_HeroItem[12*data + 6+i]
set i = i + 1
endloop
set i = 0
loop
exitwhen i > 5
if GetItemTypeId( UnitItemInSlot(u, i) ) == udg_NullItemId then
call RemoveItem( UnitItemInSlot(u, i) )
endif
set i = i + 1
endloop
set u = null
endfunction
//===========================================================================
function InitTrig_ChangeBag takes nothing returns nothing
set gg_trg_ChangeBag = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_ChangeBag, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_ChangeBag, Condition( function Trig_ChangeBag_Conditions ) )
call TriggerAddAction( gg_trg_ChangeBag, function Trig_ChangeBag_Actions )
endfunction
附件: [[下载]能保留效果的双物品栏] 8Il1wwb3.rar (1970-1-1 08:00, 18.34 K)责任编辑:admin
进入论坛参与针对本文章的讨论
