找回密码
 register

QQ登录

只需一步,快速开始

查看: 594|回复: 1

[游戏教程] 解读玄武岛飞天猫刷新时间

[复制链接]

[游戏教程] 解读玄武岛飞天猫刷新时间

[复制链接]
  • 打卡等级:热心大叔
  • 打卡总天数:122
  • 打卡月天数:18
  • 打卡总奖励:121
  • 最近打卡:2025-02-22 14:24:44
Waylee

主题

0

回帖

1万

积分

仙帝

积分
14011
Waylee 2023-7-3 13:48 | 显示全部楼层 |阅读模式

马上注册,查看网站隐藏内容!!

您需要 登录 才可以下载或查看,没有账号?register

×
文章编辑人员:雪舞
内容测试时间:2023-7-3 13:42:35

活动文件:\home\tlbb5\Public\Config\ActivityNotice.txt
80        1        1        0        39        808068        95        0        0        0        0        0        -1        -1        -1        -1        -1        -1        -1        -1        -1        -1        -1        -1        -1        -1        -1        -1        -1        玄武岛怪物巡逻        95



活动刷新代码:\home\tlbb5\Public\Data\Script\event\huodong\ePetIsland_MonsterPatrol.lua
function x808068_CreateMonstersByGroup(sceneId, groupId)
        local Group25 = {
                {DataId=3830, x=212.517, z=181.2889, aiType=20, aiScript=211,aiLuaExtend=808068,patrolId=5},
                {DataId=3833, x=213.217, z=180.5889, aiType=20, aiScript=212,aiLuaExtend=-1,patrolId=6},
                {DataId=3836, x=213.917, z=179.8889, aiType=20, aiScript=213,aiLuaExtend=-1,patrolId=7},
                {DataId=3839, x=211.817, z=180.5889, aiType=20, aiScript=214,aiLuaExtend=-1,patrolId=8},
                {DataId=3842, x=211.117, z=179.8889, aiType=20, aiScript=215,aiLuaExtend=-1,patrolId=9}
        };
        local Group45 = {
                {DataId=3831, x=113.6972, z=219.7326, aiType=20, aiScript=211,aiLuaExtend=808068,patrolId=10},
                {DataId=3834, x=114.3972, z=219.0326, aiType=20, aiScript=212,aiLuaExtend=-1,patrolId=11},
                {DataId=3837, x=115.0972, z=218.3326, aiType=20, aiScript=213,aiLuaExtend=-1,patrolId=12},
                {DataId=3840, x=112.9972, z=219.0326, aiType=20, aiScript=214,aiLuaExtend=-1,patrolId=13},
                {DataId=3843, x=112.2972, z=218.3326, aiType=20, aiScript=215,aiLuaExtend=-1,patrolId=14}
        };
        local Group65 = {
                {DataId=3832, x=271.3059, z=63.2789, aiType=20, aiScript=211,aiLuaExtend=808068,patrolId=15},
                {DataId=3835, x=272.0059, z=62.5789, aiType=20, aiScript=212,aiLuaExtend=-1,patrolId=16},
                {DataId=3838, x=272.7059, z=61.8789, aiType=20, aiScript=213,aiLuaExtend=-1,patrolId=17},
                {DataId=3841, x=270.6059, z=62.5789, aiType=20, aiScript=214,aiLuaExtend=-1,patrolId=18},
                {DataId=3844, x=269.9059, z=61.8789, aiType=20, aiScript=215,aiLuaExtend=-1,patrolId=19}
        };

        local MonsterGroup = {
                Group25,
                Group45,
                Group65
        };
        local LocationInfo = {
                {level=25, x=212, z=181},
                {level=45, x=113, z=219},
                {level=65, x=271, z=63}
        };
        local group = MonsterGroup[groupId];
        if nil~=group then
                local locationInfo = LocationInfo[groupId];
                for index=1, x808068_g_MonsterNumber do
                        monster = group[index];
                        if nil~=monster then
                                local monsterId = LuaFnCreateMonster(
                                                                                sceneId, 
                                                                                monster.DataId, 
                                                                                monster.x, 
                                                                                monster.z, 
                                                                                monster.aiType,
                                                                                monster.aiScript,
                                                                                monster.aiLuaExtend
                                                                                );
                                SetMonsterGroupID(sceneId, monsterId, groupId);        --每组怪物属于同一个GroupID,这样怪物们可以互相增援
                                SetPatrolId(sceneId, monsterId, monster.patrolId); --设置怪物的巡逻ID
                                SetCharacterDieTime(sceneId, monsterId, x808068_g_MonsterLifeTime); --怪物只会存活到指定时间
                                if (GetName(sceneId, monsterId) == "无敌飞天猫") then
                                        SetCharacterTitle(sceneId, monsterId, "玄武岛侦缉队长")
                                end
                                --PrintStr(format("%d:monsterDataID=%d",groupId,monster.DataId));
                        else
                                break;
                        end
                end
                --PrintNum(sceneId)
                -- Broadcast the notice of this monster group
                x808068_BroadcastNotice(sceneId);
                -- Broadcast the level and location of this monster group
                if nil~=locationInfo then
                        x808068_BroadcastLocation(sceneId, locationInfo.level, locationInfo.x, locationInfo.z);
                end 
        end
