------------------------------------------------------------------ -- \author m-miyazaki -- \date 2009/11/12 -- \note モブ関連関数 ------------------------------------------------------------------ ------------------------------------------------------------------ -- 選択肢(はい・いいえ)を登録 ------------------------------------------------------------------ function MobUtil_SelectYesNo( id ) ccAdvWindowSelectAddItem( id, "commonmenuwords_000" ); -- はい ccAdvWindowSelectAddItem( id, "commonmenuwords_001" ); -- いいえ end ------------------------------------------------------------------ -- 人形回収イベント 共通処理 ----------------------------------------------------------------- function MobUtil_DollEventCommon( id, list, startMsgList, yesMsgList, noMsgList, getMsgList, battleId, checkPoint, itemId, dollNum ) local charaId1 = list[1][1]; local mobName1 = list[1][2]; local dollName1 = list[1][3]; local effName1 = list[1][4]; local charaId2 = PL_ID_DUMMY; local mobName2 = ""; local dollName2 = ""; local effName2 = ""; local charaId3 = PL_ID_DUMMY; local mobName3 = ""; local dollName3 = ""; local effName3 = ""; if dollNum >= 2 then charaId2 = list[2][1]; mobName2 = list[2][2]; dollName2 = list[2][3]; effName2 = list[2][4]; end if dollNum == 3 then charaId3 = list[3][1]; mobName3 = list[3][2]; dollName3 = list[3][3]; effName3 = list[3][4]; end -- 初期設定 MobUtil_SetMobDispByName( dollName1, false ); if dollNum >= 2 then MobUtil_SetMobDispByName( dollName2, false ); end if dollNum == 3 then MobUtil_SetMobDispByName( dollName3, false ); end local disp = ccIsDollDraw( charaId1 ) if disp == false then ccSetAdvMobEventCollision( id, false ); MobUtil_SetMobDispByName( mobName1, false ); MobUtil_SetMobDispByName( effName1, false ); if dollNum >= 2 then MobUtil_SetMobDispByName( mobName2, false ); MobUtil_SetMobDispByName( effName2, false ); end if dollNum == 3 then MobUtil_SetMobDispByName( mobName3, false ); MobUtil_SetMobDispByName( effName3, false ); end end -- 開始 local selectId = 0; while true do ccSuspendScript(); -- プレイヤーロック ccSetAdvPlayerLockOperate( id, false ); ccSetAdvPlayerState( id, CCD_ADV_CHARA_STATE_WAIT ); ccSetAdvSupportLockOperateAll( false ); -- 向かい合わせる ccTurnAdvMobByNameToPlayer( mobName1 ); if dollNum >= 2 then ccTurnAdvMobByNameToPlayer( mobName2 ); end if dollNum == 3 then ccTurnAdvMobByNameToPlayer( mobName3 ); end ccTurnAdvPlayerToMob( id ); ccWaitPlayerAct( id ); ccSuspendScript(); -- 開始時セリフ local startMsgNum = #startMsgList; for i = 1, startMsgNum, 1 do MobUtil_TalkMsgLeader( id, startMsgList[i] ); end -- 選択肢表示 ccAdvWindowSelectSetTitle( id, "s_sub00_009" ); -- 偽物を退治しますか? MobUtil_SelectYesNo( id ); -- はい・いいえ選択肢 ccAdvWindowSelectExecute( id ); -- 選択肢ウィンドウ表示 ccSuspendScript(); -- 選択肢入力待ち selectId = ccAdvWindowSelectGetCursorPos( id ); -- 選択肢の結果を取得 -- はい if selectId == 0 then -- ●チェックポイント用一時保存 ccAdvCheckPointBackup( id ); local yesMsgNum = #yesMsgList; for i = 1, yesMsgNum, 1 do MobUtil_TalkMsgLeader( id, yesMsgList[i] ); end break; -- いいえ else local noMsgNum = #noMsgList; for i = 1, noMsgNum, 1 do MobUtil_TalkMsgLeader( id, noMsgList[i] ); end end -- プレイヤーロック解除 ccSetAdvPlayerLockOperate( id, true ); ccSetAdvSupportLockOperateAll( true ); end -- 簡易キャラセレ ccChangeAdvCharacterSeelct( id ); ccSuspendScript(); -- SE ccSeOffLoopAdvEnv( id, 30 ); ccAllBgmFadeOut( id, 60 ); ccAdvPlaySe( id, S_ADV_battle ); -- 戦闘前演出 MobUtil_PrevBattleEffect( id ); -- ■戦闘 --------------------------------- -- ●アイテムメニューを開くか MobUtil_PreBattleSetting( id, battleId ); ccChangeBattleById( battleId, 3 ); ccSuspendScript(); ------------------------------------------- -- ロック ccSetAdvPlayerLockOperate( id, false ); ccSetAdvPlayerState( id, CCD_ADV_CHARA_STATE_WAIT ); ccSetAdvSupportLockOperateAll( false ); -- バトル後共通演出 ccSetAdvMobFade( id, 255, 255, 1 ); ccSuspendScript(); -- ★チェックポイントに戻る MobUtil_ReturnCheckPoint( id, checkPoint[1], checkPoint[2] ); -- 人形を非表示に MobUtil_SetMobDispByName( dollName1, false ); if dollNum >= 2 then MobUtil_SetMobDispByName( dollName2, false ); end if dollNum == 3 then MobUtil_SetMobDispByName( dollName3, false ); end ccSetAdvMobFade( id, 255, 0, 30 ); ccSuspendScript(); -- エフェクト表示 → キャラ非表示 → わら人形表示 local mobPos1 = ccGetAdvMobPositionByName( mobName1 ); ccAdvPlay3dSe( id, S_disappear2, mobPos1.x, mobPos1.y, mobPos1.z+60 ); ccCreateEffect(id, "data/effect/1efcmn.xfbin", "1efc_smk03l", mobPos1.x, mobPos1.y, mobPos1.z+60 ); MobUtil_SetMobDispByName( effName1, false ); local mobPos2; if dollNum >= 2 then mobPos2 = ccGetAdvMobPositionByName( mobName2 ); ccAdvPlay3dSe( id, S_disappear2, mobPos2.x, mobPos2.y, mobPos2.z+60 ); ccCreateEffect(id, "data/effect/1efcmn.xfbin", "1efc_smk03l", mobPos2.x, mobPos2.y, mobPos2.z+60 ); MobUtil_SetMobDispByName( effName2, false ); end local mobPos3; if dollNum == 3 then mobPos3 = ccGetAdvMobPositionByName( mobName3 ); ccAdvPlay3dSe( id, S_disappear2, mobPos3.x, mobPos3.y, mobPos3.z+60 ); ccCreateEffect(id, "data/effect/1efcmn.xfbin", "1efc_smk03l", mobPos3.x, mobPos3.y, mobPos3.z+60 ); MobUtil_SetMobDispByName( effName3, false ); end -- イベントヒットの中心からちょっとずつずらして配置 local basePos = ccGetAdvMobPosition( id ); mobPos1 = ccAdvEventVector3Sub( mobPos1, basePos ); mobPos1 = ccAdvEventVector3Normalize( mobPos1 ); mobPos1 = ccAdvEventVector3Scale( mobPos1, 7 ); mobPos1 = ccAdvEventVector3Add( basePos, mobPos1 ); ccSetAdvMobPosByName( dollName1, mobPos1.x, mobPos1.y, mobPos1.z ); if dollNum >= 2 then mobPos2 = ccAdvEventVector3Sub( mobPos2, basePos ); mobPos2 = ccAdvEventVector3Normalize( mobPos2 ); mobPos2 = ccAdvEventVector3Scale( mobPos2, 7 ); mobPos2 = ccAdvEventVector3Add( basePos, mobPos2 ); ccSetAdvMobPosByName( dollName2, mobPos2.x, mobPos2.y, mobPos2.z ); end if dollNum == 3 then mobPos3 = ccAdvEventVector3Sub( mobPos3, basePos ); mobPos3 = ccAdvEventVector3Normalize( mobPos3 ); mobPos3 = ccAdvEventVector3Scale( mobPos3, 7 ); mobPos3 = ccAdvEventVector3Add( basePos, mobPos3 ); ccSetAdvMobPosByName( dollName3, mobPos3.x, mobPos3.y, mobPos3.z ); end -- キャラ非表示に MobUtil_SetMobDispByName( mobName1, false ); if dollNum >= 2 then MobUtil_SetMobDispByName( mobName2, false ); end if dollNum == 3 then MobUtil_SetMobDispByName( mobName3, false ); end ccWaitAdvMob( id, 6 ); ccSuspendScript(); -- わら人形表示 MobUtil_SetMobDispByName( dollName1, true ); if dollNum >= 2 then MobUtil_SetMobDispByName( dollName2, true ); end if dollNum == 3 then MobUtil_SetMobDispByName( dollName3, true ); end ccWaitAdvMob( id, 6 ); ccSuspendScript(); -- 人形に近付く pos = ccGetAdvMobPosition( id ); ccWalkAdvPlayer( id, pos.x, pos.y, pos.z ); ccWaitPlayerAct( id ); ccSuspendScript(); ccWaitAdvMob( id, 1 ); ccSuspendScript(); -- アイテム拾う ccSetAdvPlayerAnmByMotionName( id, "gim0" ); ccWaitAdvMob( id, 6 ); ccSuspendScript(); -- わら人形非表示 ccSetAdvMobDispByName( dollName1, false ); if dollNum >= 2 then ccSetAdvMobDispByName( dollName2, false ); end if dollNum == 3 then ccSetAdvMobDispByName( dollName3, false ); end ccWaitEndAnmPlayer( id ); ccSuspendScript(); ccSetAdvPlayerState( id, CCD_ADV_CHARA_STATE_WAIT ); -- わら人形取得 -- 呪いの人形・凶の場合、一つだけ入手して連れの人形からは呪いの人形を取得する if itemId == "EVENT_ITEM22" then ccAddPossessItem( id, itemId, 1 ); ccAdvWindowItemAddItem( id, itemId, 1 ); ccAdvWindowItemExecute( id ); ccSuspendScript(); local tmpDollNum = dollNum-1; if tmpDollNum > 0 then ccAddPossessItem( id, "EVENT_ITEM21", tmpDollNum ); ccAdvWindowItemAddItem( id, "EVENT_ITEM21", tmpDollNum ); ccAdvWindowItemExecute( id ); ccSuspendScript(); end else ccAddPossessItem( id, itemId, dollNum ); ccAdvWindowItemAddItem( id, itemId, dollNum ); ccAdvWindowItemExecute( id ); ccSuspendScript(); end -- ★人形回収フラグをセット ccGetDoll( charaId1 ); if dollNum >= 2 then ccGetDoll( charaId2 ); end if dollNum == 3 then ccGetDoll( charaId3 ); end local getMsgNum = #getMsgList; for i = 1, getMsgNum, 1 do MobUtil_TalkMsgLeader( id, getMsgList[i] ); end -- トリガに使った奴を無効に ccSetAdvMobEventCollision( id, false ); -- プレイヤーロック解除 ccSetAdvPlayerLockOperate( id, true ); ccSetAdvSupportLockOperateAll( true ); end ------------------------------------------------------------------ -- バトル準備画面(アイテム画面)を開く ----------------------------------------------------------------- function MobUtil_PreBattleSetting( id, battleId ) ccSetAdvSupportLockOperateAll( false ); ccAdvUiTargetInvisible( id ); ccAdvUiFadeOut( id ); -- 方向指定カラーフィルタ有効 --ccEnableAdvColorFilterDirectional(0, 0x252423ff, 0xbbbbbbff, 0x252423ff, 0, 0.5); ccEnableAdvColorFilterDirectional(0, 0xffffffff, 0xffffffff, 0xffffffff, 0, 0); -- フェードを不可視化 ccSetAdvMobFade( id, 0, 0 , 1 ); ccSuspendScript(); -- ●戦闘前アイテムメニューへ ccChangeBattlePrevItemMenu( id, battleId ); ccSuspendScript(); -- フェード ccSetAdvMobFade( id, 0xffffffff, 0xffffffff, 1 ); ccSuspendScript(); -- カラーフィルタ無効 ccDisableAdvColorFilter(); ccAdvUiFadeIn( id ); ccAdvUiTargetVisible( id ); ccSetAdvSupportLockOperateAll( true ); end ------------------------------------------------------------------ -- 全キャラの体力回復 ----------------------------------------------------------------- function MobUtil_LifeHealAllChara() ccSetAdvPlayerLife( PL_ID_2NRT, 100 ); ccSetAdvPlayerLife( PL_ID_2SKR, 100 ); ccSetAdvPlayerLife( PL_ID_2KKS, 100 ); ccSetAdvPlayerLife( PL_ID_2SAI, 100 ); ccSetAdvPlayerLife( PL_ID_2SIK, 100 ); ccSetAdvPlayerLife( PL_ID_2TYO, 100 ); ccSetAdvPlayerLife( PL_ID_2INO, 100 ); ccSetAdvPlayerLife( PL_ID_2NEJ, 100 ); ccSetAdvPlayerLife( PL_ID_2ROC, 100 ); ccSetAdvPlayerLife( PL_ID_2TEN, 100 ); ccSetAdvPlayerLife( PL_ID_2SIN, 100 ); ccSetAdvPlayerLife( PL_ID_2HNT, 100 ); ccSetAdvPlayerLife( PL_ID_2KIB, 100 ); ccSetAdvPlayerLife( PL_ID_2GUY, 100 ); ccSetAdvPlayerLife( PL_ID_2YMT, 100 ); ccSetAdvPlayerLife( PL_ID_2TND, 100 ); ccSetAdvPlayerLife( PL_ID_2TMR, 100 ); ccSetAdvPlayerLife( PL_ID_2KNK, 100 ); ccSetAdvPlayerLife( PL_ID_2GAR, 100 ); ccSetAdvPlayerLife( PL_ID_2ASM, 100 ); ccSetAdvPlayerLife( PL_ID_2CYB, 100 ); ccSetAdvPlayerLife( PL_ID_2JRY, 100 ); ccSetAdvPlayerLife( PL_ID_2SSK, 100 ); ccSetAdvPlayerLife( PL_ID_2SGT, 100 ); ccSetAdvPlayerLife( PL_ID_2KAR, 100 ); ccSetAdvPlayerLife( PL_ID_2JUG, 100 ); end ------------------------------------------------------------------ -- プレゼントを渡す ----------------------------------------------------------------- function MobUtil_ForPresentEvent( id, itemList ) local playerId = ccGetAdvPlayerCharaId(); local isPresentOk = ccIsEventFlagOn( CCD_EVENT_FLAG_PRESENT_OK ); local isFriendshipnessMax = ccIsFriendshipnessMax( itemList[1] ); if isPresentOk == false or playerId ~= PL_ID_2NRT or isFriendshipnessMax then return; end local presentItemId = itemList[2]; local itemNum = ccGetItemNum( id, presentItemId ); if itemNum > 0 then MobUtil_SysMsg( id, itemList[3] ); -- 選択肢表示 ccAdvWindowSelectSetTitleReplaceByItemId( id, itemList[4], presentItemId ); -- 選択肢タイトル MobUtil_SelectYesNo( id ); -- はい・いいえ選択肢 ccAdvWindowSelectExecute( id ); -- 選択肢ウィンドウ表示 ccSuspendScript(); -- 選択肢入力待ち local selectId = ccAdvWindowSelectGetCursorPos( id ); -- 選択肢の結果を取得 -- はい if selectId == 0 then local msgNum = #itemList; for i = 5, msgNum, 1 do MobUtil_SetTalkMsg( id, itemList[i] ); end -- 所持アイテムから渡したアイテムを削除 ccDeletePossessItem( id, presentItemId, 1 ); -- 友好度アップ ccAddFriendshipness( itemList[1], 5 ); -- 5 = ハート1個分 end end end ------------------------------------------------------------------ -- チェックポイントに戻る ----------------------------------------------------------------- function MobUtil_ReturnCheckPoint( id, areaName, dmyName ) local retCheckPoint = ccIsReturnCheckPoint( id ); if retCheckPoint then ccChangeCheckPoint( areaName, dmyName ); -- BGM音量アップ ccStandDemoSndBgmAutoVolUp( id ); -- アイコンを表示 ccAdvUiTargetVisible( id ); ccAdvUiFadeIn( id ); -- サポートのロックを解除 ccSetAdvSupportLockOperateAll( true ); ccSuspendScript(); end end ------------------------------------------------------------------ -- バトル突入汎用 ----------------------------------------------------------------- function MobUtil_PrevBattleEffect( id ) ccOnStandDemoCamera(); ccWaitAdvMob( id, 1 ); ccSuspendScript(); ccInitStandDemoCamera(); -- 汎用ブラー設定 ccSetAdvBlur(0, 50, 50, 20, 0.8, 0.8, 0, -1); -- カメラ移動(バトル突入前汎用) -- 現在のカメラから画角-30 20フレーム 減速を設定する ccMoveStandDemoCameraToBattle(); ccSetAdvMobFadeSetColor(id, 255, 255, 255, 0, 255, 20); ccSuspendScript(); ccWaitAdvMob( id, 30 ); ccSuspendScript(); ccOffStandDemoCamera(); end ------------------------------------------------------------------ -- 忍具の所持数を取得 ----------------------------------------------------------------- function MobUtil_GetBattleItemNum( id ) local list = { "BATTLE_ITEM00", "BATTLE_ITEM01", "BATTLE_ITEM02", "BATTLE_ITEM03", "BATTLE_ITEM04", "BATTLE_ITEM05", "BATTLE_ITEM08", "BATTLE_ITEM09", "BATTLE_ITEM10", "BATTLE_ITEM11", "BATTLE_ITEM12", "BATTLE_ITEM13", "BATTLE_ITEM14", "BATTLE_ITEM15", "BATTLE_ITEM16", "BATTLE_ITEM17", "BATTLE_ITEM18", "BATTLE_ITEM19", "BATTLE_ITEM20", "BATTLE_ITEM21", "BATTLE_ITEM22", "BATTLE_ITEM23", "BATTLE_ITEM24", "BATTLE_ITEM25", "BATTLE_ITEM26", "BATTLE_ITEM27", "BATTLE_ITEM28", "BATTLE_ITEM29", "BATTLE_ITEM30", "BATTLE_ITEM31", "BATTLE_ITEM32", "BATTLE_ITEM33", "BATTLE_ITEM34", "BATTLE_ITEM35", "BATTLE_ITEM36", "BATTLE_ITEM37", "BATTLE_ITEM38", "BATTLE_ITEM39", "BATTLE_ITEM40", "BATTLE_ITEM41", "BATTLE_ITEM42", "BATTLE_ITEM43", "BATTLE_ITEM44", "BATTLE_ITEM45", "BATTLE_ITEM46", "BATTLE_ITEM47", "BATTLE_ITEM48", "BATTLE_ITEM49", }; local listNum = #list; local totalNum = 0; for i = 1, listNum, 1 do local num = ccGetItemNum( id, list[i] ); if num > 0 then totalNum = totalNum + 1; end end return totalNum; end ------------------------------------------------------------------ -- 現在のシーンを取得(会話切り替わり) ------------------------------------------------------------------ function MobUtil_GetNowScene( id ) local scene = "scene00"; local chap = ccGetAdvMainChapter( id ); local seq = ccGetAdvMainSequence( id ); local areaName = ccGetTownId( id ); -- 砂隠れの里 if areaName == CCD_AREA_SAND_TOWN then if chap == 1 then scene = "scene13"; elseif chap == 2 then scene = "scene14"; elseif chap >= 8 then scene = "scene16"; else scene = "scene15"; end -- 雨隠れの里 elseif areaName == CCD_AREA_RAIN_TOWN then if chap >= 8 then scene = "scene18"; else scene = "scene17"; end -- 木ノ葉隠れの里 else -- 操作キャラで違う場合は優先してチェック local playerId = ccGetAdvPlayerCharaId(); if playerId == PL_ID_2ASM then scene = "scene03"; elseif playerId == PL_ID_2SIK then scene = "scene06"; elseif playerId == PL_ID_2JRY then scene = "scene08"; elseif playerId == PL_ID_2GUY then scene = "scene19"; else -- 操作キャラはナルト if (chap == 0) or (chap == 1) then scene = "scene00"; -- scene00 : 序章と一章 elseif (chap == 2) then scene = "scene01"; -- scene01 : 第二章 elseif (chap == 3) then if (seq < 4 ) then scene = "scene02"; -- scene02 : サスケ再会後 elseif (seq < 14) then scene = "scene04"; -- scene04 : ナルト休憩中 elseif (seq < 17) then scene = "scene05"; -- scene05 : アスマ死亡後 else scene = "scene07"; -- scene07 : ナルト操作時 end elseif (chap == 6) then if (seq < 16) then scene = "scene09"; -- scene09 : ナルト操作時 else scene = "scene10"; -- scene10 : 自来也戦死報告後 end elseif (chap == 7) then scene = "scene11"; -- scene11 : ナルト立ち直り後 else scene = "scene12"; -- scene12 : クリア後(ランダムで3つ) end end end return scene; end ------------------------------------------------------------------ -- 汎用会話処理 ------------------------------------------------------------------ function MobUtil_Talking( id, talkList ) -- チュートリアル表示 if( ccIsTutorialGet( "TUTORIAL_000" ) == false ) then ccChangeTutorial( id, "TUTORIAL_000"); ccSuspendScript(); end -- シーンを取得 local scene = MobUtil_GetNowScene( id ); -- 会話中モーション ccSetAdvMobAnmById( id, talkList[scene][1] ); -- メッセージ local msgNum = #(talkList[scene]); for i = 3, msgNum, 1 do MobUtil_SetTalkMsg( id, talkList[scene][i] ); end -- 会話後モーション ccSetAdvMobAnmById( id, talkList[scene][2] ); end ------------------------------------------------------------------ -- 依頼に関係するサポートがいるかをチェック ------------------------------------------------------------------ function MobUtil_IsSubEventWake( id, withoutCharaIdList ) local supportNum = ccGetSupportCharaNum(); local withoutCharaNum = #withoutCharaIdList; for i = 0, supportNum, 1 do local supportId = ccGetAdvSupportCharaId( i ); for j = 1, withoutCharaNum, 1 do if supportId == withoutCharaIdList[j] then return false; end end end return true; end ------------------------------------------------------------------ -- サポートに入っているかチェック ------------------------------------------------------------------ function MobUtil_IsSupportMember( id, charaId ) local supportNum = ccGetSupportCharaNum(); for i = 0, supportNum, 1 do local supportId = ccGetAdvSupportCharaId( i ); if supportId == charaId then return true; end end return false; end ------------------------------------------------------------------ -- 他の依頼の発生状況をチェック ------------------------------------------------------------------ function MobUtil_IsSubEventWakeCheckOtherEvent( id, list ) local playerId = ccGetAdvPlayerCharaId(); -- プレイヤーがナルトで、依頼発生する状況ならチェック if (playerId == PL_ID_2NRT) and (ccIsEventFlagOn( CCD_EVENT_FLAG_REQUEST_NO_WAKE ) == false) then local num = #list; for i = 1, num, 1 do local state = ccGetSubEventStateBySubEventId( list[i] ); if (state >= CCD_SUB_EVENT_STATE_WAKE) and (state < CCD_SUB_EVENT_STATE_CLEAR) then return false; end end end return true; end ------------------------------------------------------------------ -- エリア引き止めのメッセージセレクト ------------------------------------------------------------------ function MobUtil_AlMessageNaruto( id ) -- ナルト(真剣) local chap = ccGetAdvMainChapter( id ); local seq = ccGetAdvMainSequence( id ); if (chap == 1 and seq >= 5) or (chap == 2 and seq >= 14) or (chap == 3 and seq >= 14) then local num = math.random( 0, 1 ); if num == 0 then MobUtil_TalkMsgLeader( id, "talk_al_nrt_03" ); else MobUtil_TalkMsgLeader( id, "talk_al_nrt_04" ); end else -- ナルト(通常時) local num = math.random( 0, 3 ); if num == 0 then MobUtil_TalkMsgLeader( id, "talk_al_nrt_00" ); elseif num == 1 then MobUtil_TalkMsgLeader( id, "talk_al_nrt_01" ); else MobUtil_TalkMsgLeader( id, "talk_al_nrt_02" ); end end end function MobUtil_AlMessageGuy( id ) -- ガイ(通常時) local num = math.random( 0,4 ); if num == 0 then MobUtil_TalkMsgLeader( id, "talk_al_guy_00" ); elseif num == 1 then MobUtil_TalkMsgLeader( id, "talk_al_guy_01" ); elseif num == 2 then MobUtil_TalkMsgLeader( id, "talk_al_guy_02" ); elseif num == 3 then MobUtil_TalkMsgLeader( id, "talk_al_guy_03" ); elseif num == 4 then MobUtil_TalkMsgLeader( id, "talk_al_guy_05" ); end end ------------------------------------------------------------------ -- 班編成の結果演出 ------------------------------------------------------------------ function MobUtil_ChangeSupport( id, isFirst, appearPos, appearRot, usePos ) local SP_NUM = 3; -- サポートのメンバー数 local SMK_APPEAR_SE_ID = S_change; -- 煙SE local SMK_DISAPPEAR_SE_ID = S_disappear2; -- 今サポートにいるメンバー local nowSupportMember = { ccGetAdvSupportCharaId( 0 ), ccGetAdvSupportCharaId( 1 ), ccGetAdvSupportCharaId( 2 ), }; -- 新パーティのメンバー local newSupportMember = { ccGetNewSupportMember( 0 ), ccGetNewSupportMember( 1 ), ccGetNewSupportMember( 2 ), }; if isFirst then isFirst = false; for i = 1, SP_NUM, 1 do usePos[i] = nowSupportMember[i]; end end local outFlag = { true, true, true }; local inFlag = { true, true, true }; for i = 1, SP_NUM, 1 do if newSupportMember[i] == PL_ID_DUMMY then inFlag[i] = false; end end -- 新パーティにもいるなら抜けない for i = 1, SP_NUM, 1 do if nowSupportMember[i] ~= PL_ID_DUMMY then for j = 1, SP_NUM, 1 do if nowSupportMember[i] == newSupportMember[j] then outFlag[i] = false; inFlag[j] = false; end end else outFlag[i] = false; end end -- 抜ける演出 for i = 1, SP_NUM, 1 do if outFlag[i] then if (nowSupportMember[i] == PL_ID_2TND) then local list = { "f_sub09", "o_sub00", "friend02", "friend13", }; local disp = MobUtil_IsSubEventWakeCheckOtherEvent( id, list ); if disp then ccSetAdvMobFade( id, 0, 255, 30 ); ccSuspendScript(); -- 綱手に会話アイコン設定 ccAdvUiOpenTargetByMobId( id, CCD_UITARGETADVCOMMONID_TALK, "tnd_talkIcon", "tnd" ); MobUtil_SetMobDispByName( "tnd", true ); -- ◆サポートを消す前に非表示にしておく ccSetAdvSupportCharaDisp( nowSupportMember[i], false ); ccWaitAdvMob( id, 2 ); ccSuspendScript(); ccDeleteSupportChara( id, nowSupportMember[i] ); ccWaitAdvMob( id, 30 ); ccSuspendScript(); ccSetAdvMobFade( id, 255, 0, 30 ); ccSuspendScript(); else local pos = ccGetAdvSupportCharaPos( nowSupportMember[i] ); pos.z = pos.z + 60; ccAdvPlay3dSe( id, SMK_DISAPPEAR_SE_ID, pos.x, pos.y, pos.z ); ccCreateEffect(id, "data/effect/1efcmn\.xfbin", "1efc_smk03l", pos.x, pos.y, pos.z ); -- ◆サポートを消す前に非表示にしておく ccSetAdvSupportCharaDisp( nowSupportMember[i], false ); ccWaitAdvMob( id, 2 ); ccSuspendScript(); ccDeleteSupportChara( id, nowSupportMember[i] ); ccWaitAdvMob( id, 30 ); ccSuspendScript(); end else local pos = ccGetAdvSupportCharaPos( nowSupportMember[i] ); pos.z = pos.z + 60; ccAdvPlay3dSe( id, SMK_DISAPPEAR_SE_ID, pos.x, pos.y, pos.z ); ccCreateEffect(id, "data/effect/1efcmn\.xfbin", "1efc_smk03l", pos.x, pos.y, pos.z ); -- ◆サポートを消す前に非表示にしておく ccSetAdvSupportCharaDisp( nowSupportMember[i], false ); ccWaitAdvMob( id, 2 ); ccSuspendScript(); ccDeleteSupportChara( id, nowSupportMember[i] ); ccWaitAdvMob( id, 30 ); ccSuspendScript(); end for j = 1, SP_NUM, 1 do if usePos[j] == nowSupportMember[i] then usePos[j] = PL_ID_DUMMY; break; end end end end -- 追加演出 for i = 1, SP_NUM, 1 do if inFlag[i] and newSupportMember[i] ~= PL_ID_DUMMY then ccLoadAdvSupportChara( id, newSupportMember[i] ); ccSuspendScript(); -- 出現位置の設定 for j = 1, SP_NUM, 1 do if usePos[j] == PL_ID_DUMMY then -- 綱手の場合:火影の屋敷にいるならフェードで位置変え local isDisp = ccGetAdvMobDispByName( "tnd" ); if (newSupportMember[i] == PL_ID_2TND) and (isDisp) then ccSetAdvMobFade( id, 0, 255, 30 ); ccSuspendScript(); -- 綱手の会話アイコン削除 ccAdvUiCloseTargetByName( id, "tnd_talkIcon" ); ccAddSupportCharaAutoCharaType( id, newSupportMember[i], 0 ); ccSetAdvSupportLockOperate( newSupportMember[i], false ); MobUtil_SetMobDispByName( "tnd", false ); ccSetAdvSupportCharaPos( newSupportMember[i], appearPos[j][1], appearPos[j][2], appearPos[j][3] ); ccSetAdvSupportCharaRot( newSupportMember[i], appearRot[j][1], appearRot[j][2], appearRot[j][3] ); ccWaitAdvMob( id, 30 ); ccSuspendScript(); usePos[j] = newSupportMember[i]; ccSetAdvMobFade( id, 255, 0, 30 ); ccSuspendScript(); else ccAddSupportCharaAutoCharaType( id, newSupportMember[i], 0 ); ccSetAdvSupportLockOperate( newSupportMember[i], false ); ccAdvPlay3dSe( id, SMK_APPEAR_SE_ID, appearPos[j][1], appearPos[j][2], appearPos[j][3]+60 ); ccCreateEffect(id, "data/effect/1efcmn\.xfbin", "1efc_smk03l", appearPos[j][1], appearPos[j][2], appearPos[j][3]+60 ); ccSetAdvSupportCharaPos( newSupportMember[i], appearPos[j][1], appearPos[j][2], appearPos[j][3] ); ccSetAdvSupportCharaRot( newSupportMember[i], appearRot[j][1], appearRot[j][2], appearRot[j][3] ); ccWaitAdvMob( id, 6 ); ccSuspendScript(); usePos[j] = newSupportMember[i]; end break; end end end end ccWaitAdvMob( id, 30 ); ccSuspendScript(); return usePos; end ------------------------------------------------------------------ -- 会話前の基本処理 ------------------------------------------------------------------ function MobUtil_InitTalk( id ) -- プレイヤーロック ccSetAdvPlayerLockOperate( id, false ); ccSetAdvPlayerState( id, CCD_ADV_CHARA_STATE_WAIT ); -- サポートロック・非表示 ccSetAdvSupportLockOperateAll( false ); -- ccSetAdvSupportCharaDispAll( false ); -- 向かい合わせる ccTurnAdvPlayerToMob( id ); ccTurnAdvMobToPlayer( id ); ccSuspendScript(); end ------------------------------------------------------------------ -- 会話後の基本処理 ------------------------------------------------------------------ function MobUtil_FinalTalk( id ) -- プレイヤーロック解除 ccSetAdvPlayerLockOperate( id, true ); -- サポートロック解除・表示 ccSetAdvSupportLockOperateAll( true ); ccSetAdvSupportCharaDispAll( true ); end ------------------------------------------------------------------ -- モブの表示・コリジョン・イベントコリジョンををまとめて設定 ------------------------------------------------------------------ function MobUtil_SetMobDisp( id, flag ) ccSetAdvMobDisp( id, flag ); ccSetAdvMobCollision( id, flag ); ccSetAdvMobEventCollision( id, flag ); end function MobUtil_SetMobDispByName( name, flag ) ccSetAdvMobDispByName( name, flag ); ccSetAdvMobCollisionByName( name, flag ); ccSetAdvMobEventCollisionByName( name, flag ); end ------------------------------------------------------------------ -- 人形回収イベント 初期化 ------------------------------------------------------------------ function MobUtil_DollEventInit( id, charaId, dollName ) -- わら人形は非表示にしとく MobUtil_SetMobDispByName( dollName, false ); local disp = ccIsDollDraw( charaId ); if disp == false then ccSetAdvMobCollision( id, false ); ccSetAdvMobEventCollision( id, false ); ccSetAdvMobDisp( id, false ); end end ------------------------------------------------------------------ -- 人形回収イベント 汎用開始ベース ------------------------------------------------------------------ function MobUtil_DollEventStartBase( id, startMesId1, startMesId2, yesMesId, cancelMesId ) local selectId = 0; while true do ccSuspendScript(); -- プレイヤーロック ccSetAdvPlayerLockOperate( id, false ); ccSetAdvPlayerState( id, CCD_ADV_CHARA_STATE_WAIT ); ccSetAdvSupportLockOperateAll( false ); ccTurnAdvPlayerToMob( id ); ccTurnAdvMobToPlayer( id ); ccSuspendScript(); -- 開始時セリフ MobUtil_TalkMsgLeader( id, startMesId1 ); if (not (startMesId2 == nil)) then MobUtil_TalkMsgLeader( id, startMesId2 ); end -- 選択肢表示 ccAdvWindowSelectSetTitle( id, "s_sub00_009" ); -- 偽物を退治しますか? MobUtil_SelectYesNo( id ); -- はい・いいえ選択肢 ccAdvWindowSelectExecute( id ); -- 選択肢ウィンドウ表示 ccSuspendScript(); -- 選択肢入力待ち selectId = ccAdvWindowSelectGetCursorPos( id ); -- 選択肢の結果を取得 -- はい if selectId == 0 then MobUtil_TalkMsgLeader( id, yesMesId ); break; -- いいえ else MobUtil_TalkMsgLeader( id, cancelMesId ); end -- プレイヤーロック解除 ccSetAdvPlayerLockOperate( id, true ); ccSetAdvSupportLockOperateAll( true ); end end ------------------------------------------------------------------ -- 人形回収イベント 汎用開始系 ------------------------------------------------------------------ function MobUtil_DollEventStartType1( id ) MobUtil_DollEventStartBase( id, "s_sub00_007", nil, "s_sub00_011", "s_sub00_010" ); end function MobUtil_DollEventStartType2( id ) MobUtil_DollEventStartBase( id, "s_sub00_016", nil, "s_sub00_019", "s_sub00_018" ); end function MobUtil_DollEventStartType3( id ) MobUtil_DollEventStartBase( id, "s_sub00_024", nil, "s_sub00_028", "s_sub00_027" ); end function MobUtil_DollEventStartType4( id ) MobUtil_DollEventStartBase( id, "s_sub00_033", nil, "s_sub00_036", "s_sub00_035" ); end function MobUtil_DollEventStartType5( id ) MobUtil_DollEventStartBase( id, "s_sub00_041", "s_sub00_043", "s_sub00_047", "s_sub00_046" ); end function MobUtil_DollEventStartType6( id ) MobUtil_DollEventStartBase( id, "s_sub00_052", nil, "s_sub00_056", "s_sub00_055" ); end function MobUtil_DollEventStartType7( id ) MobUtil_DollEventStartBase( id, "s_sub00_061", "s_sub00_062", "s_sub00_066", "s_sub00_065" ); end function MobUtil_DollEventStartType8( id ) MobUtil_DollEventStartBase( id, "s_sub00_071", "s_sub00_072", "s_sub00_076", "s_sub00_075" ); end ------------------------------------------------------------------ -- 人形回収イベント 汎用終了系 ------------------------------------------------------------------ function MobUtil_DollEventEndMesType1( id ) MobUtil_TalkMsgLeader( id, "s_sub00_014" ); end function MobUtil_DollEventEndMesType2( id ) MobUtil_TalkMsgLeader( id, "s_sub00_022" ); end function MobUtil_DollEventEndMesType3( id ) MobUtil_TalkMsgLeader( id, "s_sub00_031" ); end function MobUtil_DollEventEndMesType4( id ) MobUtil_TalkMsgLeader( id, "s_sub00_039" ); end function MobUtil_DollEventEndMesType5( id ) MobUtil_TalkMsgLeader( id, "s_sub00_050" ); end function MobUtil_DollEventEndMesType6( id ) MobUtil_TalkMsgLeader( id, "s_sub00_059" ); end function MobUtil_DollEventEndMesType7( id ) MobUtil_TalkMsgLeader( id, "s_sub00_069" ); end function MobUtil_DollEventEndMesType8( id ) MobUtil_TalkMsgLeader( id, "s_sub00_080" ); end ------------------------------------------------------------------ -- 人形回収イベント ザコ戦闘後の人形取得部分のまとめ ------------------------------------------------------------------ function MobUtil_DollEventEnd( id, dollName, charaId ) ccSetAdvMobFade( id, 255, 255, 1 ); ccSuspendScript(); -- わら人形は非表示にしとく ccSetAdvMobDispByName( dollName, false ); ccSetAdvMobCollisionByName( dollName, false ); ccSetAdvMobEventCollisionByName( dollName, false ); ccSetAdvMobFade( id, 255, 0, 30 ); ccSuspendScript(); -- エフェクト表示 → キャラ非表示 → わら人形表示 local pos = ccGetAdvMobPosition( id ); ccSetAdvMobPosByName( dollName, pos.x, pos.y, pos.z ); pos.z = pos.z + 60; ccAdvPlay3dSe( id, S_disappear2, pos.x, pos.y, pos.z ); ccCreateEffect(id, "data/effect/1efcmn.xfbin", "1efc_smk03l", pos.x, pos.y, pos.z ); -- キャラ非表示に ccSetAdvMobCollision( id, false ); ccSetAdvMobEventCollision( id, false ); ccSetAdvMobDisp( id, false ); -- わら人形表示 ccSetAdvMobDispByName( dollName, true ); ccWaitAdvMob( id, 6 ); ccSuspendScript(); -- 人形に近付く pos = ccGetAdvMobPosition( id ); ccWalkAdvPlayer( id, pos.x, pos.y, pos.z ); ccWaitPlayerAct( id ); ccSuspendScript(); ccWaitAdvMob( id, 1 ); ccSuspendScript(); -- アイテム拾う ccSetAdvPlayerAnmByMotionName( id, "gim0" ); ccWaitAdvMob( id, 6 ); ccSuspendScript(); -- わら人形非表示 ccSetAdvMobDispByName( dollName, false ); ccWaitEndAnmPlayer( id ); ccSuspendScript(); ccSetAdvPlayerState( id, CCD_ADV_CHARA_STATE_WAIT ); -- アイテム取得 local itemId = "EVENT_ITEM21"; -- 呪いの人形 ccAddPossessItem( id, itemId, 1 ); ccAdvWindowItemAddItem( id, itemId, 1 ); ccAdvWindowItemExecute( id ); ccSuspendScript(); -- わら人形を取得しました メッセージ表示 -- MobUtil_SetTalkMsg( id, "s_sub00_013" ); -- ★人形回収フラグをセット ccGetDoll( charaId ); end ------------------------------------------------------------------ -- 人形回収イベント 大蛇丸のアジトでのザコ戦まとめ処理 ------------------------------------------------------------------ function MobUtil_DollEventBattle_2( id, mesType, battleParamId ) -- プレイヤーロック ccSetAdvPlayerLockOperate( id, false ); ccSetAdvPlayerState( id, CCD_ADV_CHARA_STATE_WAIT ); ccSetAdvSupportLockOperateAll( false ); -- 向かい合わせる ccTurnAdvPlayerToMob( id ); ccTurnAdvMobToPlayer( id ); ccSuspendScript(); -- mesType で開始メッセージと終了メッセージの分岐をする if mesType == 0 then MobUtil_TalkMsgMob( id, "s_sub00_304", "" ); -- 偽物 MobUtil_TalkMsgLeader( id, "s_sub00_305" ); MobUtil_TalkMsgLeader( id, "s_sub00_306" ); elseif mesType == 1 then MobUtil_TalkMsgLeader( id, "s_sub00_310" ); MobUtil_TalkMsgLeader( id, "s_sub00_311" ); elseif mesType == 2 then MobUtil_TalkMsgLeader( id, "s_sub00_315" ); MobUtil_TalkMsgLeader( id, "s_sub00_316" ); elseif mesType == 3 then MobUtil_TalkMsgLeader( id, "s_sub00_320" ); MobUtil_TalkMsgLeader( id, "s_sub00_321" ); end -- 簡易キャラセレ ccChangeAdvCharacterSeelct( id ); ccSuspendScript(); -- SE ccAdvPlaySe( id, S_ADV_battle ); -- 戦闘前演出 MobUtil_PrevBattleEffect( id ); -- 戦闘 ccChangeBattleById( battleParamId, 3 ); ccSuspendScript(); ccSetAdvMobFade( id, 255, 0, 30 ); ccSuspendScript(); -- SE -- エフェクト表示 → キャラ非表示 local pos = ccGetAdvMobPosition( id ); ccCreateEffect(id, "data/effect/1efcmn.xfbin", "1efc_smk03", pos.x, pos.y, pos.z ); ccSetAdvMobCollision( id, false ); ccSetAdvMobEventCollision( id, false ); ccSetAdvMobDisp( id, false ); if mesType == 0 then MobUtil_TalkMsgLeader( id, "s_sub00_308" ); elseif mesType == 1 then MobUtil_TalkMsgLeader( id, "s_sub00_313" ); elseif mesType == 2 then MobUtil_TalkMsgLeader( id, "s_sub00_318" ); elseif mesType == 3 then MobUtil_TalkMsgLeader( id, "s_sub00_323" ); end ccSetAdvPlayerLockOperate( id, true ); ccSetAdvSupportLockOperateAll( true ); end ------------------------------------------------------------------ -- 人形回収イベント 大蛇丸のアジトでのザコ戦後まとめ処理 -- sa09b_00 のバトル後 ------------------------------------------------------------------ function MobUtil_DollEvent_EndBattle1( id ) -- 配置している中忍のモーション設定 ccSetAdvMobAnmByName( "s_sub00_tnn_0", "data/rpg/xmenbod1.xfbin", "xmennut11" ); ccSetAdvMobAnmByName( "s_sub00_tnn_1", "data/rpg/xmenbod1.xfbin", "xmennut11" ); ccSetAdvMobAnmByName( "s_sub00_tnn_2", "data/rpg/xmenbod1.xfbin", "xmennut11" ); -- sa09b_00 に配置しているザコで、戦闘済みの奴は表示とイベントヒットを消す local flag = ccIsSubEventFlagOn( id, 0 ) if flag == true then MobUtil_SetMobDispByName( "s_sub00_6_0", false ); end flag = ccIsSubEventFlagOn( id, 1 ); if flag == true then MobUtil_SetMobDispByName( "s_sub00_6_1", false ); end end ------------------------------------------------------------------ -- 人形回収イベント 大蛇丸のアジトでのザコ戦後まとめ処理 -- sa09b_01 のバトル後 ------------------------------------------------------------------ function MobUtil_DollEvent_EndBattle2( id ) -- 配置している中忍のモーション設定 ccSetAdvMobAnmByName( "s_sub00_tnn_3", "data/rpg/xmenbod1.xfbin", "xmennut11" ); ccSetAdvMobAnmByName( "s_sub00_tnn_4", "data/rpg/xmenbod1.xfbin", "xmennut11" ); ccSetAdvMobAnmByName( "s_sub00_tnn_5", "data/rpg/xmenbod1.xfbin", "xmennut11" ); -- sa09b_00 に配置しているザコで、戦闘済みの奴は表示とイベントヒットを消す local flag = ccIsSubEventFlagOn( id, 2 ) if flag == true then MobUtil_SetMobDispByName( "s_sub00_6_2", false ); end flag = ccIsSubEventFlagOn( id, 3 ); if flag == true then MobUtil_SetMobDispByName( "s_sub00_6_3", false ); end end ------------------------------------------------------------------ -- 会話ウィンドウを開く ------------------------------------------------------------------ function MobUtil_OpenTalkWindow( id ) --ccAdvWindowTalkOpen( id ); --ccSuspendScript(); end ------------------------------------------------------------------ -- 会話ウィンドウを閉じる ------------------------------------------------------------------ function MobUtil_CloseTalkWindow( id ) --ccAdvWindowTalkClose( id ); --ccSuspendScript(); end ------------------------------------------------------------------ -- 会話メッセージを表示する(予め設定されたキャラの所に出す) ------------------------------------------------------------------ function MobUtil_SetTalkMsg( id, mesId ) ccAdvWindowTalkSetManualString( id, mesId ); ccSuspendScript(); end ------------------------------------------------------------------ -- 同時発言 一人目の発言時に使用 ------------------------------------------------------------------ function MobUtil_TalkMsgAutoNoClose( id, mesId, speaker ) local thisType = type(speaker); if speaker == nil then ccAdvWindowTalkSetSpeakerLeader( id ); -- リーダー elseif (type(speaker) == "number") then ccAdvWindowTalkSetSpeakerSupport( id, speaker ); -- サポート else ccAdvWindowTalkSetSpeaker( id, speaker ); -- モブ end ccAdvWindowTalkSetAutoStringNoClose( id, mesId ); ccSuspendScript(); end ------------------------------------------------------------------ -- かけあい発言 一人目の発言時に使用 ------------------------------------------------------------------ function MobUtil_TalkMsgManualNoClose( id, mesId, speaker ) if speaker == nil then ccAdvWindowTalkSetSpeakerLeader( id ); -- リーダー elseif (type(speaker) == "number") then ccAdvWindowTalkSetSpeakerSupport( id, speaker ); -- サポート else ccAdvWindowTalkSetSpeaker( id, speaker ); -- モブ end ccAdvWindowTalkSetManualStringNoClose( id, mesId ); ccSuspendScript(); end ------------------------------------------------------------------ -- システムメッセージを表示する ------------------------------------------------------------------ function MobUtil_SysMsg( id, mesId ) ccAdvWindowTalkExSetPosCenter( id ); ccAdvWindowTalkExSetString( id, mesId ); ccAdvWindowTalkExExecuteManual( id ); ccSuspendScript(); end ------------------------------------------------------------------ -- 会話メッセージを表示する(リーダー) ------------------------------------------------------------------ function MobUtil_TalkMsgLeader( id, mesId ) ccAdvWindowTalkSetManualStringSpeakerLeader( id, mesId ); ccSuspendScript(); end ------------------------------------------------------------------ -- 会話メッセージを表示する(サポートキャラ) ------------------------------------------------------------------ function MobUtil_TalkMsgSupport( id, mesId, charId ) ccAdvWindowTalkSetManualStringSpeakerSupport( id, mesId, charId ); ccSuspendScript(); end ------------------------------------------------------------------ -- 会話メッセージを表示する(固有ID指定) ------------------------------------------------------------------ function MobUtil_TalkMsgMob( id, mesId, mobId ) ccAdvWindowTalkSetManualStringSpeaker( id, mesId, mobId ); ccSuspendScript(); end ------------------------------------------------------------------ -- 会話処理 ------------------------------------------------------------------ function MobUtil_Talk( id ) -- ccSetAdvMobPrevState( id ); -- 現状の保存 ccSetAdvPlayerLockOperate( id, false ); -- プレイヤーロック ccSetAdvPlayerState( id, CCD_ADV_CHARA_STATE_WAIT ); -- プレイヤー状態を「待機」に ccSetAdvMobAnmById( id, CCD_ADV_MOB_MOTION_WALK ); -- モブモーションを「歩き」に ccTurnAdvMobToPlayer( id ); -- プレイヤーの方を向く ccTurnAdvPlayerToMob( id ); -- プレイヤーをモブの方を向かせる ccSuspendScript(); -- 会話 ccSetAdvMobAnmById( id, CCD_ADV_MOB_MOTION_SPEAK ); ccSetAdvMobAnmSpeed( id, 1.0 ); ccSetAdvManualString( id ); ccSuspendScript(); ccSetAdvPlayerLockOperate( id, true ); -- プレイヤーロックを解除 -- ccSetAdvMobStateFromPrevState( id ); -- モブ状態を話しかける前の状態に戻す ccSuspendScript(); end --function Talk