|
楼主 |
发表于 2008-7-21 21:37:59
|
显示全部楼层
试验了一下冰冻喷吐,折腾了大半天,原来是攻击必须是远程攻击才能生效
但是发布命令,让辅助单位攻击,不能在函数内生效,怎么也要回到系统之后才能生效,把攻击的动画时间归零,远程导弹速度设置为0(不需要时间), 辅助单位的方向对准被打的单位,仍然需要sleep 0秒之后才能生效,而且多次测试后发现,sleep 0秒之后,大哟90%能让buff生效,但是10%可能还没有发出命令,单位就已经被删除了
总结,还是吃书比较好, 能立即生效(在函数执行时就立即生效了), 把智力之书的技能,改成风暴之锤,让可以对自己用,伤害,魔法消耗等等都改成0,把buff的描述等换一下,代码如下
function unit_is_item_in_slot takes unit u, integer nSlot returns boolean
local item it = UnitItemInSlot( u, nSlot )
if it == null then
return false
else
set it = null
return true
endif
endfunction
function get_stun_book_id takes integer nsec returns integer
if nsec <= 1 then
return ABI_STUN1_BOOK_ID
elseif nsec == 2 then
return ABI_STUN2_BOOK_ID
elseif nsec == 3 then
return ABI_STUN3_BOOK_ID
elseif nsec == 4 then
return ABI_STUN4_BOOK_ID
elseif nsec == 5 then
return ABI_STUN5_BOOK_ID
else
return ABI_STUN6_BOOK_ID
endif
endfunction
function eat_book takes unit u, integer id returns nothing
local item it = CreateItem( id, GetUnitX(u), GetUnitY(u) )
local item it_old
if unit_is_item_in_slot( u, 0 ) and unit_is_item_in_slot( u, 1 ) and unit_is_item_in_slot( u, 2 ) and unit_is_item_in_slot( u, 3 ) and unit_is_item_in_slot( u, 4 ) and unit_is_item_in_slot( u, 5 ) then
set it_old = UnitItemInSlot(u,5)
call SetItemPosition( it_old, GetUnitX(u), GetUnitY(u) )
call UnitAddItem( u, it )
call UnitAddItem( u, it_old )
set it_old = null
else
call UnitAddItem( u, it )
endif
call RemoveItem( it )
set it = null
endfunction
function busy takes unit u, integer nsec returns nothing
call eat_book( u, get_stun_book_id(nsec) )
endfunction
function is_busy takes unit u returns boolean
return GetUnitAbilityLevel( u, STUN_BUFF_ID ) > 0
endfunction |
|