[TLBB] Phó Bản
Follow us on
Follow us on Facebook Follow us on Twitter Linked In Flickr Watch us on YouTube My Space Blogger
 
Kết quả 1 đến 2 của 2

Chủ đề: Phó Bản

  1. #1
    Thành Viên
    Ngày tham gia
    Nov 2010
    Bài viết
    58
    Thanks
    16
    Thanked 3 Times in 3 Posts

    Phó Bản

    Có ai biết cách Add một phụ bản mới vào Game ko ..hướng dẫn mình với...
    Khách viếng thăm hãy cùng thanh06 xây dựng diễn đàn CLBGAMESVN vững mạnh nhé!

  2. #2
    Super Moderator Sói Đẹp Trai's Avatar
    Ngày tham gia
    Apr 2011
    Đang ở
    地獄
    Bài viết
    3,991
    Thanks
    369
    Thanked 4,069 Times in 1,403 Posts

    Ðề: Phó Bản

    Mình có đoạn code sau về phụ bản bạn chịu khó đọc dịch và hiểu nhé. Còn add vào thì nó như các pb thường thôi. Bạn tham khảo các pb của bọn tàu nó làm ấy chỉ cần bước đó là đủ.
    Code tổng quát của pb có dạng như sau
    Code:
    --Powered by TLBB-LuaEditor
    
    --Script:	YOUR SCRIPT DESCRIPTION
    --Author:	YOUR NAME
    --Date:		CURRENT DATE
    
    --************************--
    x000000_g_ScriptId = 000000							--ID of this script. Remember replace all 000000 text by your script index with exactly 6 digits
    --************************--
    x000000_g_CopySceneType =							--This constant is the index of this CopyScene. Find it at ScriptGlobal and register it at scene.lua. (Eg: FUBEN_TEST)
    x000000_g_CopySceneLifeTime =						--The lifetime of this CopyScene (milis)
    x000000_g_CopySceneMissionData =					--The MD of this CopyScene (Ex: MD_FUBEN_TEST)
    x000000_g_LoadMonster = "_monster.ini"				--Set loading monster file for this CopyScene (Ex: "test_monster.ini")
    x000000_g_LoadScene = ".nav"						--Set loading scene file for this CopyScene (Ex: "test.nav")
    x000000_g_LoadArea = "_area.ini"					--Set loading area file for this CopyScene (Ex: "test_area.ini")
    x000000_g_NoUserTime = 5000							--The time of closing CopyScene while no player is inside (milis)
    x000000_g_Relive_PosX = 							--The relive position X of player at the CopyScene
    x000000_g_Relive_PosY = 							--The relive position Y of player at the CopyScene
    x000000_g_Limit_Member = 							--The minimum number of player that able to attend this CopyScene
    x000000_g_TurnPerDay = 								--The maximum number of attending time of player at this CopyScene
    x000000_g_Need_Level = 								--The minimum level of player that able to attend this CopyScene
    --These values belows should be default
    x000000_g_CopySceneTimer = 9						--Variable index 10 stores the time of CopyScene to generate MilisTime
    x000000_g_CopySceneTimeLeft = 10					--Variable index 10 stores the time left of CopyScene
    x000000_g_CopySceneStep = 11						--Controller step of CopyScene
    -- TODO init some variables index below with value range [12..36]
    
    --************************--
    
    
    --=========================================================--
    -- [DEFAULT]
    -- This function is called to add the selection of this event to a NPC
    --   sceneId:	ID of current scene
    --   playerId:	ID of player
    --   targetId:	ID of NPC
    --=========================================================--
    function x000000_OnEnumerate(sceneId,playerId,targetId)
    	
    	--************************--
    	AddNumText(sceneId,x000000_g_ScriptId,"Create copy scene",3,0)
    	AddNumText(sceneId,x000000_g_ScriptId,"Leave",3,1)
    	--************************--
    	-- TODO your code below.
    	
    	--************************--
    end
    
    
    --=========================================================--
    -- [DEFAULT]
    -- This function is called to catch the selection event of this event
    --   sceneId:	ID of current scene
    --   playerId:	ID of player
    --   targetId:	ID of NPC
    --=========================================================--
    function x000000_OnDefaultEvent(sceneId,playerId,targetId)
    	
    	--************************--
    	if GetNumText()==0 then
    		local result,nTip=x000000_OnCheckCondition(sceneId,playerId)
    		if result==0 then
    			BeginEvent(sceneId)
    				AddText(sceneId,nTip)
    			EndEvent(sceneId)
    			DispatchEventList(sceneId,playerId,targetId)
    			return
    		end
    		x000000_MakeCopyScene(sceneId,playerId)
    	end
    	--************************--
    	if GetNumText()==1 then
    		BeginUICommand(sceneId)
    		EndUICommand(sceneId)
    		DispatchUICommand(sceneId,playerId,1000)
    	end
    	--************************--
    	-- TODO your code below.
    	
    	--************************--
    	
    end
    
    
    --=========================================================--
    -- [ADDITION]
    -- This function is called to check some conditions of player before entering
    --   sceneId:	ID of current scene
    --   playerId:	ID of player
    --=========================================================--
    function x000000_OnCheckCondition(sceneId,playerId)
    	
    	--************************--
    	if LuaFnHasTeam(sceneId,playerId)~=1 then
    		return 0,"You need to join in a team!"
    	end
    	--************************--
    	if GetTeamLeader(sceneId,playerId)~=playerId then
    		return 0,"You are not team leader!"
    	end
    	--************************--
    	if GetTeamSize(sceneId,playerId)<x000000_g_Limit_Member then
    		return 0,"Your team needs to have at least #G"..x000000_g_Limit_Member.."#W member!"
    	end
    	--************************--
    	local NearTeamSize = GetNearTeamCount(sceneId,playerId)
    	if GetTeamSize(sceneId,playerId)~=NearTeamSize then
    		return 0,"Your teammates need to stay near by me!"
    	end
    	--************************--
    	local Humanlist={}
    	local nHumanNum=0
    	for i=0,NearTeamSize-1 do
    		local teammateId=GetNearTeamMember(sceneId,playerId,i)
    		if GetLevel(sceneId,teammateId)<x000000_g_Need_Level then
    			Humanlist[nHumanNum]=GetName(sceneId,teammateId)
    			nHumanNum = nHumanNum+1
    		end
    	end
    	if nHumanNum > 0 then
    		local msg="Your team has "
    		for i=0,nHumanNum-2 do
    			msg=msg..Humanlist[i]..", "
    		end
    		msg=msg..Humanlist[nHumanNum-1].." whose level is not enough #G"..x000000_g_Need_Level..", can`t join in this event!"
    		return 0,msg
    	end
    	--************************--
    	local Humanlist={}
    	local nHumanNum=0
    	local CurDayTime = GetDayTime()
    	for i=0,NearTeamSize-1 do
    		local teammateId=GetNearTeamMember(sceneId,playerId,i)
    		local lastTime = GetMissionData(sceneId,teammateId,x000000_g_CopySceneMissionData)
    		local lastDayTime = floor(lastTime/100)
    		local lastDayCount = mod(lastTime,100)
    		if CurDayTime > lastDayTime then
    			lastDayTime = CurDayTime
    			lastDayCount = 0
    		end
    		if lastDayCount >= x000000_g_TurnPerDay then
    			Humanlist[nHumanNum]=GetName(sceneId,teammateId)
    			nHumanNum = nHumanNum+1
    		end
    	end
    	if nHumanNum > 0 then
    		local msg="Your team has "
    		for i=0,nHumanNum-2 do
    			msg=msg..Humanlist[i]..", "
    		end
    		msg=msg..Humanlist[nHumanNum-1].." who attent that event enough times today!"
    		return 0,msg
    	end
    	--************************--
    	
    end
    
    
    --=========================================================--
    -- [ADDITION]
    -- This function is called to create the copy scene
    --   sceneId:	ID of current scene
    --   playerId:	ID of player
    --=========================================================--
    function x000000_MakeCopyScene(sceneId,playerId)
    	
    	--************************--
    	local x,y=GetWorldPos(sceneId,playerId)
    	LuaFnSetSceneLoad_Map(sceneId,x000000_g_LoadScene)
    	LuaFnSetCopySceneData_TeamLeader(sceneId,LuaFnObjId2Guid(sceneId,playerId))
    	LuaFnSetCopySceneData_NoUserCloseTime(sceneId,x000000_g_NoUserTime)
    	LuaFnSetCopySceneData_Timer(sceneId,1)
    	LuaFnSetCopySceneData_Param(sceneId,0,x000000_g_CopySceneType)
    	LuaFnSetCopySceneData_Param(sceneId,1,x000000_g_ScriptId)
    	LuaFnSetCopySceneData_Param(sceneId,2,0)
    	LuaFnSetCopySceneData_Param(sceneId,3,sceneId)
    	LuaFnSetCopySceneData_Param(sceneId,4,x)
    	LuaFnSetCopySceneData_Param(sceneId,5,y)
    	LuaFnSetCopySceneData_Param(sceneId,6,GetTeamId(sceneId,playerId))
    	LuaFnSetCopySceneData_Param(sceneId,7,0)
    	--************************--
    	for i=8,31 do
    		LuaFnSetCopySceneData_Param(sceneId,i,0)
    	end
    	--************************--
    	LuaFnSetSceneLoad_Area(sceneId,x000000_g_LoadArea)
    	LuaFnSetSceneLoad_Monster(sceneId,x000000_g_LoadMonster)
    	local bRetSceneID=LuaFnCreateCopyScene(sceneId)
    	BeginEvent(sceneId)
    		if bRetSceneID>0 then
    			AddText(sceneId,"Transfer succeeded!")
    		else
    			AddText(sceneId,"Over number of copyscene. Please try again later!")
    		end
    	EndEvent(sceneId)
    	DispatchMissionTips(sceneId,playerId)
    	--************************--
    	
    end
    
    
    --=========================================================--
    -- [DEFAULT]
    -- This function is called to take players to the copy scene. This function should be kept default
    --   sceneId:		ID of current scene
    --   destsceneId:	ID of target scene
    --=========================================================--
    function x000000_OnCopySceneReady(sceneId,destsceneId)
    	
    	--************************--
    	LuaFnSetCopySceneData_Param(destsceneId,3,sceneId)
    	leaderguid=LuaFnGetCopySceneData_TeamLeader(destsceneId)
    	leaderObjId=LuaFnGuid2ObjId(sceneId,leaderguid)
    	local nearteammembercount=GetNearTeamCount(sceneId,leaderObjId)
    	local mems={}
    	for i=0,nearteammembercount-1 do
    		mems[i]=GetNearTeamMember(sceneId,leaderObjId,i)
    		NewWorld(sceneId,mems[i],destsceneId,x000000_g_Relive_PosX,x000000_g_Relive_PosY)
    	end
    	--************************--
    	
    end
    
    
    --=========================================================--
    -- [DEFAULT]
    -- This function is called every short tick lifetimer of this copy scene
    --   sceneId:		ID of current scene
    --   nowTime:		Current system time
    --=========================================================--
    function x000000_OnCopySceneTimer(sceneId,nowTime)
    	
    	--************************--
    	local nTick = x000000_UpdateTimerMilis(sceneId,nowTime)		--This is the milis time, use it base on your goal
    	x000000_ShowCopySceneTimer(sceneId,nTick)
    	--************************--
    	local nStep = LuaFnGetCopySceneData_Param(sceneId,x000000_g_CopySceneStep)
    	--************************--
    	if nStep==0 then
    		x000000_InitCopySceneData(sceneId)
    		LuaFnSetCopySceneData_Param(sceneId,x000000_g_CopySceneStep,1)
    	end
    	--************************--
    	-- TODO your code below. with `nStep` start with value = 1
    	
    	--************************--
    	
    end
    
    
    --=========================================================--
    -- [DEFAULT]
    -- This function is called to do something when players enter copy scene (includes disconnect then reconnect)
    --   sceneId:	ID of current scene
    --   playerId:	ID of player
    --=========================================================--
    function x000000_OnPlayerEnter(sceneId,playerId)
    	
    	--************************--
    	local lastTime = GetMissionData(sceneId,playerId,x000000_g_CopySceneMissionData)
    	local lastDayTime = floor(lastTime/100)
    	local lastDayCount = mod(lastTime,100)
    	local CurDayTime = GetDayTime()
    	if CurDayTime > lastDayTime then
    		lastDayTime = CurDayTime
    		lastDayCount = 0
    	end
    	lastDayCount = lastDayCount+1
    	lastTime = lastDayTime*100+lastDayCount
    	--************************--
    	SetMissionData(sceneId,playerId,x000000_g_CopySceneMissionData,lastTime)
    	--************************--
    	SetPlayerDefaultReliveInfo(sceneId,playerId,"%10",-1,"0",sceneId,x000000_g_Relive_PosX,x000000_g_Relive_PosY)
    	--************************--
    	-- TODO your code below.
    	
    	--************************--
    	
    end
    
    
    --=========================================================--
    -- [ADDITION]
    -- This function is called to update the timeleft of copy scene
    --   sceneId:		ID of current scene
    --   nowTime:		Current system time
    --=========================================================--
    function x000000_UpdateTimerMilis(sceneId,nowTime)
    	
    	--************************--
    	if LuaFnGetCopySceneData_Param(sceneId,x000000_g_CopySceneTimeLeft)==0 then
    		LuaFnSetCopySceneData_Param(sceneId,x000000_g_CopySceneTimeLeft,x000000_g_CopySceneLifeTime)
    	end
    	--************************--
    	local nTick = nowTime-LuaFnGetCopySceneData_Param(sceneId,x000000_g_CopySceneTimeLeft)
    	LuaFnSetCopySceneData_Param(sceneId,x000000_g_CopySceneTimeLeft,nowTime)
    	return nTick
    	--************************--
    	
    end
    
    
    --=========================================================--
    -- [ADDITION]
    -- This function is called to show the copyscene timeleft to player
    --   sceneId:		ID of current scene
    --   nTick:			The milis timer between previous call and current call
    --=========================================================--
    function x000000_ShowCopySceneTimer(sceneId,nTick)
    	
    	--************************--
    	local timeLeft = LuaFnGetCopySceneData_Param(sceneId,x000000_g_CopySceneTimeLeft)-nTick
    	LuaFnSetCopySceneData_Param(sceneId,x000000_g_CopySceneTimeLeft,timeLeft)
    	--************************--
    	-- TODO your code below.
    	
    	--************************--
    	
    end
    
    
    --=========================================================--
    -- [ADDITION]
    -- This function is called to initialize some paramaters of copyscene
    --   sceneId:		ID of current scene
    --=========================================================--
    function x000000_InitCopySceneData(sceneId)
    	
    	--************************--
    	-- TODO your code below.
    	
    	--************************--
    	
    end
    
    
    --=========================================================--
    -- [ADDITION]
    -- This function is called to kick out all players from this copy scene
    -- You need to call it when you want to do this action
    --   sceneId:		ID of current scene
    --=========================================================--
    function x000000_KickOutAllPlayer(sceneId)
    	
    	--************************--
    	local nHumanNum=LuaFnGetCopyScene_HumanCount(sceneId)
    	local Scene=LuaFnGetCopySceneData_Param(sceneId,3)
    	local x=LuaFnGetCopySceneData_Param(sceneId,4)
    	local y=LuaFnGetCopySceneData_Param(sceneId,5)
    	for i=0,nHumanNum-1 do
    		local teamMateId=LuaFnGetCopyScene_HumanObjId(sceneId,i)
    		if LuaFnIsObjValid(sceneId,teamMateId)==1 and LuaFnIsCanDoScriptLogic(sceneId,teamMateId)==1 then
    			CallScriptFunction((400900),"TransferFunc",sceneId,teamMateId,Scene,x,y)
    		end
    	end
    	--************************--
    	
    end
    
    
    --=========================================================--
    -- [ADDITION]
    -- This function is called to show notification tip to all players inside this copy scene
    -- You need to call it when you want to do this action
    --   sceneId:		ID of current scene
    --=========================================================--
    function x000000_TipAllHuman(sceneId,nTip)
    	
    	--************************--
    	local nHumanNum=LuaFnGetCopyScene_HumanCount(sceneId)
    	for i=0,nHumanNum-1 do
    		local teamMateId=LuaFnGetCopyScene_HumanObjId(sceneId,i)
    		if LuaFnIsObjValid(sceneId,teamMateId)==1 and LuaFnIsCanDoScriptLogic(sceneId,teamMateId)==1 then
    			BeginEvent(sceneId)
    				AddText(sceneId,nTip)
    			EndEvent(sceneId)
    			DispatchMissionTips(sceneId,teamMateId)
    		end
    	end
    	--************************--
    	
    end


    Được gọi qua 1 NPC như này.
    Code:
    --Powered by TLBB-LuaEditor
    
    --Script:	YOUR SCRIPT DESCRIPTION
    --Author:	YOUR NAME
    --Date:		CURRENT DATE
    
    --************************--
    x000000_g_ScriptId = 000000								--ID of this script. Remember replace all 000000 text by your script index with exactly 6 digits
    --************************--
    x000000_g_Event_ScriptId = 000001						--Script event. Remember replace 000001 by the script index of your target event
    --************************--
    
    --=========================================================--
    -- [DEFAULT]
    -- This function is called firstly when a player clicks on NPC
    --   sceneId:	ID of current scene
    --   playerId:	ID of player
    --   targetId:	ID of NPC
    --=========================================================--
    function x000000_OnDefaultEvent(sceneId,playerId,targetId)
    
    	--************************--
    	BeginEvent(sceneId)
    		AddText(sceneId,"SOME TEXT")
    		CallScriptFunction(x000000_g_Event_ScriptId,"OnEnumerate",sceneId,playerId,targetId)
    	EndEvent(senceId)
    	DispatchEventList(sceneId,playerId,x000000_g_ScriptId)
    	--************************--
    	
    end
    
    
    --=========================================================--
    -- [DEFAULT]
    -- This function is called when a selection is detected
    --   sceneId:	ID of current scene
    --   playerId:	ID of player
    --   targetId:	ID of NPC
    --   eventId:	ID of selection event (Don`t need to pay attention to it)
    --=========================================================--
    function x000000_OnEventRequest(sceneId,playerId,targetId,eventId)
    
    	--************************--
    	if eventId==x000000_g_Event_ScriptId then
    		CallScriptFunction(eventId,"OnDefaultEvent",sceneId,playerId,targetId)
    		return
    	end
    	--************************--
    	
    end
    Khách viếng thăm hãy cùng Sói Đẹp Trai xây dựng diễn đàn CLBGAMESVN vững mạnh nhé!

 

 

Các Chủ đề tương tự

  1. EASEUS Partition Master 10.0 Technican Edition - Phần mềm phân chia phân vùng
    Bởi anhkhongdoiqua trong diễn đàn Công cụ dành cho PC
    Trả lời: 0
    Bài viết cuối: 11-04-14, 04:29 PM
  2. Trả lời: 0
    Bài viết cuối: 11-06-09, 12:26 PM
  3. Phát triển nhiệm vụ 10 môn phái
    Bởi akarizone trong diễn đàn Guides - Kho Lưu trữ
    Trả lời: 38
    Bài viết cuối: 22-12-08, 04:17 PM

Quyền viết bài

  • Bạn Không thể gửi Chủ đề mới
  • Bạn Không thể Gửi trả lời
  • Bạn Không thể Gửi file đính kèm
  • Bạn Không thể Sửa bài viết của mình
  •  
Múi giờ GMT +7. Bây giờ là 03:00 PM.
vBulletin®, Copyright ©2000-2011, Jelsoft Enterprises Ltd.
CLBGamesVN không chịu trách nhiệm về Luật Bản Quyền của các tài liệu, bài viết v.v...được đăng tải trên diễn đàn này.
Diễn đàn phát triển dưới sự đóng góp của tất cả thành viên. BQT chỉ là những người thành lập ra sân chơi, quản lý và duy trì về mặt kỹ thuật, nội dung khi hợp lệ.