找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 45|回复: 0

[吉仔LNS] 新增宠物定制功能 8.0端新增宠物定制功

[复制链接]

1万

主题

491

回帖

3万

积分

管理员

积分
35624
石币
24773
发表于 2024-9-13 10:46:55 | 显示全部楼层 |阅读模式
ReSetPetPoint.lua

  1. function ReSetPetPoint_Init( _MeIndex )
  2.     Char.SetData(_MeIndex, %对象_形象%, 101157)
  3.         Char.SetData(_MeIndex, %对象_原形%, 101157)
  4.         Char.SetData(_MeIndex, %对象_地图%, 1998)
  5.         Char.SetData(_MeIndex, %对象_X%, 8)
  6.         Char.SetData(_MeIndex, %对象_Y%, 4)
  7.         Char.SetData(_MeIndex, %对象_方向%, %右下%)
  8.         Char.SetData(_MeIndex, %对象_原名%, "宠物工具")

  9.         if (Char.SetTalkedEvent(nil, "ReSetPetPoint_Talked", _MeIndex) < 0) then
  10.                 print("ReSetPetPoint_Talked 註冊事件失敗。")
  11.                 return false
  12.         end

  13.         if (Char.SetWindowTalkedEvent(nil, "ReSetPetPoint_WindowTalked", _MeIndex) < 0) then
  14.                 print("ReSetPetPoint_WindowTalked 註冊事件失敗。")
  15.                 return false
  16.         end
  17.         return true
  18. end

  19. function ReSetPetPoint_Talked( _MeIndex, _TalkIndex, _Msg, _Color, _Channel)
  20.   if NLG.CheckInFront(_TalkIndex, _MeIndex, 1) == false then
  21.     return
  22.   end
  23.      NLG.ShowWindowTalked(_TalkIndex, 1, 3, 1,
  24.                         "               「宠物工具」"..
  25.                         "\n"..
  26.                         "\n1、宠物工具可以自定义您所需要的宠物点数"..
  27.                         "\n2、设置成功以后您的宠物自动变成2转160级"..
  28.                         "\n3、宠物实际血攻防敏需按照后面的计算公式"..
  29.                         "\n4、宠物位置(1~5)"..
  30.                         "\n"..
  31.                         "\n请输入要设置的宠物位置",
  32.                                 _MeIndex)

  33. end

  34. function ReSetPetPoint_WindowTalked( _MeIndex, _TalkIndex, _Seqno, _Select, _Data)
  35.     if(_Select == 2) then
  36.         return
  37.     end
  38.     if(_Seqno == 1) then
  39.         petset_pos = tonumber(_Data) - 1
  40.         Char.SetData(_TalkIndex,%对象_CN5%,petset_pos)
  41.     else
  42.         petset_pos = Char.GetData(_TalkIndex,%对象_CN5%)
  43.     end

  44.     local petindex = Char.GetPetIndex(_TalkIndex,petset_pos)

  45.     if _Seqno ==1 then
  46.                

  47.             --设置转数
  48.         Char.SetData(petindex , %对象_转数%, 2)
  49.             --设置等级
  50.         Char.SetData( petindex, %对象_等级%, 160)

  51.         Char.SetData(petindex, %对象_反击%, 10)

  52.         Char.SetData(petindex, %对象_暴击%, 10)

  53.         Char.SetData(petindex,%对象_地%,0)
  54.                 Char.SetData(petindex,%对象_水%,0)
  55.                 Char.SetData(petindex,%对象_火%,0)
  56.                 Char.SetData(petindex,%对象_风%,0)

  57.         NLG.ShowWindowTalked(_TalkIndex, 1, 3, 2,
  58.                                 "\n每点体力:"..
  59.                                 "\n增加  4  点耐久力"..
  60.                                 "\n增加 0.1 点攻击力"..
  61.                                 "\n增加 0.1 点防御力"..
  62.                                 "\n增加  0  点敏捷力",
  63.                                          _MeIndex)
  64.     elseif _Seqno == 2 then
  65.                 if _Data ~= nil and _Data ~= "" then
  66.                     Char.SetData( petindex, %对象_体力%, Char.GetData(petindex,%对象_体力%) + tonumber(_Data)*100)
  67.                    end
  68.         NLG.ShowWindowTalked(_TalkIndex, 1, 3, 3,
  69.                                 "\n每点攻击力:"..
  70.                                 "\n增加  1  点耐久力"..
  71.                                 "\n增加  1  点攻击力"..
  72.                                 "\n增加 0.1 点防御力"..
  73.                                 "\n增加  0  点敏捷力",
  74.                                         _MeIndex)

  75.     elseif _Seqno == 3 then
  76.             if _Data ~= nil and _Data ~= "" then
  77.                     Char.SetData( petindex, %对象_腕力%, Char.GetData(petindex,%对象_腕力%) + tonumber(_Data)*100)
  78.             end
  79.         NLG.ShowWindowTalked(_TalkIndex, 1, 3, 4,
  80.                                 "\n每点防御力:"..
  81.                                 "\n增加  1  点耐久力"..
  82.                                 "\n增加 0.1 点攻击力"..
  83.                                 "\n增加  1  点防御力"..
  84.                                 "\n增加  0  点敏捷力",
  85.                                         _MeIndex)

  86.     elseif _Seqno == 4 then
  87.             if _Data ~= nil and _Data ~= "" then
  88.                     Char.SetData( petindex, %对象_耐力%, Char.GetData(petindex,%对象_耐力%) + tonumber(_Data)*100)
  89.             end
  90.         NLG.ShowWindowTalked(_TalkIndex, 1, 3, 5,
  91.                                 "\n每点敏捷:"..
  92.                                 "\n增加  1   点耐久力"..
  93.                                 "\n增加 0.05 点攻击力"..
  94.                                 "\n增加 0.05 点防御力"..
  95.                                 "\n增加  1   点敏捷力",
  96.                                          _MeIndex)

  97.     elseif _Seqno == 5 then
  98.             if _Data ~= nil and _Data ~= "" then
  99.                            Char.SetData( petindex, %对象_速度%, Char.GetData(petindex,%对象_速度%) + tonumber(_Data)*100)
  100.                    end
  101.             NLG.ShowWindowTalked(_TalkIndex, 1, 3, 6,
  102.                                 "\n地属性1-10:",
  103.                                          _MeIndex)
  104.            elseif _Seqno == 6 then
  105.                    if _Data ~= nil and _Data ~= "" then
  106.                             Char.SetData( petindex, %对象_地%, Char.GetData(petindex,%对象_地%) + tonumber(_Data)*10)
  107.                    end
  108.             NLG.ShowWindowTalked(_TalkIndex, 1, 3, 7,
  109.                                 "\n水属性1-10:",
  110.                                          _MeIndex)
  111.            elseif _Seqno == 7 then
  112.                    if _Data ~= nil and _Data ~= "" then
  113.                     Char.SetData( petindex, %对象_水%, Char.GetData(petindex,%对象_水%) + tonumber(_Data)*10)
  114.                    end
  115.             NLG.ShowWindowTalked(_TalkIndex, 1, 3, 8,
  116.                                 "\n火属性1-10:",
  117.                                          _MeIndex)
  118.         elseif _Seqno == 8 then
  119.                 if _Data ~= nil and _Data ~= "" then
  120.                     Char.SetData( petindex, %对象_火%, Char.GetData(petindex,%对象_火%) + tonumber(_Data)*10)
  121.             end
  122.             NLG.ShowWindowTalked(_TalkIndex, 1, 3, 9,
  123.                                 "\n风属性1-10:",
  124.                                          _MeIndex)
  125.         elseif _Seqno == 9 then
  126.                 if _Data ~= nil and _Data ~= "" then
  127.                     Char.SetData( petindex, %对象_风%, Char.GetData(petindex,%对象_风%) + tonumber(_Data)*10)
  128.             end
  129.             NLG.ShowWindowTalked(_TalkIndex, 1, 3, 10,
  130.                                 "\n名称:",
  131.                                          _MeIndex)
  132.         elseif _Seqno == 10 then
  133.                 if _Data ~= nil and _Data ~= "" then
  134.                     Char.SetData( petindex, %对象_原名%, _Data)
  135.                     Char.SetData( petindex, %对象_名称%, _Data)
  136.             end
  137.             NLG.ShowWindowTalked(_TalkIndex, 1, 3, 11,
  138.                                 "\n形象:",
  139.                                          _MeIndex)
  140.         elseif _Seqno == 11 then
  141.                 if _Data ~= nil and _Data ~= "" then
  142.                     Char.SetData( petindex, %对象_形象%, tonumber(_Data))
  143.                     Char.SetData( petindex, %对象_原形%, tonumber(_Data))
  144.             end

  145.             Char.SetData(petindex,%对象_进化等级%,0)
  146.             NLG.UpPet(_TalkIndex,petset_pos)
  147.     end

  148.    
  149. end
复制代码



ReSetPetPoint_init.lua

  1. function ReSetPetPoint_Reload()
  2.         if (ReSetPetPoint_index == nil) then                                        --这句检查NPC是否已经创建,防止重复创建
  3.                 ReSetPetPoint_index = NL.CreateNpc("./data/npc/lua/ReSetPetPoint/ReSetPetPoint.lua", "ReSetPetPoint_Init");
  4.                 NLG.UpChar(ReSetPetPoint_index);
  5.         else
  6.                 NL.DelNpc(ReSetPetPoint_index);
  7.                 NLG.UpChar(ReSetPetPoint_index);
  8.                 ReSetPetPoint_index = nil;
  9.         end
  10. end

  11. ReSetPetPoint_Reload();
复制代码

宠物diy功能添加及使用教程.jpg
回复

使用道具 举报

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

本版积分规则

手机版|小黑屋|石器时代LA官方

GMT+8, 2024-9-21 12:42 , Processed in 0.157775 second(s), 25 queries .

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