注册函数:LuaFnSetPetHappiness
参数说明:sceneId(场景编号),selfId(调用者ID),petGUID_H(宠物GUID高位),petGUID_L(宠物GUID低位),happiness(快乐度)
功能说明:设置宠物快乐度
示例说明:
案例脚本:M:\武侠世界醉江湖\xwxsj\Public\Data\Script\event\petskill\petcommon.lua
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
|