[KT] Thảo luận về dự án Thú Cưng cho sv 2.6 cần pro giúp sức
Hello & Welcome to our community. Is this your first visit? Đăng Ký
Follow us on
Follow us on Facebook Follow us on Twitter Linked In Flickr Watch us on YouTube My Space Blogger
 
Trang 1 của 3 1 2 3 CuốiCuối
Kết quả 1 đến 10 của 28
  1. #1
    Thành Viên
    Ngày tham gia
    Jul 2011
    Bài viết
    98
    Thanks
    21
    Thanked 10 Times in 10 Posts

    Thảo luận về dự án Thú Cưng cho sv 2.6 cần pro giúp sức

    Mình thấy trên sv KT linux có chứ năng thú cưng khá thú vị. Thoạt đầu mình có ý định thử đem nó bỏ vào sv 2.6 cơ mà ko phải dân IT nên nghèo nàn về kiến thức nay share những gì đã làm đc để các pro đắp vá thêm xem có đc ko ^^

    Nguyên liệu và các file liên quan mình tìm đc:

    \gamecenter\script\item\class\qiankunfulogic.lua

    Tìm
    PHP Code:
    function tb:ObtainMemberPos(nMemberPlayerIdnPlayerIdnItemIdnMapIdnPosXnPosYnFightState
    thêm vào ngay dưới cùng
    PHP Code:
    Npc.tbFollowPartner:FollowNewWorld(pPlayernMapIdnPosXnPosY); 
    gameserver\script\event\extendaward\extendaward.lu a

    Tìm
    PHP Code:
    function ExtendAward:DoCheck(szType, ...) 
    thay thành
    PHP Code:
    function ExtendAward:DoCheck(szType, ...)
        if 
    not self.tbInterFaceFun[szTypethen
            
    return 0;
        
    end
        
        
    if self[self.tbInterFaceFun[szType]] then
            local nFreeCount
    tbFunExecuteszExtendInfotbProductSet self[self.tbInterFaceFun[szType]](selfunpack(arg))
            if 
    self.tbFunExecute[szTypethen
                local tbFun 
    = {};
                for 
    nRegIdtbExe in pairs(self.tbFunExecute[szType]) do
                    
                    
    local tbTempExe = {}
                    for 
    _v in ipairs(tbExe) do
                        
    table.insert(tbTempExev);
                    
    end
                    
    for _v in ipairs(arg) do
                        
    table.insert(tbTempExev);
                    
    end
                    table
    .insert(tbFuntbTempExe);
                
    end
                
                
    for _tbExe in pairs(self:RegistrationExecute(tbFun)) do
                    
    table.insert(tbFunExecutetbExe);
                
    end
            end
            
            
    --宠物系统
            tbFunExecute 
    tbFunExecute or {};
            
    table.insert(tbFunExecute, {["fun"] = Npc.tbFollowPartner.AddAward, ["tbParam"] = {Npc.tbFollowPartnerarg[1] or meszType}});
            
            if 
    self.tbFreeCountScript[szTypethen
                
    for nRegIdtbExe in pairs(self.tbFreeCountScript[szType]) do
                    
    local tbTempExe = {}
                    for 
    _v in ipairs(tbExe) do
                        
    table.insert(tbTempExev);
                    
    end
                    
    for _v in ipairs(arg) do
                        
    table.insert(tbTempExev);
                    
    end
                    nFreeCount 
    nFreeCount tbTempExe[1](unpack(tbTempExe,2))
                
    end
            end
            
    if self.tbFreeCount[szTypethen
                
    for nRegIdnTmpFreeCount in pairs(self.tbFreeCount[szType]) do
                    
    nFreeCount nFreeCount + (tonumber(nTmpFreeCount) or 0)
                
    end
            end
            
    return nFreeCounttbFunExecuteszExtendInfotbProductSet;
        
    end
        
    return 0;
    end 
    script\item\class\chuansongfu.lua

    PHP Code:
    function tbChuangsongfu:TransPlayer(nItemIdtbPosnIsLimitszName
    thay
    PHP Code:
    function tbChuangsongfu:TransPlayer(nItemIdtbPosnIsLimitszName)
        
    local pItem KItem.GetObjById(nItemId);
        if (
    not pItemthen
            
    return;
        
    end
        
    if (nIsLimit == 1then
            
    if (me.DelItem(pItemPlayer.emKLOSEITEM_USE) ~= 1then
                me
    .Msg("Hủy Truyền Tống Phù thất bại!");
                return;
            
    end
        end
        
    if type(tbPos) == "table" then
            me
    .Msg(string.format("Ngồi yên, %s!",szName));
            
    me.NewWorld(unpack(tbPos));
            if 
    nFightState then
                me
    .SetFightState(nFightState);
            
    end
            Npc
    .tbFollowPartner:FollowNewWorld(meunpack(tbPos));
        elseif 
    type(tbPos) == "string" then
            me
    .CallClientScript({ tbPos });
        
    end
    end 
    gameserver\script\item\class\qiankunfulogic.lua thay giống gamecenter ở trên

    tải cái này về chép vào gameserver\script\item\class\
    [Only registered and activated users can see links. ]

    \gameserver\script\map\map.lua

    PHP Code:
    function Map:OnEnter2(nMapId)
        
    local tbMap    self:GetClass(nMapId);
        
        --
    如果是观战模式,走自己的统一逻辑
        
    if Looker:IsLooker(me) > 0 then
            Looker
    :MapOnEnter(nMapId);
            return 
    0;
        
    end
        
        tbMap
    :OnEnter2();
    end 
    thay
    PHP Code:
    function Map:OnEnter2(nMapId)
        
    local tbMap    self:GetClass(nMapId);
        
        --
    如果是观战模式,走自己的统一逻辑
        
    if Looker:IsLooker(me) > 0 then
            Looker
    :MapOnEnter(nMapId);
            return 
    0;
        
    end
        
        tbMap
    :OnEnter2();
        
    Npc.tbFollowPartner:FollowPartnerOnEnter();
    end 
    PHP Code:
    function Map:OnPlayerTrap(nMapIdszClassName)
        
    local tbMap    self:GetClass(nMapId);
        
    tbMap:OnPlayerTrap(szClassName);
    end 
    thay

    PHP Code:
    function Map:OnPlayerTrap(nMapIdszClassName)
        
    local tbMap    self:GetClass(nMapId);
        
    tbMap:OnPlayerTrap(szClassName);
        --
    宠物跟玩家跳trap点
        Npc
    .tbFollowPartner:FollowPartnerOnTrap();
    end 
    PHP Code:
    function Map:OnNpcTrap(nMapIdszClassName)
        
    local tbMap    self:GetClass(nMapId);
        
    tbMap:OnNpcTrap(szClassName);
    end 
    thay

    PHP Code:
    function Map:OnNpcTrap(nMapIdszClassName)
        --
    宠物不受npc Trap点影响
        
    if Npc.tbFollowPartner:CheckIsFollowPartner() == 1 then
            
    return;
        
    end
        local tbMap    
    self:GetClass(nMapId);
        
    tbMap:OnNpcTrap(szClassName);
    end 
    \gameserver\script\npc

    tải cái này chép vô: [Only registered and activated users can see links. ]

    gameserver\script\player\player.lua

    tìm function Player:_OnLogin(bExchangeServerComing)
    thêm dưới cùng
    PHP Code:
    if not GLOBAL_AGENT then
            Npc
    .tbFollowPartner:FollowPartnerLogin();
        
    end 
    tìm function Player:_OnLogout(szReason)

    thêm dưới cùng
    PHP Code:
    if (MODULE_GAMESERVERthen
            local tbXJRecord 
    me.GetXJRecordInfo();
            if 
    tbXJRecord and tbXJRecord ~= {} then
                local szLog 
    "";
                
    local bHasValue 0;
                for 
    inCount in pairs(tbXJRecord) do
                    if (
    ~= 1then
                        szLog 
    szLog..",";
                    
    end
                    
                    szLog 
    string.format("%s%d"szLognCount);
                    
                    if (
    nCount then
                        bHasValue 
    1;
                    
    end
                end
                
                
    if (bHasValue == 1then
                    StatLog
    :WriteStatLog("stat_info""roleobtain""xuanjing"me.nIdszLog);
                
    end
            end
            
            MiniResource
    .tbDownloadInfo:OnLogout(szReason);
            
            --
    跟宠上线事件
            
    if not GLOBAL_AGENT then
                Npc
    .tbFollowPartner:FollowPartnerLogOut();
            
    end
            
    --科举考试下线需要置打开ui变量为0,防止上来就算题目了,其实没打开界面
            me
    .SetTask(2216160);
        else
            
    ClientEvent:OnLogout(szReason);
        
    end 
    PHP Code:
    function Player:_OnDeath(pKiller)
        
    BlackSky:GiveMeBright(me);
        if (
    not pKillerthen
            
    return;
        
    end
        
    if (pKiller.nKind == 1then
            local szMsg 
    "Bạn bị <color=yellow>"..pKiller.szName.."<color> đánh trọng thương!";
            
    Dialog:SendInfoBoardMsg(meszMsg);
            
    me.Msg(szMsg)
            
    local pPlayer pKiller.GetPlayer();
            if (
    pPlayerthen
                local szMsg 
    "<color=yellow>"..me.szName.."<color> bị bạn đánh trọng thương!";
                
    Dialog:SendInfoBoardMsg(pPlayerszMsg);
                
    pPlayer.Msg(szMsg);
            
    end
        end
    end 
    thay thành
    PHP Code:
    function Player:_OnDeath(pKiller)
        
    BlackSky:GiveMeBright(me);
        if (
    not pKillerthen
            
    return;
        
    end
        
    if (pKiller.nKind == 1then
            local szMsg 
    "Bạn bị <color=yellow>"..pKiller.szName.."<color> đánh trọng thương!";
            
    Dialog:SendInfoBoardMsg(meszMsg);
            
    me.Msg(szMsg)
            
    local pPlayer pKiller.GetPlayer();
            if (
    pPlayerthen
                local szMsg 
    "<color=yellow>"..me.szName.."<color> bị bạn đánh trọng thương!";
                
    Dialog:SendInfoBoardMsg(pPlayerszMsg);
                
    pPlayer.Msg(szMsg);
                
    Npc.tbFollowPartner:AddAward(pPlayer"killplayer");
            
    end
        end
    end 
    Phần setting thì tải cái này về rồi cho thêm vào [Only registered and activated users can see links. ]

    thiếu chắc gì đó nên vấn đề là gọi và cất được thú cưng nhưng nó ko đi theo, ko đánh quái, nếu gọi ra mà ko cất đi khi uot ra đăng nhập lại sẽ xuất hiện thêm 1 con nữa

    Một vài hình ảnh:

    [Only registered and activated users can see links. ]
    [Only registered and activated users can see links. ]
    Khách viếng thăm hãy cùng kittyngoc_dp_ xây dựng diễn đàn CLBGAMESVN vững mạnh nhé!

  2. #2
    Thành Viên mrkutepro's Avatar
    Ngày tham gia
    Apr 2012
    Đang ở
    SafeZone
    Bài viết
    523
    Thanks
    82
    Thanked 248 Times in 125 Posts

    Ðề: Thảo luận về dự án Thú Cưng cho sv 2.6 cần pro giúp sức

    Có sáng tạo. Mình nghĩ là làm được nhé, bạn có thể tham khảo script di chuyển của npc và phát triển, tuy nhiên, việc này có thể làm nặng thêm cho sever
    Khách viếng thăm hãy cùng mrkutepro xây dựng diễn đàn CLBGAMESVN vững mạnh nhé!

  3. Các thành viên gởi lời cảm ơn đến mrkutepro vì bài viết này !

    bboyswat (04-11-14)

  4. #3
    Vi phạm quy định copday's Avatar
    Ngày tham gia
    Dec 2012
    Bài viết
    276
    Thanks
    92
    Thanked 114 Times in 39 Posts

    Ðề: Thảo luận về dự án Thú Cưng cho sv 2.6 cần pro giúp sức

    Bỏ kiếm thế cũng đã lâu, nay vào lại nóng trong người rồi!!!!
    , cái này cũng đã viết nhiều lần bằng nhiều cách khác nhau,dựa vào SC npc di chuyển, Ui theo sau nhé bạn, bạn còn thiếu file npc.lua nữa
    - có thể giải quyết chỗ này FollowNewWorld(pPlayer, nMapId, nPosX, nPosY), nhưng hơi cao siêu
    Lần sửa cuối bởi copday, ngày 24-07-14 lúc 08:01 AM.
    Khách viếng thăm hãy cùng copday xây dựng diễn đàn CLBGAMESVN vững mạnh nhé!

  5. #4
    Thành Viên
    Ngày tham gia
    Jul 2011
    Bài viết
    98
    Thanks
    21
    Thanked 10 Times in 10 Posts

    Ðề: Thảo luận về dự án Thú Cưng cho sv 2.6 cần pro giúp sức

    Trích dẫn Gửi bởi copday [Only registered and activated users can see links. ]
    Bỏ kiếm thế cũng đã lâu, nay vào lại nóng trong người rồi!!!!
    , cái này cũng đã viết nhiều lần bằng nhiều cách khác nhau,dựa vào SC npc di chuyển, Ui theo sau nhé bạn, bạn còn thiếu file npc.lua nữa
    - có thể giải quyết chỗ này FollowNewWorld(pPlayer, nMapId, nPosX, nPosY), nhưng hơi cao siêu
    Cao siêu thì e chịu bác ạ, e làm theo cảm tính chứ biết gì đâu. Nói thật e dân Công Nghệ nhưng là CN SInh Học, cơ mà đẻ ra ko nuôi đc đành nhờ các bác vậy
    Khách viếng thăm hãy cùng kittyngoc_dp_ xây dựng diễn đàn CLBGAMESVN vững mạnh nhé!

  6. #5
    Thành Viên Tâm Huyết satthupro95's Avatar
    Ngày tham gia
    Jan 2012
    Bài viết
    2,391
    Thanks
    2,566
    Thanked 1,819 Times in 864 Posts

    Ðề: Thảo luận về dự án Thú Cưng cho sv 2.6 cần pro giúp sức

    Cái cần là hàm FollowNewWorld(pPlayer, nMapId, nPosX, nPosY). Tìm xem trên linux nó đang bơi ở đâu thử chép qua xem
    Có lẽ vậy ...
    Lần sửa cuối bởi satthupro95, ngày 26-07-14 lúc 09:54 PM.
    Khách viếng thăm hãy cùng satthupro95 xây dựng diễn đàn CLBGAMESVN vững mạnh nhé!

  7. #6
    Thành Viên NhanVT's Avatar
    Ngày tham gia
    Jan 2013
    Bài viết
    348
    Thanks
    20
    Thanked 120 Times in 103 Posts

    Ðề: Thảo luận về dự án Thú Cưng cho sv 2.6 cần pro giúp sức

    function tbFollowPartner:FollowNewWorld(pPlayer, nMapId, nX, nY)
    if not nMapId or not nX or not nY then
    return;
    end
    local tbTemp = pPlayer.GetTempTable("Player").tbFollowPartner;
    if not tbTemp then
    return;
    end
    local pNpc = KNpc.GetById(tbTemp.nParnerId);
    if not pNpc then
    return;
    end
    local tbNpcTemp = pNpc.GetTempTable("Npc").tbFollowPartner;
    if not tbNpcTemp or tbNpcTemp.nPlayerId ~= pPlayer.nId then
    return;
    end
    pNpc.NewWorld(nMapId, nX, nY);
    end

    nó vẫn là hàm NewWorld thui mak
    Khách viếng thăm hãy cùng NhanVT xây dựng diễn đàn CLBGAMESVN vững mạnh nhé!

  8. Các thành viên gởi lời cảm ơn đến NhanVT vì bài viết này !

    satthupro95 (26-07-14)

  9. #7
    Thành Viên
    Ngày tham gia
    Jul 2011
    Bài viết
    98
    Thanks
    21
    Thanked 10 Times in 10 Posts

    Ðề: Thảo luận về dự án Thú Cưng cho sv 2.6 cần pro giúp sức

    Trích dẫn Gửi bởi NhanVT [Only registered and activated users can see links. ]
    function tbFollowPartner:FollowNewWorld(pPlayer, nMapId, nX, nY)
    if not nMapId or not nX or not nY then
    return;
    end
    local tbTemp = pPlayer.GetTempTable("Player").tbFollowPartner;
    if not tbTemp then
    return;
    end
    local pNpc = KNpc.GetById(tbTemp.nParnerId);
    if not pNpc then
    return;
    end
    local tbNpcTemp = pNpc.GetTempTable("Npc").tbFollowPartner;
    if not tbNpcTemp or tbNpcTemp.nPlayerId ~= pPlayer.nId then
    return;
    end
    pNpc.NewWorld(nMapId, nX, nY);
    end

    nó vẫn là hàm NewWorld thui mak
    chắc nó là chỗ mà mình online thì nó hiện lên chẳng
    Khách viếng thăm hãy cùng kittyngoc_dp_ xây dựng diễn đàn CLBGAMESVN vững mạnh nhé!

  10. #8
    Thành Viên
    Ngày tham gia
    Jul 2011
    Bài viết
    98
    Thanks
    21
    Thanked 10 Times in 10 Posts

    Ðề: Thảo luận về dự án Thú Cưng cho sv 2.6 cần pro giúp sức

    Trích dẫn Gửi bởi satthupro95 [Only registered and activated users can see links. ]
    Cái cần là hàm FollowNewWorld(pPlayer, nMapId, nPosX, nPosY). Tìm xem trên linux nó đang bơi ở đâu thử chép qua xem
    Có lẽ vậy ...
    Chỉ thấy ở file SC qiankunfulogic.lua thôi
    Khách viếng thăm hãy cùng kittyngoc_dp_ xây dựng diễn đàn CLBGAMESVN vững mạnh nhé!

  11. #9
    Thành Viên mrkutepro's Avatar
    Ngày tham gia
    Apr 2012
    Đang ở
    SafeZone
    Bài viết
    523
    Thanks
    82
    Thanked 248 Times in 125 Posts

    Ðề: Thảo luận về dự án Thú Cưng cho sv 2.6 cần pro giúp sức

    tốt nhất ko dùng hèm NewWorld cho npc, vì nó chả giống người mà nó load dc dữ liệu từ mysql. Nếu như người đi mất rồi, thì cho xài hàm del npc đi, rồi add npc khác, còn trong phạm vi map, thì tăng tốc độ chạy cho npc lên là xong
    Khách viếng thăm hãy cùng mrkutepro xây dựng diễn đàn CLBGAMESVN vững mạnh nhé!

  12. #10
    Vi phạm quy định copday's Avatar
    Ngày tham gia
    Dec 2012
    Bài viết
    276
    Thanks
    92
    Thanked 114 Times in 39 Posts

    Ðề: Thảo luận về dự án Thú Cưng cho sv 2.6 cần pro giúp sức

    nó vẫn là hàm NewWorld thui mak [/QUOTE]
    pNpc.NewWorld(nMapId, nX, nY)
    khác chớ
    Khách viếng thăm hãy cùng copday xây dựng diễn đàn CLBGAMESVN vững mạnh nhé!

 

 
Trang 1 của 3 1 2 3 CuốiCuối

Quyền viết bài

  • Bạn Không thể gửi Chủ đề mới
  • Bạn Không thể Gửi trả lời
  • Bạn Không thể Gửi file đính kèm
  • Bạn Không thể Sửa bài viết của mình
  •  
Múi giờ GMT +7. Bây giờ là 06:54 AM.
vBulletin®, Copyright ©2000-2011, Jelsoft Enterprises Ltd.
CLBGamesVN không chịu trách nhiệm về Luật Bản Quyền của các tài liệu, bài viết v.v...được đăng tải trên diễn đàn này.
Diễn đàn phát triển dưới sự đóng góp của tất cả thành viên. BQT chỉ là những người thành lập ra sân chơi, quản lý và duy trì về mặt kỹ thuật, nội dung khi hợp lệ.