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