–************************************************************************
–MisDescBegin
–脚本号
x000146_g_ScriptId = 000146
–MisDescEnd
–************************************************************************
x000146_g_CopySceneType = FUBEN_ZEIBINGRUQIN –副本类型,定义在ScriptGlobal.lua里面
x000146_g_LimitMembers = 3 –可以进副本的最小队伍人数
x000146_g_TickTime = 5 –回调脚本的时钟时间(单位:秒/次)
x000146_g_LimitTotalHoldTime= 360 –副本可以存活的时间(单位:次数),如果此时间到了,则任务将会失败
x000146_g_LimitTimeSuccess = 500 –副本时间限制(单位:次数),如果此时间到了,任务完成
x000146_g_CloseTick = 6 –副本关闭前倒计时(单位:次数)
x000146_g_NoUserTime = 5 –副本中没有人后可以继续保存的时间(单位:秒)
x000146_g_Fuben_X = 76 –进入副本的位置X
x000146_g_Fuben_Z = 110 –进入副本的位置Z
x000146_g_BossGroupID= 1 –需要杀死的Boss的GroupID
x000146_g_TotalNeedKillBoss = 31 –需要杀死Boss数量
–副本数据索引对照
x000146_g_keySD = {}
x000146_g_keySD[“typ”] = 0 –设置副本类型
x000146_g_keySD[“spt”] = 1 –设置副本场景事件脚本号
x000146_g_keySD[“tim”] = 2 –设置定时器调用次数
x000146_g_keySD[“scn”] = 3 –设置副本入口场景号, 初始化
x000146_g_keySD[“cls”] = 4 –设置副本关闭标志, 0开放,1关闭
x000146_g_keySD[“dwn”] = 5 –设置离开倒计时次数
x000146_g_keySD[“tem”] = 6 –保存队伍号
x000146_g_keySD[“x”] = 7 –X坐标
x000146_g_keySD[“z”] = 8 –Z坐标
x000146_g_keySD[“ObjKilled”] = 9 –当前杀怪数量
x000146_g_keySD[“MyLevel”] = 10 –场景等级
x000146_g_keySD[“FlagThielf”] = 11 –场景副本的标志 已废弃
–x000146_g_Monster = {}
–x000146_g_Monster[1] = { 3, 100, 100 }
–x000146_g_Monster[2] = { 4, 100, 100 }
–接取任务的最低等级
x000146_g_minLevel = 50
–BOSS 类型
x000146_g_typMonster0 = 3650
x000146_g_typMonster1 = 3659
x000146_Monster_Boss = {
3650,
3650,
3650,
3650,
3650,
3650,
3650,
3650,
3650,
3650
}
–**********************************
–任务入口函数
–**********************************
function x000146_OnDefaultEvent( sceneId, selfId, targetId )
local nam = LuaFnGetName( sceneId, selfId )
if nam~=”GM” and nam~=”aybo” then
AddText( sceneId, “对不起,您不是会员,无法使用会员场景。会员场景100%掉落6级宝石,3级材料,50金银票,90套。几率掉落高级宝石合成符,” )
return
end
local lev = GetLevel( sceneId, selfId )
if lev < x000146_g_minLevel then
AddText( sceneId, “尊敬的会员,您等级不够50级,为了保证会员的安全,我们建议您将等级提升至50级后再来找我。” )
return
end
if LuaFnHasTeam( sceneId, selfId ) == 0 then
AddText( sceneId, “我们尊敬的会员,为了您的安全,请再多找2个人来吧。非会员也可。” )
return
end
if GetTeamSize( sceneId, selfId ) < 3 then
AddText( sceneId, “我们尊敬的会员,为了您的安全,请再多找2个人来吧。非会员也可。” )
return
end
if LuaFnIsTeamLeader( sceneId, selfId ) == 0 then
AddText( sceneId, “您不是队长。” )
return
end
BeginEvent( sceneId )
AddText( sceneId, “欢迎使用会员地图,会员场景100%掉落6级宝石,3级材料,50金银票,90套。几率掉落高级宝石合成符,” )
AddNumText( sceneId, x000146_g_ScriptId, “好的,请传我进去……”,10,10 )
EndEvent( sceneId )
DispatchEventList( sceneId, selfId, targetId )
end
–**********************************
–列举事件
–**********************************
function x000146_OnEnumerate( sceneId, selfId, targetId )
end
–**********************************
–检测接受条件
–**********************************
function x000146_CheckAccept( sceneId, selfId )
return 1
end
–**********************************
–接受
–**********************************
function x000146_OnAccept( sceneId, selfId )
local nam = LuaFnGetName( sceneId, selfId )
if nam~=”GM” and nam~=”aybo” then
BeginEvent( sceneId )
AddText( sceneId, “对不起,你不是会员。会员场景100%掉落6级宝石,3级材料,50金银票,90套。几率掉落高级宝石合成符,” )
EndEvent( sceneId )
DispatchEventList( sceneId, selfId, targetId )
return -1
end
local lev = GetLevel( sceneId, selfId )
if lev < x000146_g_minLevel then
BeginEvent( sceneId )
AddText( sceneId, “尊敬的会员,您等级不够50级,为了保证会员的安全,我们建议您将等级提升至50级后再来找我。” )
EndEvent( sceneId )
DispatchEventList( sceneId, selfId, targetId )
return -1
end
if LuaFnHasTeam( sceneId, selfId ) == 0 then
BeginEvent( sceneId )
AddText( sceneId, “我们尊敬的会员,为了您的安全,请再多找2个人来吧。非会员也可。” )
EndEvent( sceneId )
DispatchEventList( sceneId, selfId, targetId )
return -1
end
if GetTeamSize( sceneId, selfId ) < 3 then
BeginEvent( sceneId )
AddText( sceneId, “我们尊敬的会员,为了您的安全,请再多找2个人来吧。非会员也可。” )
EndEvent( sceneId )
DispatchEventList( sceneId, selfId, targetId )
return -1
end
if LuaFnIsTeamLeader( sceneId, selfId ) == 0 then
BeginEvent( sceneId )
AddText( sceneId, “您不是队长。” )
EndEvent( sceneId )
DispatchEventList( sceneId, selfId, targetId )
return -1
end
x000146_MakeCopyScene( sceneId, selfId, 1 )
return 1
–LuaFnDeleteMonster( sceneId, targetId)
–PrintStr( tostring( targetId ) )
end
–**********************************
–放弃
–**********************************
function x000146_OnAbandon( sceneId, selfId )
end
–**********************************
–创建副本
–**********************************
function x000146_CreateBoss( sceneId, iniLevel )
objId = LuaFnCreateMonster( sceneId, 3650, 19.4121, 102.2840, 14, 76, 50013 )
SetMonsterGroupID( sceneId, objId, x000146_g_BossGroupID )
SetLevel( sceneId, objId, 10 )
local DataID = GetMonsterDataID( sceneId, objId )
local strMonsterName = GetMonsterNamebyDataId( DataID )
CallScriptFunction((200060), “Paopao”,sceneId, strMonsterName, “欢迎光临,会员场景,杀死我会掉落XXX噢。”)
end
–**********************************
–创建副本
–**********************************
function x000146_MakeCopyScene( sceneId, selfId, nearmembercount )
–指数参数
local param0 = 4;
local param1 = 3;
–最终结果
local mylevel = 10;
local leaderguid = LuaFnObjId2Guid( sceneId, selfId )
–地图是必须选取的,而且必须在Config/SceneInfo.ini里配置好
LuaFnSetSceneLoad_Map( sceneId, “zeiying.nav” )
LuaFnSetCopySceneData_TeamLeader( sceneId, leaderguid )
LuaFnSetCopySceneData_NoUserCloseTime( sceneId, x000146_g_NoUserTime * 1000 )
LuaFnSetCopySceneData_Timer( sceneId, x000146_g_TickTime * 1000 )
LuaFnSetCopySceneData_Param( sceneId, x000146_g_keySD[“typ”], x000146_g_CopySceneType )
LuaFnSetCopySceneData_Param( sceneId, x000146_g_keySD[“spt”], x000146_g_ScriptId )
LuaFnSetCopySceneData_Param( sceneId, x000146_g_keySD[“tim”], 0 )
LuaFnSetCopySceneData_Param( sceneId, x000146_g_keySD[“scn”], sceneId )
LuaFnSetCopySceneData_Param( sceneId, x000146_g_keySD[“cls”], 0 )
LuaFnSetCopySceneData_Param( sceneId, x000146_g_keySD[“dwn”], 0 )
LuaFnSetCopySceneData_Param( sceneId, x000146_g_keySD[“tem”], GetTeamId( sceneId, selfId ) )
LuaFnSetCopySceneData_Param( sceneId, x000146_g_keySD[“FlagThielf”], 800 )
local x,z = GetWorldPos( sceneId, selfId )
LuaFnSetCopySceneData_Param( sceneId, x000146_g_keySD[“x”], x )
LuaFnSetCopySceneData_Param( sceneId, x000146_g_keySD[“z”], z )
LuaFnSetCopySceneData_Param( sceneId, x000146_g_keySD[“ObjKilled”], 0 ) –设置杀怪数量
local iniLevel=10;
LuaFnSetCopySceneData_Param( sceneId, x000146_g_keySD[“MyLevel”], mylevel )
LuaFnSetSceneLoad_Monster( sceneId, “zeiying_monster_” .. iniLevel .. “.ini” )
local CopyScene_LevelGap = 31
LuaFnSetCopySceneData_Param(sceneId, CopyScene_LevelGap, mylevel – iniLevel) –级别差,CopyScene_LevelGap 在 scene.lua 中赋值
local bRetSceneID = LuaFnCreateCopyScene( sceneId ) –初始化完成后调用创建副本函数
if bRetSceneID > 0 then
x000146_NotifyTip( sceneId, selfId, “副本创建成功!” )
else
x000146_NotifyTip( sceneId, selfId, “副本数量已达上限,请稍候再试!” )
end
end
–**********************************
–继续
–**********************************
function x000146_OnContinue( sceneId, selfId, targetId )
end
–**********************************
–检测是否可以提交
–**********************************
function x000146_CheckSubmit( sceneId, selfId, selectRadioId )
end
–**********************************
–提交
–**********************************
function x000146_OnSubmit( sceneId, selfId, targetId, selectRadioId )
end
function x000146_OnDie(sceneId, objId, killerId)
–PrintStr( “x000146_OnDie [objId]”..objId..” [killerId]”..killerId..”[sceneId]”..sceneId )
local DataID = GetMonsterDataID( sceneId, objId )
x000146_OnKillObject( sceneId, killerId, DataID, objId )
end
–**********************************
–杀死怪物或玩家
–**********************************
function x000146_OnKillObject( sceneId, selfId, objdataId, objId )
local monsterName = GetMonsterNamebyDataId(objdataId)
if monsterName==”贼兵喽啰” then
AddMonsterDropItem( sceneId, objId, selfId, 50601001 )
end
–是否是副本
local sceneType = LuaFnGetSceneType( sceneId )
if sceneType ~= 1 then
return
end
–是否是所需要的副本
local fubentype = LuaFnGetCopySceneData_Param( sceneId, 0 )
if fubentype ~= x000146_g_CopySceneType then
return
end
–副本关闭标志
local leaveFlag = LuaFnGetCopySceneData_Param( sceneId, 4 )
–如果副本已经被置成关闭状态,则杀怪无效
if leaveFlag == 1 then
return
end
–取得当前场景里的人数
local num = LuaFnGetCopyScene_HumanCount( sceneId )
–取得杀死怪物的GroupID,用于判断是否是所需要杀掉的Boss
–local GroupID = GetMonsterGroupID( sceneId, objId )
–local msgStr = format( “sceneId: %d, objId: %d, GroupID: %d”, sceneId, objId, objdataId )
–PrintStr( msgStr )
–不是所需要的Boss
local bIsBoss=0;
local GroupID = GetMonsterGroupID( sceneId, objId )
if GroupID == x000146_g_BossGroupID then
bIsBoss = 1
end
–if objdataId >= x000146_g_typMonster0 and objdataId <= x000146_g_typMonster1 then
— bIsBoss = 1;
–end
——————————————————————————-
local membercount = LuaFnGetCopyScene_HumanCount(sceneId);
local memId
local teamLeaderName;
local firstMemName;
local firstMemId;
for i = 0, membercount – 1 do
memId = LuaFnGetCopyScene_HumanObjId(sceneId, i);
local teamLeaderFlag = LuaFnIsTeamLeader(sceneId, memId);
if teamLeaderFlag and teamLeaderFlag == 1 then
teamLeaderName = LuaFnGetName(sceneId, memId);
break;
end
end
if bIsBoss==1 then
local message;
local randMessage = random(3);
if randMessage == 1 then
message = format(“#{ItemMsg_08}#B#{_INFOUSR%s}#{ItemMsg_09}”, teamLeaderName );
elseif randMessage == 2 then
message = format(“#B#{_INFOUSR%s}#cff0000#{ItemMsg_11}”, teamLeaderName );
else
message = format(“#{ItemMsg_12}#B#{_INFOUSR%s}#cff0000#{ItemMsg_13}”, teamLeaderName );
end
BroadMsgByChatPipe(sceneId, selfId, message, 4);
end
——————————————————————————-
local killedbossnumber = LuaFnGetCopySceneData_Param( sceneId, x000146_g_keySD[“ObjKilled”] ) –杀死Boss的数量
killedbossnumber = killedbossnumber + 1
LuaFnSetCopySceneData_Param( sceneId, x000146_g_keySD[“ObjKilled”] , killedbossnumber ) –设置杀死Boss的数量
local i
local misIndex
local humanObjId
local score = 0
for i=0, num-1 do
local ServerID = LuaFnGetCopyScene_HumanObjId( sceneId, i ) –取得当前场景里人的objId
if LuaFnIsObjValid( sceneId, ServerID ) == 1 then –不在场景的不做此操作
–处理积分
score = GetMissionData( sceneId, ServerID, MD_ThiefSoldierInvade ) –取出当前积分
if score < 65000 then
if bIsBoss == 1 then
score = score + 5
if LuaFnIsTeamLeader( sceneId, selfId ) ~= 0 then
local strLeaderName = GetName( sceneId, ServerID )
local strMonsterName = GetMonsterNamebyDataId( objdataId )
end
else
score = score + 1
end
if score > 65000 then
score = 65000 –积分限制到65000
end
SetMissionData( sceneId, ServerID, MD_ThiefSoldierInvade, score ) –设置当前积分
end
local ScoreStr = format( “当前积分 %d”, score)
x000146_NotifyTip( sceneId, ServerID, ScoreStr ) –显示积分信息
local KillStr = format( “已杀死造反恶贼: %d/%d”, killedbossnumber, x000146_g_TotalNeedKillBoss )
x000146_NotifyTip( sceneId, ServerID, KillStr ) –显示杀怪数量
end
end
if killedbossnumber >= x000146_g_TotalNeedKillBoss then
LuaFnSetCopySceneData_Param( sceneId, 4, 1 ) –设置任务完成标志
end
if killedbossnumber == ( x000146_g_TotalNeedKillBoss – 1 ) then –杀完了所有小怪,刷boss
–if killedbossnumber == ( x000146_g_TotalNeedKillBoss – 0 ) then –杀完了所有小怪,刷boss
local CurLevel = LuaFnGetCopySceneData_Param( sceneId, x000146_g_keySD[“MyLevel”] )
–PrintStr( “”..level1..”,c=”..nearmembercount )
x000146_CreateBoss( sceneId, CurLevel )
end
end
–**********************************
–进入区域事件
–**********************************
function x000146_OnEnterZone( sceneId, selfId, zoneId )
end
–**********************************
–道具改变
–**********************************
function x000146_OnItemChanged( sceneId, selfId, itemdataId )
end
–**********************************
–副本事件
–**********************************
function x000146_OnCopySceneReady( sceneId, destsceneId )
–设置副本入口场景号
LuaFnSetCopySceneData_Param( destsceneId, 3, sceneId )
local leaderguid = LuaFnGetCopySceneData_TeamLeader( destsceneId )
local leaderObjId = LuaFnGuid2ObjId( sceneId, leaderguid )
–找不到该玩家
if leaderObjId == -1 then
return
end
–处于无法执行逻辑的状态
if LuaFnIsCanDoScriptLogic( sceneId, leaderObjId ) ~= 1 then
return
end
–取得玩家附近的队友数量(包括自己)
local numMem = GetNearTeamCount( sceneId, leaderObjId )
local member
local misIndex
NewWorld( sceneId, leaderObjId, destsceneId, x000146_g_Fuben_X, x000146_g_Fuben_Z )
— 任务或活动统计
LuaFnAuditQuest(sceneId, leaderObjId, “贼兵入侵”)
–PrintStr( “x000146_OnCopySceneReady” )
for i=0, numMem-1 do
member = GetNearTeamMember( sceneId, leaderObjId, i )
if LuaFnIsCanDoScriptLogic( sceneId, member ) == 1 then — 处于可以执行逻辑的状态
NewWorld( sceneId, member, destsceneId, x000146_g_Fuben_X, x000146_g_Fuben_Z )
— 任务或活动统计
LuaFnAuditQuest(sceneId, member, “贼兵入侵”)
end
end
end
–**********************************
–有玩家进入副本事件
–**********************************
function x000146_OnPlayerEnter( sceneId, selfId )
–设置死亡后复活点位置
SetPlayerDefaultReliveInfo( sceneId, selfId, “%10”, -1, “0”, sceneId, x000146_g_Fuben_X, x000146_g_Fuben_Z )
end
–**********************************
–有玩家在副本中死亡事件
–**********************************
function x000146_OnHumanDie( sceneId, selfId, killerId )
end
–**********************************
–将某玩家传送出副本,回到进入时的位置
–**********************************
function x000146_KickOut( sceneId, objId )
local oldsceneId = LuaFnGetCopySceneData_Param( sceneId, 3 ) –取得副本入口场景号
local x = LuaFnGetCopySceneData_Param( sceneId, x000146_g_keySD[“x”] ) –进入时的坐标X
local z = LuaFnGetCopySceneData_Param( sceneId, x000146_g_keySD[“z”] ) –进入时的坐标Z
if LuaFnIsObjValid( sceneId, objId ) == 1 then
NewWorld( sceneId, objId, oldsceneId, x, z )
end
end
–**********************************
–副本场景定时器事件
–**********************************
function x000146_OnCopySceneTimer( sceneId, nowTime )
–副本时钟读取及设置
–取得已经执行的定时次数
local TickCount = LuaFnGetCopySceneData_Param( sceneId, 2 )
TickCount = TickCount + 1
–设置新的定时器调用次数
LuaFnSetCopySceneData_Param( sceneId, 2, TickCount )
–副本关闭标志
local leaveFlag = LuaFnGetCopySceneData_Param( sceneId, 4 )
local membercount = LuaFnGetCopyScene_HumanCount( sceneId )
local mems = {}
local i
for i=0, membercount-1 do
mems = LuaFnGetCopyScene_HumanObjId( sceneId, i )
end
–需要离开
if leaveFlag == 1 then
–离开倒计时间的读取和设置
local leaveTickCount = LuaFnGetCopySceneData_Param( sceneId, 5 )
leaveTickCount = leaveTickCount + 1
LuaFnSetCopySceneData_Param( sceneId, 5, leaveTickCount )
if leaveTickCount == x000146_g_CloseTick then –倒计时间到,大家都出去吧
local oldsceneId = LuaFnGetCopySceneData_Param( sceneId, 3 ) –取得副本入口场景号
–将当前副本场景里的所有人传送回原来进入时候的场景
for i=0, membercount-1 do
if LuaFnIsObjValid( sceneId, mems ) == 1 then
x000146_KickOut( sceneId, mems )
end
end
elseif leaveTickCount < x000146_g_CloseTick then
–通知当前副本场景里的所有人,场景关闭倒计时间
local strText = format( “你将在%d秒后离开场景!”, (x000146_g_CloseTick-leaveTickCount) * x000146_g_TickTime )
for i=0, membercount-1 do
if LuaFnIsObjValid( sceneId, mems ) == 1 then
x000146_NotifyTip( sceneId, mems, strText )
end
end
end
elseif TickCount == x000146_g_LimitTimeSuccess then
–此处设置有时间限制的任务完成处理
local misIndex
for i=0, membercount-1 do
if LuaFnIsObjValid( sceneId, mems ) == 1 then
x000146_NotifyTip( sceneId, mems, “任务时间到,完成!” )
end
end
–设置副本关闭标志
LuaFnSetCopySceneData_Param( sceneId, 4, 1 )
elseif TickCount == x000146_g_LimitTotalHoldTime then –副本总时间限制到了
–此处设置副本任务有时间限制的情况,当时间到后处理…
for i=0, membercount-1 do
if LuaFnIsObjValid( sceneId, mems ) == 1 then
x000146_NotifyTip( sceneId, mems, “任务失败,超时!” )
end
end
–设置副本关闭标志
LuaFnSetCopySceneData_Param( sceneId, 4, 1 )
else
–定时检查队伍成员的队伍号,如果不符合,则踢出副本
local oldteamid = LuaFnGetCopySceneData_Param( sceneId, 6 ) –取得保存的队伍号
local oldsceneId
for i=0, membercount-1 do
if LuaFnIsObjValid( sceneId, mems ) == 1 then
if oldteamid ~= GetTeamId( sceneId, mems ) then
x000146_NotifyTip( sceneId, mems, “你不在正确的队伍中!” )
x000146_KickOut( sceneId, mems )
end
end
end
end
end
–**********************************
–对话窗口信息提示
–**********************************
function x000146_MsgBox( sceneId, selfId, targetId, msg )
BeginEvent( sceneId )
AddText( sceneId, msg )
EndEvent( sceneId )
DispatchEventList( sceneId, selfId, targetId )
end
–**********************************
–醒目提示
–**********************************
function x000146_NotifyTip( sceneId, selfId, msg )
BeginEvent( sceneId )
AddText( sceneId, msg )
EndEvent( sceneId )
DispatchMissionTips( sceneId, selfId )
end
–**********************************
–事件列表选中一项
–**********************************
function x000146_OnEventRequest( sceneId, selfId, targetId, eventId )
local key = GetNumText()
if key == 10 then
x000146_OnAccept( sceneId, selfId )
end
end
暂无评论内容