天龍八部武夷千年冰魄

loovpfox發表於2018-09-07

在玩天龍八部的時候,我們刷武夷BOSS千年冰魄傷害為什麼這麼高呢?來看看武夷千年冰魄怪物指令碼的構架,


x810100_CreateChildTbl = {


MotherID=962, CreateTime=5*1000, CreateNum=2, AllChildNum=5, ChildID=1082, BaseAI=0, ExtAIScript=-1, ScriptID=-1, LifeTime=10*1000 }


--武夷BOSS  千年冰魄刷小怪....

{ MotherID=9120, CreateTime=60000, CreateNum=6, AllChildNum=900, ChildID=9140, BaseAI=0, ExtAIScript=-1, ScriptID=-1, LifeTime=45000 },

--武夷BOSS  小BOSS刷小怪....

{ MotherID=9121, CreateTime=60000, CreateNum=6, AllChildNum=900, ChildID=9141, BaseAI=0, ExtAIScript=-1, ScriptID=-1, LifeTime=45000 },

{ MotherID=9122, CreateTime=60000, CreateNum=6, AllChildNum=900, ChildID=9142, BaseAI=0, ExtAIScript=-1, ScriptID=-1, LifeTime=45000 },

{ MotherID=9123, CreateTime=60000, CreateNum=6, AllChildNum=900, ChildID=9143, BaseAI=0, ExtAIScript=-1, ScriptID=-1, LifeTime=45000 },

{ MotherID=9124, CreateTime=60000, CreateNum=6, AllChildNum=900, ChildID=9144, BaseAI=0, ExtAIScript=-1, ScriptID=-1, LifeTime=45000 },

{ MotherID=9125, CreateTime=60000, CreateNum=6, AllChildNum=900, ChildID=9145, BaseAI=0, ExtAIScript=-1, ScriptID=-1, LifeTime=45000 },

{ MotherID=9126, CreateTime=60000, CreateNum=6, AllChildNum=900, ChildID=9146, BaseAI=0, ExtAIScript=-1, ScriptID=-1, LifeTime=45000 },

{ MotherID=9127, CreateTime=60000, CreateNum=6, AllChildNum=900, ChildID=9147, BaseAI=0, ExtAIScript=-1, ScriptID=-1, LifeTime=45000 },

{ MotherID=9128, CreateTime=60000, CreateNum=6, AllChildNum=900, ChildID=9148, BaseAI=0, ExtAIScript=-1, ScriptID=-1, LifeTime=45000 },

{ MotherID=9129, CreateTime=60000, CreateNum=6, AllChildNum=900, ChildID=9149, BaseAI=0, ExtAIScript=-1, ScriptID=-1, LifeTime=45000 },


}


--小怪重新整理點列表....

--座標為相對於本BOSS的相對座標....可以填寫任意數目個座標....刷小怪時從中隨機選取一個使用....

x810100_MonsterPosTbl = {


{ x = 0,  y = 0  },


}


x810100_IDX_UpdateMonsterTime = 1

x810100_IDX_NeedCreateMonsterNum = 2

x810100_IDX_EnableCreateMonster = 1

x810100_IDX_CombatFlag = 2


function x810100_OnDie( sceneId, selfId, killerId )

MonsterAI_SetIntParamByIndex(sceneId, selfId,  x810100_IDX_UpdateMonsterTime, 0)

MonsterAI_SetIntParamByIndex(sceneId, selfId,  x810100_IDX_NeedCreateMonsterNum, 0)

MonsterAI_SetBoolParamByIndex(sceneId, selfId, x810100_IDX_EnableCreateMonster, 0)

MonsterAI_SetBoolParamByIndex(sceneId, selfId, x810100_IDX_CombatFlag, 0)

end


function x810100_OnHeartBeat(sceneId, selfId, nTick)


--檢測是不是死了....

if LuaFnIsCharacterLiving(sceneId, selfId) ~= 1 then

return

end


--檢測是否不在戰鬥狀態....

if 0 == MonsterAI_GetBoolParamByIndex(sceneId, selfId, x810100_IDX_CombatFlag) then

return

end


--檢測是否已經不需要再刷小怪了....

if 0 == MonsterAI_GetBoolParamByIndex(sceneId, selfId, x810100_IDX_EnableCreateMonster) then

return

end


--還未到刷小怪的時間....

local UpdateTime = MonsterAI_GetIntParamByIndex(sceneId, selfId, x810100_IDX_UpdateMonsterTime)

if nTick < UpdateTime then

UpdateTime = UpdateTime - nTick

MonsterAI_SetIntParamByIndex(sceneId, selfId,  x810100_IDX_UpdateMonsterTime, UpdateTime)

return

end



--到了刷小怪的時間了....刷小怪....


