在传奇游戏服务端,如果需要检测某个地图中特定怪物的数量,可以使用以下脚本:
使用CheckMapSameMonCount命令,该命令用于检测某个地图中特定怪物的数量。
格式:CheckMapSameMonCount 地图 怪物名字 操作符(< = >) 数量(1-65535)
例如:CheckMapSameMonCount hell203 紫色死灵 > 500
如果需要检测特定地图中所有怪物的数量,可以使用CheckmapMonCount命令。
格式:CheckmapMonCount 地图号 操作符(< = >) 数量(1-65535)
例如:CheckmapMonCount 41 > 30
刷怪时间是指玩家把地图的怪清空后,到系统自动再次刷怪的时间。刷怪时间的设置建议如下:
小怪建议15分钟刷一次,大怪建议30分钟刷一次,小BOSS建议60分钟刷一次,大BOSS建议90分钟到120分钟刷一次。
刷怪脚本是由GM控制的,不存在刷怪外挂。
以下是完整示例代码:
— 检测地图特定怪物数量
function CheckMapMonCount(map, monster, operation, count)
local monsters = GetMapMonsters(map)
local num = 0
for k, v in pairs(monsters) do
if v.name == monster then
num = num + 1
end
end
if operation == “>” then
if num > count then
return true
else
return false
end
elseif operation == “=” then
if num == count then
return true
else
return false
end
elseif operation == “<” then
if num < count then
return true
else
return false
end
end
end
— 检测地图特定怪物数量
function CheckMapSameMonCount(map, monster, operation, count)
local monsters = GetMapMonsters(map)
local num = 0
for k, v in pairs(monsters) do
if v.name == monster then
num = num + 1
end
end
if operation == “>” then
if num > count then
return true
else
return false
end
elseif operation == “=” then
if num == count then
return true
else
return false
end
elseif operation == “<” then
if num < count then
return true
else
return false
end
end
end
— 刷怪时间设置
function SetMonsterRespawnTime(map, monster, time)
SetMapRespawnTime(map, monster, time)
end
— 刷怪
function AddMonster(map, monster, num)
for i=1, num do
AddMapMonster(map, monster)
end
end
— 示例使用
if CheckMapMonCount(41, “紫色死灵”, “>”, 500) then
Print(“地图41中紫色死灵数量大于500”)
else
Print(“地图41中紫色死灵数量不大于500”)
end
if CheckMapSameMonCount(41, “紫色死灵”, “=”, 500) then
Print(“地图41中紫色死灵数量等于500”)
else
Print(“地图41中紫色死灵数量不等于500”)
end
SetMonsterRespawnTime(41, “紫色死灵”, 15 * 60)
AddMonster(41, “紫色死灵”, 30)