搜索
查看: 558|回复: 8

[求助] lua的语句怎么作用于英雄啊

[复制链接]
发表于 2022-5-17 17:14:51 | 显示全部楼层 |阅读模式
function RunLuaScript19(actor)
  local item1 = actor:getUseItem(17)  
  if item1 then
        item1:setItemLook(858)--异形
        actor:refItemInfo(item1, 1)--更新装备位显示
        actor:refFeature()--更新客户端角色外观
        print("["..actorname.."]通过脚本命令执行LUA函数1")
  end
end
好比说这段语句。我怎么让他实现于英雄身上
 楼主| 发表于 2022-5-17 17:16:49 | 显示全部楼层
@0158 大佬
 楼主| 发表于 2022-5-17 17:18:18 | 显示全部楼层
@1580  求助大佬
发表于 2022-5-17 18:02:15 | 显示全部楼层
function RunLuaScript19(actor)
       
  local heroActor = actor:getHero()--获取英雄对像  检测是否为英雄,
  if heroActor ~= nil then
        local heroname = heroActor:getCharName()

       
       
  local item1 = heroActor:getUseItem(17)  
  if item1 then
        item1:setItemLook(6195)--异形
        heroActor:refItemInfo(item1, 1)--更新装备位显示
        heroActor:refFeature()--更新客户端角色外观
        print("["..heroname.."]通过脚本命令执行LUA函数1")
  end
end


end
 楼主| 发表于 2022-5-17 18:12:08 | 显示全部楼层
咔咔咔咔咔咔 发表于 2022-5-17 18:02
function RunLuaScript19(actor)
       
  local heroActor = actor:getHero()--获取英雄对像  检测是否为英雄, ...

感谢大佬
发表于 2022-5-18 09:34:45 | 显示全部楼层
咔咔咔咔咔咔 发表于 2022-5-17 18:02
function RunLuaScript19(actor)
       
  local heroActor = actor:getHero()--获取英雄对像  检测是否为英雄, ...

主要这actor确定是主体吗,在哪使用
发表于 2022-5-18 09:47:00 | 显示全部楼层
上线发呆 发表于 2022-5-18 09:34
主要这actor确定是主体吗,在哪使用

确实是生效了。。然后不知道为什么他获取了一次英雄名字。
 楼主| 发表于 2022-5-18 09:49:08 | 显示全部楼层
上线发呆 发表于 2022-5-18 09:34
主要这actor确定是主体吗,在哪使用

大佬出了他这种写法 还有其他方法吗 还是说不用这条语句确认也可以
发表于 2022-5-18 17:21:43 | 显示全部楼层
上线发呆 发表于 2022-5-18 09:34
主要这actor确定是主体吗,在哪使用

对呀.....
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|HGEM2论坛

GMT+8, 2024-9-22 15:38 , Processed in 0.460410 second(s), 13 queries .

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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