LUACN论坛

 找回密码
 加入我们

QQ登录

只需一步,快速开始

搜索
热搜: YJWOW MagicStone BoL
查看: 457|回复: 8

[函数] 335怎么写跟随后攻击啊?

[复制链接]
发表于 2022-7-11 00:09:28 | 显示全部楼层 |阅读模式
我写了个跟随宏
if BeeCastSpellFast() then return;end
if UnitName("focus") and ((BeeRange("focus")<=25 and BeeRange("focus")>=10) or not BeeUnitIsFollow()) then
    FollowUnit("focus");
end
还有一个攻击宏的目标的代码。,,,,不知道对不对
--自动攻击焦点目标
if not IsMounted("player")   then
    BeeRun("/target [harm][@focustarget,harm]");
    return true;
end

这俩怎么实现啊?跟随的宏实现了,攻击的宏没反应啊?????
回复

使用道具 举报

发表于 2022-7-11 19:27:43 | 显示全部楼层
[Lua] 纯文本查看 复制代码
local focus = "focus"
local focuscombat = BeeUnitAffectingCombat(focus)
local attacking = BeeUnitAffectingCombat()

if 干饭 or 喝水 or 坐骑 or 施法中 or 光荣牺牲 then
    return true;
end


if BeeRange(focus) < 35
and focuscombat 
and not attacking then
    if UnitExists("focustarget")
    and UnitIsEnemy("focustarget") then
        RunMacroText("/target focustarget\n/attack")
    end
end
回复 支持 反对

使用道具 举报

 楼主| 发表于 2022-7-11 22:55:14 | 显示全部楼层
idlng 发表于 2022-7-11 07:27 PM
[mw_shl_code=lua,true]local focus = "focus"
local focuscombat = BeeUnitAffectingCombat(focus)
loca ...

调试不过啊,这个干饭喝水是什么鬼啊?
回复 支持 反对

使用道具 举报

发表于 2022-7-11 23:00:35 | 显示全部楼层
你看不见我~ 发表于 2022-7-11 10:55 PM
调试不过啊,这个干饭喝水是什么鬼啊?

干饭

就是

BeePlayerBuffTime("喝水")>0 --干饭
or BeePlayerBuffTime("进食")>0 --喝水
回复 支持 反对

使用道具 举报

 楼主| 发表于 2022-7-12 09:24:29 | 显示全部楼层

大佬,,看看我这个写的,,总是跟随,不停止,而且攻击方向和距离都不对,稍微方向不对,或者远一点就攻击不到,什么问题啊?
local focus = "focus"
local focuscombat = BeeUnitAffectingCombat(focus)
local attacking = BeeUnitAffectingCombat()

if BeePlayerBuffTime("喝水")>0 or BeePlayerBuffTime("进食")>0 or BeePlayerBuffTime("召唤军马")>0 then
    return true;
end
if BeeCastSpellFast() then return;end
if UnitName("focus") and ((BeeRange("focus")<=30 and BeeRange("focus")>=20 or not BeeUnitIsFollow())) then
    FollowUnit("focus");
end

if BeeRange(focus) < 35
and focuscombat
and not attacking then
    if UnitExists("focustarget")
    and UnitIsEnemy("focustarget") then
        RunMacroText("/target focustarget\n/attack")
    end
end
回复 支持 反对

使用道具 举报

发表于 2022-7-16 14:24:27 | 显示全部楼层
回复 支持 反对

使用道具 举报

发表于 2022-9-5 14:13:01 | 显示全部楼层
进来学习下科普贴啊!!!
回复 支持 反对

使用道具 举报

发表于 2022-9-9 14:48:11 | 显示全部楼层
进来学习。。。感谢大佬科普。。。
回复 支持 反对

使用道具 举报

发表于 2022-10-23 09:41:02 | 显示全部楼层
学习。。。感谢大佬科普。。。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 加入我们

本版积分规则

小黑屋|手机版|Archiver|LUACN论坛

GMT+8, 2024-5-5 02:22 AM , Processed in 0.055168 second(s), 30 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

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