end


--**********************************
--事件交互入口
--**********************************
function x808068_OnDefaultEvent( sceneId, actId, param1, param2, param3, param4, param5 )
        if x808068_g_ActivitySceneId == sceneId then
                StartOneActivity( sceneId, actId, floor(300000));--Timer 周期:5分钟
        end
end

--**********************************
--心跳函数
--**********************************
function x808068_OnTimer( sceneId, actId, uTime )
        if x808068_g_ActivitySceneId == sceneId then
                local RegenesisTime ={
                                {groupId = 3},--0点
                                {groupId = 1},--1点
                                {groupId = 2},--2点
                                {groupId = 3},--3点
                                {groupId = 1},--4点
                                {groupId = 2},--5点
                                {groupId = 3},--6点
                                {groupId = nil},--7点
                                {groupId = nil},--8点
                                {groupId = nil},--9点
                                {groupId = 1},--10点
                                {groupId = 2},--11点
                                {groupId = 3},--12点
                                {groupId = 1},--13点
                                {groupId = 2},--14点
                                {groupId = 3},--15点
                                {groupId = 1},--16点
                                {groupId = 2},--17点
                                {groupId = 3},--18点
                                {groupId = 1},--19点
                                {groupId = 2},--20点
                                {groupId = 3},--21点
                                {groupId = 1},--22点
                                {groupId = 2},--23点
                        };
                if 5>floor(GetMinute()) then --只有在每个小时的头5分钟内会刷新怪物
                        local index = floor(GetHour()+1);
                        local groupId = nil;
                        local regenesisTime = RegenesisTime[index];
                        if nil~=regenesisTime then
                                groupId = regenesisTime.groupId;
                        end
                        if nil~=groupId then
                                x808068_CreateMonstersByGroup(sceneId, groupId);
                        end
                end
        end
end



代码解读:
游客,如果您要查看本帖隐藏内容请回复

  • 打卡等级:即来则安
  • 打卡总天数:23
  • 打卡月天数:4
  • 打卡总奖励:24
  • 最近打卡:2025-02-17 13:20:31
fcwd12544

主题

0

回帖

4383

积分

关门弟子

积分
4383
fcwd12544 2024-10-1 23:22 | 显示全部楼层
顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶
您需要登录后才可以回帖 登录 | register

本版积分规则

雪舞知识库 | 浙ICP备15015590号-1 | 萌ICP备20232229号|浙公网安备33048102000118号 |天天打卡

GMT+8, 2025-2-22 21:47 , Processed in 0.103782 second(s), 7 queries , Redis On.

Powered by XueWu Licensed

Copyright © Tencent Cloud.

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