--****************************************************************************** --[[ @brief 200_GYRO @author Yoshikazu KOIDE ]] --****************************************************************************** -- 依存ファイル dofile("game:\\common\\airesource\\script\\include\\include.lua"); dofile("game:\\common\\event\\include\\m200\\pointid.lua"); dofile("game:\\common\\event\\include\\m200\\entityid.lua"); -- 本ミッション用定数 DIST_LADER = 1500; -- レーダーの捕捉範囲 DIST_ATK = 700; -- この距離に入ったら航空攻撃開始 ALT_INIT = 150; -- 初期高度 -- 航空攻撃引数 RANGE_DES = 500 -- この距離で降下を始める RANGE_ATK = 300 -- この距離で攻撃を始める ANGLE_CATCH = 45 -- 捕捉角 ALT_ATK = 45 -- 攻撃時の相対高度 TIME_ATK = 1.0 -- 射撃実行時間 RATE_SHOOT = 50 -- メイン武器使用率 -- スクリプト初期化 function InitialSetup( context) -- 最初のオペレーションレイヤーを作成する。 --== 移動 -- 最初のオペレーションレイヤーを作成する。 AddInitialLayer_EveryFrame( context, "InitMove", "Move"); DefaultSetup( context, true); -- /////ターゲット補足関数 Targetting_CatchUpWithConeInSide( context, DIST_LADER, 180); -- 1600m, 180 end -- 初期化する。 RegistInitializeFuncitonName( "InitialSetup"); --///////////////////////////////////////////////////////////////////////////////////////////// --///////////////////////////////////////////////////////////////////////////////////////////// --///////////////////////////////////////////////////////////////////////////////////////////// --****************************************************************************** --[[ @brief 移動 ]] --****************************************************************************** function InitMove() debug_out("testメイン関数初期化。"); end function Move( context) local dist = GetToTargetDistance( context); local alt = GetInitialAltitude( context); -- とりあえず相対高度は見ない SetAdjustAltitudeBase( context, ADJUST_ALTITUDE_BASE__ABSOLUTE); SetAltitudeParam( context, alt, 0.0); Op_LoopQueue( context, OperationIdentifier(1), 300, 300, 1, nil, "TransporterLoopQueue_Construct", "TransporterLoopQueue_Update", nil, nil, "輸送ヘリ:ループキュー"); end -- /**** ループキュー構築 ****/ function TransporterLoopQueue_Construct( constructor) -- AIパラメータ取得 local DESTINATION = GetCommonParam( constructor, 0); -- 自分はどこを目指すのか(初期想定投下ポイント)=1〜5 -- ///// まずルート移動が入る敵 if ( DESTINATION == 3 ) then -- 第三部隊なら、側面ルート移動が入る Queue_FollowRoute( constructor, 300, 300, nil, nil, "EvalRoute3rd", m200_PT_HELI_ROUTE6, m200_PT_HELI_ROUTE8, true) elseif ( DESTINATION == 4 ) then -- 第四部隊なら、迂回ルート移動が入る Queue_FollowRoute( constructor, 300, 300, nil, nil, "EvalRoute4th", m200_PT_HELI_ROUTE1, m200_PT_HELI_ROUTE5, true) end -- ///// 目的地(投下ポイント)へ向かう -- if ( DESTINATION == 1 ) then -- Queue_MoveToMoveTarget( constructor, 10, 10, "OnMoveToDropPoint1", nil, "EvalDrop1", 100 ); -- elseif ( DESTINATION == 2 ) then -- Queue_MoveToMoveTarget( constructor, 10, 10, "OnMoveToDropPoint1", nil, "EvalDrop1", 100 ); -- 投下ポイントは第一部隊と同じ -- elseif ( DESTINATION == 3 ) then -- Queue_MoveToMoveTarget( constructor, 10, 10, "OnMoveToDropPoint2", nil, "EvalDrop2", 100 ); -- 投下ポイントは�A(上の方) -- elseif ( DESTINATION == 4 ) then -- Queue_MoveToMoveTarget( constructor, 10, 10, "OnMoveToDropPoint4", nil, "EvalDrop4", 100 ); -- elseif ( DESTINATION == 5 ) then -- Queue_MoveToMoveTarget( constructor, 10, 10, "OnMoveToDropPoint5", nil, "EvalDrop5", 100 ); -- else -- LogAI( string.format(" This Point is illegal.")); -- end if ( DESTINATION == 1 ) then Queue_MoveToPoint( constructor, 0, 0, nil, nil, "EvalDrop1" , m200_PT_DROP1); elseif ( DESTINATION == 2 ) then Queue_MoveToPoint( constructor, 0, 0, nil, nil, "EvalDrop1" , m200_PT_DROP1); -- 投下ポイントは第一部隊と同じ elseif ( DESTINATION == 3 ) then Queue_MoveToPoint( constructor, 0, 0, nil, nil, "EvalDrop2" , m200_PT_DROP2); -- 投下ポイントは�A(上の方) elseif ( DESTINATION == 4 ) then Queue_MoveToPoint( constructor, 0, 0, nil, nil, "EvalDrop4" , m200_PT_DROP4); elseif ( DESTINATION == 5 ) then Queue_MoveToPoint( constructor, 0, 0, nil, nil, "EvalDrop5" , m200_PT_DROP5); else LogAI( string.format(" This Point is illegal.")); end -- ///// 攻撃 Queue_Layer( constructor, 200, 200, nil, nil, "EvalAttack", "Attack", nil, "キュー:攻撃中"); --[[ ///// 敵に近づく Queue_KeepDist( constructor, 10, 10, nil, nil, "EvalKeepDist", DIST_ATK-100, 0 ); -- ///// 爆撃 Queue_DescentAttack( constructor, 999, 999, nil, nil, "EvalDescentAttack", RANGE_DES, RANGE_ATK, ANGLE_CATCH, ALT_ATK, TIME_ATK, RATE_SHOOT, true, true ); ]] end -- /**** ループキュー更新 ****/ function TransporterLoopQueue_Update() end -- //// ルート移動関連 function EvalRoute3rd( context) if( GetToPointDistance( context, m200_PT_HELI_ROUTE8) < 300 ) then context:Complete(); elseif( IsExistTarget( context) ) then if ( GetToTargetDistance( context) < DIST_ATK ) then context:Complete(); end end end function EvalRoute4th( context) if( GetToPointDistance( context, m200_PT_HELI_ROUTE5) < 300 ) then context:Complete(); elseif( IsExistTarget( context) ) then if ( GetToTargetDistance( context) < DIST_ATK ) then context:Complete(); end end end -- //// 目的地関連 function OnMoveToDropPoint1( context) SetTargetPositionByPointID( context, m200_PT_DROP1 ); end function OnMoveToDropPoint2( context) SetTargetPositionByPointID( context, m200_PT_DROP2 ); end function OnMoveToDropPoint3( context) SetTargetPositionByPointID( context, m200_PT_DROP3 ); end function OnMoveToDropPoint4( context) SetTargetPositionByPointID( context, m200_PT_DROP4 ); end function OnMoveToDropPoint5( context) SetTargetPositionByPointID( context, m200_PT_DROP5 ); end function OnMoveToSuicidePoint( context) SetTargetPositionByPointID( context, m200_PT_TRASH ); end function EvalDrop1( context) -- if( GetToPointDistance( context, m200_PT_DROP1) < 30 ) then if( GetToPointDistance( context, m200_PT_DROP1) < 300 ) then context:Complete(); elseif( IsExistTarget( context) ) then if( GetToTargetDistance( context) < DIST_ATK ) then context:Complete(); end end end function EvalDrop2( context) -- if( GetToPointDistance( context, m200_PT_DROP2) < 30 ) then if( GetToPointDistance( context, m200_PT_DROP2) < 300 ) then context:Complete(); elseif( IsExistTarget( context) ) then if( GetToTargetDistance( context) < DIST_ATK ) then context:Complete(); end end end function EvalDrop3( context) -- if( GetToPointDistance( context, m200_PT_DROP3) < 30 ) then if( GetToPointDistance( context, m200_PT_DROP3) < 300 ) then context:Complete(); elseif( IsExistTarget( context) ) then if( GetToTargetDistance( context) < DIST_ATK ) then context:Complete(); end end end function EvalDrop4( context) -- if( GetToPointDistance( context, m200_PT_DROP4) < 30 ) then if( GetToPointDistance( context, m200_PT_DROP4) < 300 ) then context:Complete(); elseif( IsExistTarget( context) ) then if( GetToTargetDistance( context) < DIST_ATK ) then context:Complete(); end end end function EvalDrop5( context) -- if( GetToPointDistance( context, m200_PT_DROP5) < 30 ) then if( GetToPointDistance( context, m200_PT_DROP5) < 300 ) then context:Complete(); elseif( IsExistTarget( context) ) then if( GetToTargetDistance( context) < DIST_ATK ) then context:Complete(); end end end -- ///// 攻撃関連 function EvalAttack( context) end function Attack( context) local dist = GetToTargetDistance( context); if( IsExistTarget( context) ) then if( dist > DIST_ATK ) then Op_KeepDist( context, OperationIdentifier(1), 2, 4, 1, nil, DIST_ATK - 100, 0); else Op_DescentAttack( context, OperationIdentifier(2), 12, 16, 1, nil, RANGE_DES, RANGE_ATK, ANGLE_CATCH, ALT_ATK, TIME_ATK, RATE_SHOOT, true, true ); end else -- ターゲットがいない Op_CircularMove( context, OperationIdentifier(3), 5, 10, 1, nil, 100, 200, 30, m200_PT_TERMINAL); end end -- ///// 近づく関連 function EvalKeepDist( context) if( GetToTargetDistance( context) < DIST_ATK ) then context:Complete(); end end -- ///// 爆撃関連 function EvalDescentAttack( context) -- if( true ) then -- end -- 何もしない。絶対に終わらない。 end