zyhhll1988 发表于 2022-6-27 15:01:20

飞升计划人物三个能量条怎么控制怒气写法

最近在玩飞升计划,但是人物法力值,怒气,和能量条都有,共存的。然后下面条件并不能控制怒气大于50释放英勇打击

local RAGE = UnitPower("player")
if BeeUnitAffectingCombat() and BeeUnitMana("player","%")>=50 and BeeIsRun("Heroic Strike")
then   
    BeeRun("/cast Heroic Strike")
end


哪位大佬能指点下怎么写吗

idlng 发表于 2022-6-27 15:55:31

这个就麻烦,只能获取默认的能量数值
local p = "player"
UnitPower(p,type)
print(type)
看看游戏默认用的是哪个类型的能量先,

idlng 发表于 2022-6-27 15:59:53

UnitPowerType

Returns a number corresponding to the power type (e.g., mana, rage or energy) of the specified unit.

powerType, powerToken, altR, altG, altB = UnitPowerType(unit[,index])
Arguments
unit
String (unitId) - The unit whose power type to query.
index
number - Optional value for classes with multiple powerTypes. If not specified, information about the first (currently active) power type will be returned.
Returns
powerType
Enum.PowerType - the ID corresponding the the unit's queried power type.
powerToken
string - also the power type:
"MANA"
"RAGE"
"FOCUS"
"ENERGY"
"HAPPINESS"
"RUNES"
"RUNIC_POWER"
"SOUL_SHARDS"
"ECLIPSE"
"HOLY_POWER"
"AMMOSLOT" (vehicles, 3.1)
"FUEL" (vehicles, 3.1)
"STAGGER" (vehicles, 5.1)
"CHI"
"INSANITY"
"ARCANE_CHARGES"
"FURY"
"PAIN"
altR
number - Alternative red component for this power type, see details. Nil for most of the standard power types.
altG
number - Alternative green component for this power type, see details. Nil for most of the standard power types.
altB
number - Alternative blue component for this power type, see details. Nil for most of the standard power types.
Example
The following snippet displays the player's current mana/rage/energy/etc in the default chat frame.

local t = { = "mana", = "rage", = "focus", = "energy", = "happiness", = "runes", = "runic power", = "soul shards", = "eclipse", = "holy power"}
print(UnitName("player") .. "'s " .. t .. ": " .. UnitPower("player"))

Details
Colors of all typical power types are stored in the PowerBarColor global table. Some special types may implement their own color as returned by the 3rd to 5th return values of UnitPowerType. For most of the standard power types they return nil however. FrameXML implements it the following way (with a fallback to "MANA"):
local powerType, powerToken, altR, altG, altB = UnitPowerType(UnitId);
local info = PowerBarColor;

if ( info ) then
--The PowerBarColor takes priority
r, g, b = info.r, info.g, info.b;
else
if ( not altR) then
-- Couldn't find a power token entry. Default to indexing by power type or just mana ifwe don't have that either.
info = PowerBarColor or PowerBarColor["MANA"];
r, g, b = info.r, info.g, info.b;
else
r, g, b = altR, altG, altB;
end
Also See:
UnitPower

zyhhll1988 发表于 2022-6-27 16:05:56

显示 function 4BDFA940

idlng 发表于 2022-6-27 16:11:00

zyhhll1988 发表于 2022-6-27 04:05 PM
显示 function 4BDFA940

不是应该显示 mana 或者 energy 或者 Fury这些么 {:5_254:}{:5_254:}

idlng 发表于 2022-6-27 16:16:11

https://i.ibb.co/m0JkYSM/20220627100959.jpg

UnitPowerType可以获取职业使用多能量类型的类型.

但仅限知道哪些类型,
获取每种能量的数值, 我还不知道,
用UnitMana或者UnitPower只能获取当前使用的能量,
例如 小德变身前 是蓝 "mana" 变身豹形态后是 "energy"

idlng 发表于 2022-6-27 16:25:12


你可以尝试, 用UnitPower函数指定能量类型 或许能行我没有

https://i.ibb.co/K9t4mHw/20220627101729.jpg

指定蓝条
local a = UnitPower("player","mana") ---蓝量
local b = UnitPower("player","energy") ---盗贼能量
local c = UnitPower("player","rage") --战士怒气
print("蓝:"..a.."能量:"..b.."怒气:"..c)
根据你有的3个对应数值条改, 然后print一下每个数值 是否有相对应的数值
测试所有可能

zyhhll1988 发表于 2022-6-27 18:27:35

有的,显示蓝3011 能量3011 怒气3011

zyhhll1988 发表于 2022-6-27 18:58:55

if UnitPower("player","1")>=45 then
    BeeRun("/cast Heroic Strike","target")
end

这么写成功了,谢谢哈

idlng 发表于 2022-6-27 23:23:38

本帖最后由 idlng 于 2022-6-27 11:25 PM 编辑

zyhhll1988 发表于 2022-6-27 06:58 PM
if UnitPower("player","1")>=45 then
    BeeRun("/cast Heroic Strike","target")
end

那么恭喜你,,

就是按照这个格式来,
https://i.ibb.co/K9t4mHw/20220627101729.jpg

我也算是学到了,哈
3.02之后 UnitMana 被UnitPower替换.
页: [1] 2
查看完整版本: 飞升计划人物三个能量条怎么控制怒气写法