--尋找本BOSS的刷怪資料表....

local BossDataID = GetMonsterDataID( sceneId, selfId )

local bFind = 0

local CreateData

for _, Data in x810100_CreateChildTbl do

if BossDataID == Data.MotherID then

CreateData = Data

bFind = 1

break

end

end


local CreateNum = 0

local NeedCreateNum = MonsterAI_GetIntParamByIndex(sceneId, selfId,  x810100_IDX_NeedCreateMonsterNum, 0)


if NeedCreateNum <= CreateData.CreateNum then

CreateNum = NeedCreateNum

MonsterAI_SetBoolParamByIndex(sceneId, selfId, x810100_IDX_EnableCreateMonster, 0)

else

CreateNum = CreateData.CreateNum

end

LuaFnNpcChat(sceneId, selfId, 0, "不知死活的傢伙,我的手下就能幹掉你!")

for i = 1, CreateNum do

x810100_CreateChildMonster( sceneId, selfId, CreateData )

end


MonsterAI_SetIntParamByIndex(sceneId, selfId,  x810100_IDX_NeedCreateMonsterNum, NeedCreateNum-CreateNum)

MonsterAI_SetIntParamByIndex(sceneId, selfId,  x810100_IDX_UpdateMonsterTime, CreateData.CreateTime)


end


function x810100_OnInit(sceneId, selfId)


--尋找本BOSS的刷怪資料表....

local BossDataID = GetMonsterDataID( sceneId, selfId )

local bFind = 0

local CreateData

for _, Data in x810100_CreateChildTbl do

if BossDataID == Data.MotherID then

CreateData = Data

bFind = 1

break

end

end


--初始化AI引數....

MonsterAI_SetIntParamByIndex(sceneId, selfId,  x810100_IDX_UpdateMonsterTime, 0)

MonsterAI_SetIntParamByIndex(sceneId, selfId,  x810100_IDX_NeedCreateMonsterNum, 0)

MonsterAI_SetBoolParamByIndex(sceneId, selfId, x810100_IDX_EnableCreateMonster, 0)

MonsterAI_SetBoolParamByIndex(sceneId, selfId, x810100_IDX_CombatFlag, 0)


if bFind == 1 then

if CreateData.CreateTime>0 and CreateData.CreateNum>0 and CreateData.AllChildNum>0 then

MonsterAI_SetIntParamByIndex(sceneId, selfId,  x810100_IDX_UpdateMonsterTime, CreateData.CreateTime)

MonsterAI_SetIntParamByIndex(sceneId, selfId,  x810100_IDX_NeedCreateMonsterNum, CreateData.AllChildNum)

MonsterAI_SetBoolParamByIndex(sceneId, selfId, x810100_IDX_EnableCreateMonster, 1)

end

end


end


function x810100_OnKillCharacter(sceneId, selfId, targetId)


--LuaFnNpcChat(sceneId, selfId, 0, "我殺死一個人了....去死吧你....")


--if(-1~=targetId) then

--local szTarget = GetName(sceneId, targetId)

--local str = format( "我殺死一個人了....%s(殺死的玩家名),我早看你不爽了....", szTarget )

--LuaFnNpcChat(sceneId, selfId, 0, str)

--end


end


function x810100_OnEnterCombat(sceneId, selfId, enmeyId)

--LuaFnNpcChat(sceneId, selfId, 0, "我進入戰鬥了....你們等著去找孟婆吧....")

MonsterAI_SetBoolParamByIndex(sceneId, selfId, x810100_IDX_CombatFlag, 1)

end


function x810100_OnLeaveCombat(sceneId, selfId)

--LuaFnNpcChat(sceneId, selfId, 0, "我離開戰鬥了....大家先停下吃點藥吧....")

MonsterAI_SetBoolParamByIndex(sceneId, selfId, x810100_IDX_CombatFlag, 0)

end


--建立一個小怪....

function x810100_CreateChildMonster(sceneId, selfId, CreateData)


local PosX, PosY = LuaFnGetWorldPos( sceneId, selfId )

local PosNum = getn( x810100_MonsterPosTbl )

local PosIndex = random( PosNum )

PosX = PosX + x810100_MonsterPosTbl[PosIndex].x

PosY = PosY + x810100_MonsterPosTbl[PosIndex].y


MonId = LuaFnCreateMonster(sceneId, CreateData.ChildID, PosX, PosY, CreateData.BaseAI, CreateData.ExtAIScript, CreateData.ScriptID )

if CreateData.LifeTime > 0 then

SetCharacterDieTime(sceneId, MonId, CreateData.LifeTime )

end


end


大家都明白千年冰魄是怎麼的的了吧!!!


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31553581/viewspace-2213769/,如需轉載,請註明出處,否則將追究法律責任。

相關文章