--****************************************************************************** --[[ @brief 000_NEXT_AC_AMAZEEG @author Kazushi Morita ]] --****************************************************************************** -- ▼本ミッション用定数 --<< 捕捉用 DIST_LADER = 1000; -- レーダー:距離 ANGLE_LADER = 180; -- レーダー:角度 DIST_OPTICAL = 1600; -- 視界: 距離 ANGLE_OPTICAL = 25; -- 視界: :角度 --<< 遠距離オペレーション用 DIST_PIVOT = 500; -- 遠距離/近距離の分水嶺 DIST_MARGIN = 100; -- KeepDistでPIVOTからどれだけ離れようとするか DIST_RANDOM_WALK_RANGE = 300; -- RandomWalkで動き回る範囲 TIME_RANDOM_WALK_PIVOT = 6; -- RandomWalkで一方向に動く時間 --<< 高度調整用 ALT_RELATIVE = 25; -- 相対高度 TIME_JUMP = 6; -- 飛行時間 TIME_WALK = 2; -- 地上時間 --<< 攻撃 DIST_ATK_LIMIT = 800; -- 攻撃限界距離 DIST_ATK_DECENT_MAX = 500; -- 適正距離限界 DIST_ATK_DECENT_MIN = 50; -- 適正距離最小 TIME_WAIT_LONG = 6; -- 待ち時間:長距離 TIME_WAIT_DECENT = 1; -- 待ち時間:適正距離 TIME_WAIT_SHORT = 3; -- 待ち時間:短距離 -- 依存ファイル dofile("game:\\common\\airesource\\script\\include\\include.lua"); dofile("game:\\common\\event\\include\\m000\\pointid.lua"); dofile("game:\\common\\event\\include\\m000\\entityid.lua"); -- スクリプト初期化 function InitialSetup( context) -- 最初のオペレーションレイヤーを作成する。 --== 移動 -- 最初のオペレーションレイヤーを作成する。 AddInitialLayer_EveryFrame( context, "InitMove", "Move"); --== 攻撃 -- 最初のオペレーションレイヤーを作成する。 AddInitialLayer_EveryFrame( context, "InitAttack", "Attack"); -- ▼ターゲッティング Targetting_CatchUpWithConeInSide( context, DIST_LADER , ANGLE_LADER ); --<< レーダー --== 起動用フラグ AddGlobalValue( context , "BOOT_FLAG" , 0 ); DefaultSetup( context , true ); end -- 初期化する。 RegistInitializeFuncitonName( "InitialSetup"); --///////////////////////////////////////////////////////////////////////////////////////////// --///////////////////////////////////////////////////////////////////////////////////////////// --///////////////////////////////////////////////////////////////////////////////////////////// --****************************************************************************** --[[ @brief 移動 ]] --****************************************************************************** function InitMove() debug_out("testメイン関数初期化。"); end function Move( context) -- ▼ローカル変数 local dist = GetToTargetDistance( context ); local alt = GetInitialAltitude( context ); local decent = ( DIST_ATK_DECENT_MAX + DIST_ATK_DECENT_MIN ) / 2; -- ▼ブースト頻度 SetEstimation_WalkDashRate( context , 0 , 1 ); --<< walk, dash 確率 SetEstimation_BoostEnableEnergyRange( context , 0 , 1 , 0.4 , 0.8 ); -- ▼行動開始用フラグ処理 if ( PlayerIsInRegion( context , m150_PT_BREAK ) or dist < DIST_PIVOT ) then ModifyGlobalValue( context , "BOOT_FLAG" , 1 ); end if ( GetGlobalValue( context , "BOOT_FLAG" ) == 1 ) then --<< 行動開始許可が出ていたら if ( dist > DIST_PIVOT ) then --<< 一定以上遠い時はその距離を保とうとする -- ▼高度調整 SetAdjustAltitudeBase( context , ADJUST_ALTITUDE_BASE__ABSOLUTE ); --<< 絶対高度を見る SetAltitudeParam( context , alt , alt ); -- ▼遠距離戦闘:大雑把に動く(移動距離が長い=オペレーション実行時間が長い) Op_KeepDist( context , OperationIdentifier( 1 ) , 8 , 12 , 1 , nil , DIST_PIVOT + DIST_MARGIN , 0 ); Op_RoundRear( context , OperationIdentifier( 2 ) , 8 , 12 , 1 , nil ); Op_RandomWalk( context , OperationIdentifier( 3 ) , 8 , 12 , 1 , nil , DIST_RANDOM_WALK_RANGE , TIME_RANDOM_WALK_PIVOT ); else --<< 距離を詰められると接近戦へ移行する -- ▼高度調整 alt = ALT_RELATIVE; SetAdjustAltitudeBase( context , ADJUST_ALTITUDE_BASE__TARGET_RELATIVE ); --<< 相対高度を見る SetAltitudeParam( context , alt , alt ); SetTimeLengthJump( context , TIME_JUMP , TIME_WALK ); -- ▼近距離戦闘 local rand = RandomRangeInt( -100 , 100 ); Op_MoveTargetRelation( context , OperationIdentifier( 4 ) , 2.5 , 4 , 0.5 , nil , decent + rand , 60 , 20 , 0 , false ); Op_MoveTargetRelation( context , OperationIdentifier( 5 ) , 2.5 , 4 , 0.5 , nil , decent + rand , -80 , 20 , 0 , false ); Op_MoveTargetRelation( context , OperationIdentifier( 6 ) , 2 , 4 , 0.5 , nil , decent + rand , 10 , 20 , 0 , false ); Op_MoveTargetRelation( context , OperationIdentifier( 7 ) , 2 , 4 , 0.5 , nil , decent + rand , -20 , 20 , 0 , false ); Op_Nothing ( context , OperationIdentifier( 8 ) , 1 , 1.5 , 1 , nil ); end else --<< まだ行動開始じゃない Op_Nothing( context , OperationIdentifier( 9 ) , 2 , 4 , 1 , nil ); Op_RandomWalk( context , OperationIdentifier( 10 ) , 2 , 4 , 1 , nil , 50 , 2 ); end end --[[ -- パラメータ取得 local ATK_OR_DEF = GetCommonParam( context, 0); -- 自分はどっち? 0:防衛 1:迎撃 local dist = GetToTargetDistance( context); local decent = ( DIST_ATTACK_MAX + DIST_ATTACK_MIN ) / 2 ; -- /////高度設定 local alt = GetInitialAltitude( context); -- /////ターゲット補足関数 Targetting_CatchUpWithConeInSide( context, 1000, 180); -- 1000m, 360 /レーダー Targetting_CatchUpWithConeInSide( context, 1800, 25); -- 1800m, 50 /視界 -- /////行動オペレーション if ( ATK_OR_DEF == 0 ) then -- 防衛の時 Op_RandomWalk( context, OperationIdentifier(17), 8, 10, 1, nil, 10, 0.5); -- ウロウロする Op_SubShoot( context, OperationIdentifier(18), 3, 6, 1, nil, 0, false, 1, 1); -- 何もしない else -- 迎撃のとき if ( dist > DIST_OPERATION ) then Op_SubShoot( context, OperationIdentifier(99), 3, 6, 1, nil, 0, false, 1, 1); -- 何もしない else if( IsExistTarget( context) ) then -- 自機を捉えた if( dist > DIST_DEF_LIMIT ) then -- 十分に遠い Op_SubShoot( context, OperationIdentifier(6), 3, 6, 1, nil, 0, false, 1, 1); -- 何もしない else -- /////高度調整 SetAdjustAltitudeBase( context, ADJUST_ALTITUDE_BASE__TARGET_RELATIVE); -- 絶対高度を見る SetAltitudeParam( context, alt, 25); -- 常に50m上をとる -- /////ブースト SetEstimation_WalkDashRate( context, 0, 1); -- walk, dash 確率 SetEstimation_BoostEnableEnergyRange( context, 0, 1, 0.4, 0.8); Op_MoveTargetRelation( context, OperationIdentifier(3), 2.5, 4, 1, nil, decent+100, 60, 30, 0, true); Op_MoveTargetRelation( context, OperationIdentifier(4), 2.5, 4, 1, nil, decent+50, -80, 30, 0, true); Op_MoveTargetRelation( context, OperationIdentifier(5), 2, 4, 1, nil, decent, 10, 30, 0, true); Op_MoveTargetRelation( context, OperationIdentifier(6), 2, 4, 1, nil, decent, -20, 30, 0, true); end else --LogAI(string.format("debug point 01")); Op_RandomWalk( context, OperationIdentifier(17), 8, 10, 1, nil, 30, 1.5); -- ウロウロする Op_SubShoot( context, OperationIdentifier(18), 3, 6, 1, nil, 0, false, 1, 1); -- 何もしない end end end end ]] --****************************************************************************** --[[ @brief test 攻撃 ]] --****************************************************************************** function InitAttack() -- end -- function Attack( context) -- ▼ローカル変数 local dist = GetToTargetDistance( context ); local rand = RandomRangeInt( 0 , 3 ); if ( DIST_ATK_LIMIT < dist ) then --<< 攻撃限界よりも遠くにいる Op_Nothing( context , OperationIdentifier( 8 ) , 2 , 2 , 1 , nil ); elseif ( DIST_ATK_DECENT_MAX < dist and dist < DIST_ATK_LIMIT ) then --<< 威嚇射撃(遠距離) Op_Shoot2( context , OperationIdentifier( 9 ) , 8 , 10 , 1 , nil , 100 , false , 0.3 , 0.3 , TIME_WAIT_LONG , TIME_WAIT_LONG + rand ); elseif ( DIST_ATK_DECENT_MIN < dist and dist < DIST_ATK_DECENT_MAX ) then --<< 適正距離内 Op_Shoot2( context , OperationIdentifier( 10 ) , 8 , 10 , 1 , nil , 100 , true , 0.3 , 0.3 , TIME_WAIT_DECENT , TIME_WAIT_DECENT + rand ); elseif ( dist < DIST_ATK_DECENT_MIN ) then --<< 焦る(短距離) Op_Shoot2( context , OperationIdentifier( 11 ) , 8 , 10 , 1 , nil , 100 , true , 0.3 , 0.3 , TIME_WAIT_SHORT , TIME_WAIT_SHORT + rand ); end end --[[ -- レーザーで適当に攻撃 local dist = GetToTargetDistance( context); if ( dist > DIST_OPERATION ) then Op_Shoot( context, OperationIdentifier(99), 3, 6, 1, nil, 0, false, 1, 1); -- 何もしない else 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_ATTACK_MIN) then -- 適正距離よりも短い。焦る Op_Shoot2( context, OperationIdentifier(2), 3, 4, 1, nil, 100, false, 0.5, 0.5, 1.0, 2.0); else -- 適正距離の中、狙い撃ち Op_Shoot2( context, OperationIdentifier(2), 6, 8, 1, nil, 100, true, 0.5, 0.5, 2.5, 3.0); end else Op_Shoot( context, OperationIdentifier(4), 3, 6, 1, nil, 0, false, 1.0, 1.0); -- 何もしない end end end ]]