找回密码
 点一下
楼主: flowersigh

如何实现busy效果

[复制链接]
发表于 2008-7-21 16:03:56 | 显示全部楼层
那你的意思就是创建个没有攻击力的马甲发布攻击一次命令?
回复

使用道具 举报

发表于 2008-7-21 16:04:47 | 显示全部楼层
引用第20楼zhuzeitou于2008-07-21 16:03发表的  :
那你的意思就是创建个没有攻击力的马甲发布攻击一次命令?


是的~~应该不是很麻烦吧
回复

使用道具 举报

发表于 2008-7-21 16:06:44 | 显示全部楼层
恩,的确不算太麻烦………………
回复

使用道具 举报

 楼主| 发表于 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
回复

使用道具 举报

发表于 2008-7-21 21:53:00 | 显示全部楼层
呵呵,最后回到我一开始提到的书本方法了口牙~~
回复

使用道具 举报

发表于 2008-7-21 22:02:58 | 显示全部楼层
有点不太明白
用冰冻喷吐时  为什么要立即删除单位
回复

使用道具 举报

 楼主| 发表于 2008-7-21 22:37:18 | 显示全部楼层
立即删除只是为了测试多少时间见效,主要是不能做到精确控制,中间就会存在很多的变数,让一个单位开始busy,但是实际他可能0.1秒之后才busy,中间就可能发生意想不到的意外( 可能用户又选择点了其他技能什么的,而本来应该是不能点其他技能的,这样技能做起来就要考虑挺多方面,很麻烦啊 )
回复

使用道具 举报

发表于 2008-7-21 22:41:25 | 显示全部楼层
哦 明白了
感谢回答
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 点一下

本版积分规则

Archiver|移动端|小黑屋|地精研究院

GMT+8, 2024-7-21 00:31 , Processed in 0.029551 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表