function shouhuditu4a_OnPlayerEnter(MapID, InstanceID, RoleID) unit.SetCamp(MapID, InstanceID, RoleID, 2) end aux.RegisterMapEvent("dmap4a",2, "shouhuditu4a_OnPlayerEnter") function baozang_OnPlayerLeave(MapID, InstanceID, TargetID) unit.SetCamp(MapID, InstanceID, TargetID, 0) end aux.RegisterMapEvent("dmap4a",3, "baozang_OnPlayerLeave") aux.RegisterMapEvent("dmap4a",25, "baozang_OnPlayerLeave") function baozangjidi_OnDie(MapID, InstanceID, TargetID, TargetTypeID, RoleID) local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID,101,207413) msg.DispatchMapMsgEvent(MsgID, MapID, InstanceID) map.SetMonsterGenState(MapID, InstanceID, 3) end aux.RegisterCreatureEvent(1086116, 4, "baozangjidi_OnDie") aux.RegisterCreatureEvent(1086195, 4, "baozangjidi_OnDie") function baozangBOSS_OnDie(MapID, InstanceID, TargetID, TargetTypeID, RoleID) local oldChest = map.GetMapScriptData(MapID,InstanceID,1,49) if oldChest == 1 then aux.WriteLog("[baozanggongdian] skip_duplicate_final_chest map=" .. MapID .. " instance=" .. InstanceID .. "\r\n") return end if MapID == 2818701571 then local x = map.GetMapScriptData(MapID,InstanceID,1,1) if x == nil then x = 0 end x = x+1 map.SetMapScriptData(MapID,InstanceID,1,1,x) if x >= 2 then local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID,101,207415) msg.DispatchMapMsgEvent(MsgID, MapID, InstanceID) end else local MsgID = msg.BeginMsgEvent() msg.AddMsgEvent(MsgID,101,207414) msg.DispatchMapMsgEvent(MsgID, MapID, InstanceID) map.SetMonsterGenState(MapID, InstanceID, 3) end local x1 = 13300/50 local y1 = 4740 local z1 = 15400/50 if RoleID ~= nil and RoleID ~= 0 and RoleID ~= -1 then local rx, ry, rz = unit.GetPosition(MapID, InstanceID, RoleID) if rx ~= nil and ry ~= nil and rz ~= nil then x1 = rx y1 = ry z1 = rz end end local guaiID = map.MapCreateCreature(MapID, InstanceID, 6040315, x1, y1, z1) if guaiID ~= nil and guaiID ~= 0 and guaiID ~= -1 then map.SetMapScriptData(MapID,InstanceID,1,49,1) for a = 1, 6 do cre.SetCreatureScriptData(MapID, InstanceID, guaiID, 1, a, 1) end else aux.WriteLog("[baozanggongdian] create_final_chest_failed map=" .. MapID .. " instance=" .. InstanceID .. "\r\n") end end aux.RegisterCreatureEvent(1086050, 4, "baozangBOSS_OnDie") aux.RegisterCreatureEvent(1086020, 4, "baozangBOSS_OnDie")