修改天龙八部珍兽回春丹效果:增加潜能点
想在不删除原有效果的前提下给珍兽回春丹增加一种效果“每使用一次珍兽回春丹增加1点珍兽未分配潜能点”
问了豆包修改的lua文件改了后没一丁点效果。求大佬帮忙写个真实有效的lua脚本。
以下是豆包给的代码:使用后屁用没有,豆包还是不太给力,求大佬帮忙写个真实有效的lua脚本。
-- 珍兽回春丹
-- ItemID = 30607001
-- 702001
-- 增加宠物生命值和快乐度 + 额外增加1点珍兽潜能点
-- 物品可以使用1000次
-- 以后每次使用扣一次,扣完就删除物品
-- 宠物通用功能脚本
x702001_g_petCommonId = PETCOMMON
--******************************************************************************
-- 以下部分需要是需要修改的部分
--******************************************************************************
--脚本号 (改成正确脚本号)
x702001_g_scriptId = 702001
-- 增加值 (根据要求改写具体数值)
x702001_g_HPValue = 10000 -- 生命值增加值
x702001_g_MaxHPValue = 0 -- 最大生命值增加值
x702001_g_LifeValue = 0 -- 寿命增加值
x702001_g_HappinessValue = 1 -- 快乐度增加值
x702001_g_MaxUseCount = 1000 -- 最大使用次数1000次
x702001_g_AddPotential = 1 -- 新增:每次使用 +1 潜能点
--标准效果ID (改成宠物吃宠粮的特效)
--g_ImpactID = 0
--******************************************************************************
-- 以上部分需要是需要修改的部分
--******************************************************************************
--脚本
--**********************************
--必须返回 1 才能正确执行以下流程
--**********************************
function x702001_IsSkillLikeScript( sceneId, selfId)
return 1
end
--**********************************
--条件检测入口:
--系统会在技能检测的时间点调用这个接口,并根据这个函数的返回值确定以后的流程是否执行。
--返回1:条件检测通过,可以继续执行;返回0:条件检测失败,中断后续执行。
--**********************************
function x702001_OnConditionCheck( sceneId, selfId )
--校验使用的物品
if(1~=LuaFnVerifyUsedItem(sceneId, selfId)) then
return 0
end
-- 得到当前正在使用的物品的背包位置
nIndex = LuaFnGetBagIndexOfUsedItem( sceneId, selfId )
ret = CallScriptFunction( x702001_g_petCommonId, "IsPetCanUseFood", sceneId, selfId, nIndex )
return ret
end
--**********************************
--消耗检测及处理入口:
--系统会在技能消耗的时间点调用这个接口,并根据这个函数的返回值确定以后的流程是否执行。
--返回1:消耗处理通过,可以继续执行;返回0:消耗检测失败,中断后续执行。
--注意:这不光负责消耗的检测也负责消耗的执行。
--**********************************
function x702001_OnDeplete( sceneId, selfId )
if(0<LuaFnDepletingUsedItem(sceneId, selfId)) then
return 1
end
return 0
end
--**********************************
--只会执行一次入口:
--聚气和瞬发技能会在消耗完成后调用这个接口(聚气结束并且各种条件都满足的时候),而引导
--技能也会在消耗完成后调用这个接口(技能的一开始,消耗成功执行之后)。
--返回1:处理成功;返回0:处理失败。
--注:这里是技能生效一次的入口
--**********************************
function x702001_OnActivateOnce( sceneId, selfId )
local bagId = LuaFnGetBagIndexOfUsedItem( sceneId, selfId )
local UseValue = GetBagItemParam( sceneId, selfId, bagId, 8, 2 )
local ValidValue = x702001_g_MaxUseCount - UseValue
-- PrintNum(UseValue)
local petGUID_H = LuaFnGetHighSectionOfTargetPetGuid( sceneId, selfId )
local petGUID_L = LuaFnGetLowSectionOfTargetPetGuid( sceneId, selfId )
local valueHP = LuaFnGetPetHP( sceneId, selfId, petGUID_H, petGUID_L )
local MaxHP = LuaFnGetPetMaxHP( sceneId, selfId, petGUID_H, petGUID_L )
local valueHappy = LuaFnGetPetHappiness( sceneId, selfId, petGUID_H, petGUID_L )
local MaxHappiness = 100
-- PrintNum(valueHP)
-- PrintNum(MaxHP)
-- PrintNum(valueHappy)
if valueHP == MaxHP and valueHappy == MaxHappiness then
x702001_ShowMsg( sceneId, selfId, "该宠物不需要使用宠粮")
return 0
end
--消耗一次珍兽回春丹
if bagId >= 0 then
if UseValue >= x702001_g_MaxUseCount then --记录的使用次数大于等于最大可用次数,理论上不可能出现.
return 0
end
local CurValue = UseValue + 1
-- PrintNum(CurValue)
SetBagItemParam( sceneId, selfId, bagId, 4, 2, x702001_g_MaxUseCount ) --设置最大次数
SetBagItemParam( sceneId, selfId, bagId, 8, 2, CurValue ) --设置已用次数
--------------参数设置安全性检测,虽然理论上参数设置不会失败
local CheckParam1 = GetBagItemParam( sceneId, selfId, bagId, 4, 2 )
local CheckParam2 = GetBagItemParam( sceneId, selfId, bagId, 8, 2 )
-- PrintNum(CheckParam1)
-- PrintNum(CheckParam2)
if CheckParam1 ~= x702001_g_MaxUseCount then
return 0
end
if CheckParam2 ~= CurValue then
return 0
end
--------------参数设置安全性检测,虽然理论上参数设置不会失败
LuaFnRefreshItemInfo( sceneId, selfId, bagId ) --刷新背包信息
if CurValue >= x702001_g_MaxUseCount then--当使用次数达到最大次数时,将删除此物品
local EraseRet = EraseItem( sceneId, selfId, bagId )
-- PrintStr("删除")
-- PrintNum(EraseRet)
if EraseRet < 0 then --如果删除失败,将不会产生任何效果
local strMsg = "需要宠物回春丹"
x702001_ShowMsg( sceneId, selfId, strMsg)
return 0
end
end
else
local strMsg = "需要宠物回春丹"
x702001_ShowMsg( sceneId, selfId, strMsg)
return 0
end
-- 消耗珍兽回春丹完毕
-- PrintNum(x702001_g_HPValue)
if x702001_g_HPValue > 0 then
CallScriptFunction( x702001_g_petCommonId, "IncPetHP", sceneId, selfId, x702001_g_HPValue )
end
if x702001_g_MaxHPValue > 0 then
CallScriptFunction( x702001_g_petCommonId, "IncPetMaxHP", sceneId, selfId, x702001_g_MaxHPValue )
end
if x702001_g_LifeValue > 0 then
CallScriptFunction( x702001_g_petCommonId, "IncPetLife", sceneId, selfId, x702001_g_LifeValue )
end
if x702001_g_HappinessValue > 0 then
local happy = LuaFnGetPet_Happyness(sceneId, selfId, 0)
-- PrintNum(happy)
if valueHappy < 60 then
local happyes = 61 - valueHappy
-- PrintNum(happyes)
CallScriptFunction( x702001_g_petCommonId, "IncPetHappiness", sceneId, selfId, happyes )
else
CallScriptFunction( x702001_g_petCommonId, "IncPetHappiness", sceneId, selfId, x702001_g_HappinessValue )
end
end
-- ====================== 新增:增加珍兽潜能点1点 ======================
if x702001_g_AddPotential > 0 then
CallScriptFunction(x702001_g_petCommonId, "IncPetPotentialPoint", sceneId, selfId, x702001_g_AddPotential)
x702001_ShowMsg(sceneId, selfId, "珍兽获得潜能点+"..x702001_g_AddPotential)
end
-- ====================================================================
-- LuaFnSendSpecificImpactToUnit(sceneId, selfId, selfId, selfId, g_ImpactID, 0)
return 1
end
--**********************************
--引导心跳处理入口:
--引导技能会在每次心跳结束时调用这个接口。
--返回:1继续下次心跳;0:中断引导。
--注:这里是技能生效一次的入口
--**********************************
function x702001_OnActivateEachTick( sceneId, selfId )
return 1
end
-- 这个函数没有什么用,但是必须有
function x702001_CancelImpacts( sceneId, selfId )
return 0
end
function x702001_ShowMsg( sceneId, selfId, strMsg)
BeginEvent( sceneId )
AddText( sceneId, strMsg )
EndEvent( sceneId )
DispatchMissionTips( sceneId, selfId )
end
你用豆包给你生成的这个脚本,本身是没有问题的。但是,这个脚本调用了珍兽的主脚本335000,主脚本里有生命值和快乐度等增加的单元,没有增加潜能点的单元,所以,这个脚本对于潜能点方面无效,要想有效,必须在335000里添加增加潜能点的单元。你让豆包在335000里帮你添加这个单元,就解决问题了。 :加潜力点是最没用的 不说GM工具能改 一直加主属性容易出问题 后期都是属性时代 改下宝石或者装备属性就足够秒怪了 hfzxxxh2 发表于 2026-5-25 16:18
你用豆包给你生成的这个脚本,本身是没有问题的。但是,这个脚本调用了珍兽的主脚本335000,主脚本里有生命 ...
在珍兽通用脚本335000里加了代码还是没效果
以下是豆包给的代码:
-- 珍兽通用功能脚本
-- 脚本号
x335000_g_scriptId = 335000
-- 珍兽技能学习
function x335000_PetStudy( sceneId, selfId, skillId )
petGUID_H = LuaFnGetHighSectionOfTargetPetGuid( sceneId, selfId )
petGUID_L = LuaFnGetLowSectionOfTargetPetGuid( sceneId, selfId )
local checkAvailable = LuaFnIsPetAvailableByGUIDNoPW(sceneId, selfId, petGUID_H, petGUID_L);
if checkAvailable and checkAvailable == 1 then
local ret = PetStudySkill( sceneId, selfId, petGUID_H, petGUID_L, skillId )
if ret and ret > 0 then
--成功的光效
LuaFnSendSpecificImpactToUnit(sceneId, selfId, selfId, selfId, 18, 0);
return 1
end
end
return 0;
end
-- 判断口粮适合珍兽食用
-- nIndex 是正在使用的口粮的背包位置
function x335000_IsPetCanUseFood( sceneId, selfId, nIndex )
petGUID_H = LuaFnGetHighSectionOfTargetPetGuid( sceneId, selfId )
petGUID_L = LuaFnGetLowSectionOfTargetPetGuid( sceneId, selfId )
ret = LuaFnPetCanUseFood( sceneId, selfId, petGUID_H, petGUID_L, nIndex )
if ret > 0 then
return 1
else
return 0
end
end
-- 增加珍兽最大生命值
function x335000_IncPetMaxHP( sceneId, selfId, value )
if value <= 0 then
return 0
end
petGUID_H = LuaFnGetHighSectionOfTargetPetGuid( sceneId, selfId )
petGUID_L = LuaFnGetLowSectionOfTargetPetGuid( sceneId, selfId )
value = value + LuaFnGetPetMaxHP( sceneId, selfId, petGUID_H, petGUID_L )
LuaFnSetPetMaxHP( sceneId, selfId, petGUID_H, petGUID_L, value )
return 1
end
-- 增加珍兽生命值
function x335000_IncPetHP( sceneId, selfId, value )
if value <= 0 then
return 0
end
petGUID_H = LuaFnGetHighSectionOfTargetPetGuid( sceneId, selfId )
petGUID_L = LuaFnGetLowSectionOfTargetPetGuid( sceneId, selfId )
value = value + LuaFnGetPetHP( sceneId, selfId, petGUID_H, petGUID_L )
MaxHP = LuaFnGetPetMaxHP( sceneId, selfId, petGUID_H, petGUID_L )
if value > MaxHP then
value = MaxHP
end
LuaFnSetPetHP( sceneId, selfId, petGUID_H, petGUID_L, value )
local ObjId = LuaFnGetPetObjIdByGUID( sceneId, selfId, petGUID_H, petGUID_L )
if ObjId ~= -1 then
LuaFnSendSpecificImpactToUnit( sceneId, selfId, selfId, ObjId, 23, 0 )
end
return 1
end
-- 增加珍兽寿命
function x335000_IncPetLife( sceneId, selfId, value )
if value <= 0 then
return 0
end
petGUID_H = LuaFnGetHighSectionOfTargetPetGuid( sceneId, selfId )
petGUID_L = LuaFnGetLowSectionOfTargetPetGuid( sceneId, selfId )
value = value + LuaFnGetPetLife( sceneId, selfId, petGUID_H, petGUID_L )
LuaFnSetPetLife( sceneId, selfId, petGUID_H, petGUID_L, value )
LuaFnSendSpecificImpactToUnit(sceneId, selfId, selfId, selfId, 18, 0);
return 1
end
-- 增加珍兽快乐度
function x335000_IncPetHappiness( sceneId, selfId, value )
if value <= 0 then
return 0
end
petGUID_H = LuaFnGetHighSectionOfTargetPetGuid( sceneId, selfId )
petGUID_L = LuaFnGetLowSectionOfTargetPetGuid( sceneId, selfId )
value = value + LuaFnGetPetHappiness( sceneId, selfId, petGUID_H, petGUID_L )
MaxHappiness = 100
if value > MaxHappiness then
value = MaxHappiness
end
LuaFnSetPetHappiness( sceneId, selfId, petGUID_H, petGUID_L, value )
local ObjId = LuaFnGetPetObjIdByGUID( sceneId, selfId, petGUID_H, petGUID_L )
if ObjId ~= -1 then
LuaFnSendSpecificImpactToUnit(sceneId, selfId, selfId, ObjId, 24, 0)
end
return 1
end
-- 新增:增加珍兽未分配潜能点
function x335000_IncPetPotentialPoint( sceneId, selfId, value )
-- 安全判断:必须大于0才生效
if value <= 0 then
return 0
end
-- 获取当前出战珍兽GUID
petGUID_H = LuaFnGetHighSectionOfTargetPetGuid( sceneId, selfId )
petGUID_L = LuaFnGetLowSectionOfTargetPetGuid( sceneId, selfId )
-- 获取当前未分配潜能点
local nowPoint = LuaFnGetPetPotentialPoint( sceneId, selfId, petGUID_H, petGUID_L )
-- 增加潜能点
local newPoint = nowPoint + value
-- 设置新的未分配潜能点
LuaFnSetPetPotentialPoint( sceneId, selfId, petGUID_H, petGUID_L, newPoint )
-- 播放成功光效
local ObjId = LuaFnGetPetObjIdByGUID( sceneId, selfId, petGUID_H, petGUID_L )
if ObjId ~= -1 then
LuaFnSendSpecificImpactToUnit(sceneId, selfId, selfId, ObjId, 18, 0)
end
return 1
end
大佬能帮忙修改吗?大佬能帮忙修改吗?大佬能帮忙修改吗?
本帖最后由 1742953267 于 2026-5-25 23:34 编辑
sai6859691 发表于 2026-5-25 17:41
加潜力点是最没用的 不说GM工具能改 一直加主属性容易出问题 后期都是属性时代 改下宝石 ...
用GM工具修改有什么玩游戏的乐趣,用游戏内道具实现慢慢变强成长的感觉才是玩游戏的乐趣,而且目前的天龙一键端给宝宝加潜能点外哪有变的更强的方法,上限固定死了,不加潜能宝宝后期就是个观赏用的摆设。 1742953267 发表于 2026-5-25 23:12
在珍兽通用脚本335000里加了代码还是没效果
以下是豆包给的代码:
豆包在脚本335000里 创建的添加珍兽潜能点的单元,从语句本身讲是对的,但是,各种语句和函数与引擎里是相对应 的,引擎设置的命令或者函数如果不与脚本中的相对应,脚本在运行时要么提示出错,要么没有任何结果。这里珍兽的潜能点添加就是这个问题。
脚本中的 nowPoint = LuaFnGetPetPotentialPoint( sceneId, selfId, petGUID_H, petGUID_L ) 是获取珍兽当前的潜能点数。但引擎中并没有PotentialPoint,也就是没有用PotentialPoint作为潜能点的描述,而是用了_RemainPoint作为了潜能点,经测试,
nowPoint = LuaFnGetPetPotentialPoint( sceneId, selfId, petGUID_H, petGUID_L ) 根本获取不到潜能点,脚本运行到这句就卡死不进行下面的了。而用local nowPoint = LuaFnGetPet_RemainPoint( sceneId, selfId )这个语句则可以获取到出战珍兽的潜能点数。这里不能有petGUID_H, petGUID_L,有了就不能获取潜能点数。
按其它有关快乐值,生命,生命最大值的赋值的方式,LuaFnSetPet_RemainPoint( sceneId, selfId, nowPoint)应该是给珍兽的潜能点赋值。但是经测试无效。潜能点赋值的语句目前没有测试出来。
所以,命令语句与引擎有关,按豆包给你的脚本,语句本身并没有错误,但与引擎不相对应,所以无效。
页:
[1]