--****************************************************************************** --[[ @brief 250_ROSENTHAL @author Yoshikazu KOIDE ]] --****************************************************************************** -- 本ミッション用定数 DIST_LADER = 800; -- レーダー距離 DIST_OPTICAL = 1200; -- 視界 DIST_TARGET_LIMIT = 400; -- この距離より近くに他敵が入ってくるとそいつを優先的に狙う DIST_ATTACK_MAX = 400; DIST_BLADE = 50; -- ブレード使う距離 ALT_SURFACE = 5; -- 地表絶対高度 ALT_LIMIT = 50; -- 飛行時最大高度 -- ▼:【修正 2006/07/08 長谷川】エラーが出てたので、とりあえず、付け足した。 DIST_PILE = 80; -- パイルバンカー使う距離 -- 依存ファイル dofile("game:\\common\\airesource\\script\\include\\include.lua"); dofile("game:\\common\\Event\\include\\m250\\PointID.lua"); dofile("game:\\common\\Event\\include\\m250\\EntityID.lua"); -- スクリプト初期化 function InitialSetup( context) -- 最初のオペレーションレイヤーを作成する。 --== 移動 -- グローバル変数登録 AddGlobalValue( context, "arrival", 0); -- 最初のオペレーションレイヤーを作成する。 AddInitialLayer_EveryFrame( context, "InitMove", "Move"); --== 攻撃 -- 最初のオペレーションレイヤーを作成する。 AddInitialLayer_EveryFrame( context, "InitAttack", "Attack"); DefaultSetup( context, true); SetTimeLengthJump( context, 1, 0); end -- 初期化する。 RegistInitializeFuncitonName( "InitialSetup"); --///////////////////////////////////////////////////////////////////////////////////////////// --///////////////////////////////////////////////////////////////////////////////////////////// --///////////////////////////////////////////////////////////////////////////////////////////// --****************************************************************************** --[[ @brief 移動 ]] --****************************************************************************** function InitMove() debug_out("testメイン関数初期化。"); end function Move( context) -- local DESTINATION = GetMyDestination( context); -- 最近接のターゲットを取ってくる -- グローバル変数 local arrival_flag = GetGlobalValue( context, "arrival"); -- ローカル変数 local dist = GetToTargetDistance( context); local decent = ( DIST_ATTACK_MAX + DIST_PILE ) / 2 ; -- /////ターゲット補足関数 Targetting_CatchUpWithConeInSidePriority( context, DIST_LADER, 180, m200_ET_TRANSPORT, DIST_TARGET_LIMIT); -- 1000m, 360 /レーダー Targetting_CatchUpWithConeInSidePriority( context, DIST_OPTICAL, 25, m200_ET_TRANSPORT, DIST_TARGET_LIMIT); -- 1800m, 50 /視界 --if ( IsExistTarget( context) ) then -- /////高度調整 SetAdjustAltitudeBase( context, ADJUST_ALTITUDE_BASE__ABSOLUTE); -- 相対高度を見ない SetAltitudeParam( context, GetInitialAltitude( context ) , 25); -- 常に地平面をとる -- /////ブースト SetEstimation_WalkDashRate( context, 0, 1); -- walk, dash 確率 SetEstimation_BoostEnableEnergyRange( context, 0, 1, 0.4, 0.8); --[[ -- /////高度設定 local alt = ALT_SURFACE; -- //// 第一目的地到達判定 if( GetToPointDistance( context, DESTINATION) < 100 ) then arrival_flag = 1; -- 第一目的地には着いた ModifyGlobalValue( context, "arrival", arrival_flag); end if( arrival_flag == 1 ) then -- 投下ポイントには到着。その後 if ( IsExistTarget( context) ) then -- /////高度調整 SetAdjustAltitudeBase( context, ADJUST_ALTITUDE_BASE__ABSOLUTE); -- 相対高度を見ない SetAltitudeParam( context, alt, 25); -- 常に地平面をとる -- /////ブースト SetEstimation_WalkDashRate( context, 0, 1); -- walk, dash 確率 SetEstimation_BoostEnableEnergyRange( context, 0, 1, 0.4, 0.8); Op_MoveTargetRelation( context, OperationIdentifier(6), 2.5, 4, 1, nil, decent, 60, 30, 0, false); Op_MoveTargetRelation( context, OperationIdentifier(7), 2.5, 4, 1, nil, decent, -40, 30, 0, false); Op_FourthShoot( context, OperationIdentifier(8), 1.5, 2, 1, nil, 0, false,1.0, 0.5); -- 立ち止まる(振り向く) Op_KeepDist( context, OperationIdentifier(9), 1.5, 2.5, 1, nil, 30, 10); -- 急接近 else Op_MoveToPoint( context, OperationIdentifier(10), 2, 4, 1, nil, m200_PT_TERMINAL, 150); -- 誰も居なければ、とりあえずターミナル集合 end else -- まだ投下ポイントについていない。 第一目的地へ向かう Op_MoveToPoint( context, OperationIdentifier(11), 2, 4, 1, nil, DESTINATION, 100); -- 最近接目的へ end ]] end function GetMyDestination( context) -- 最近接の目的地IDを返す local destination = 0; destination = GetCommonParam( context, 0); local min_dist = math.min( GetToPointDistance( context, m200_PT_DROP1), GetToPointDistance( context, m200_PT_DROP2), GetToPointDistance( context, m200_PT_DROP3), GetToPointDistance( context, m200_PT_DROP4), GetToPointDistance( context, m200_PT_DROP5) ); -- 1〜5の投下ポイントで最も近いポイントまでの距離をとる if( GetToPointDistance( context, m200_PT_DROP1) == min_dist ) then destination = m200_PT_DROP1; elseif( GetToPointDistance( context, m200_PT_DROP2) == min_dist ) then destination = m200_PT_DROP2; elseif( GetToPointDistance( context, m200_PT_DROP3) == min_dist ) then destination = m200_PT_DROP3; elseif( GetToPointDistance( context, m200_PT_DROP4) == min_dist ) then destination = m200_PT_DROP4; elseif( GetToPointDistance( context, m200_PT_DROP5) == min_dist ) then destination = m200_PT_DROP5; else LogAI( " This Distance is Illegal."); destination = m200_PT_TERMINAL; end return destination; end function QuickSort( context) end --****************************************************************************** --[[ @brief test 攻撃 ]] --****************************************************************************** function InitAttack() -- end -- function Attack( context) -- 中距離アサルト/近づいたらブレード local dist = GetToTargetDistance( context); if( IsExistTarget( context) ) then -- 自機を捉えた if( dist > DIST_ATTACK_MAX ) then -- 適正距離よりも遠い ⇒ 何もしない Op_Shoot( context, OperationIdentifier(1), 3, 6, 1, nil, 0, false, 1.0, 2.0); elseif (dist > DIST_BLADE and DIST_ATTACK_MAX > dist) then -- 適正距離の中、狙い撃ち Op_Shoot2( context, OperationIdentifier(2), 6, 8, 1, nil, 100, true, 0.5, 0.5, 2.5, 3.0); else -- ブレード距離 Op_SubShoot2( context, OperationIdentifier(3), 3, 4, 1, nil, 100, false, 0.5, 0.5, 1.0, 2.0); end else Op_Shoot( context, OperationIdentifier(4), 3, 6, 1, nil, 0, false, 1.0, 1.0); -- 何もしない end end