--****************************************************************************** --[[ @brief 000_NEXT_AC_AMAZEEG @author Kazushi Morita ]] --****************************************************************************** -- ▼本ミッション用定数 --<< 捕捉用 DIST_LADER = 1000; -- レーダー:距離 ANGLE_LADER = 180; -- レーダー:角度 DIST_OPTICAL = 1600; -- 視界: 距離 ANGLE_OPTICAL = 25; -- 視界: :角度 --<< 遠距離オペレーション用 DIST_PIVOT = 150; -- 遠距離/近距離の分水嶺 DIST_MARGIN = 50; -- KeepDistでPIVOTからどれだけ離れようとするか DIST_RANDOM_WALK_RANGE = 300; -- RandomWalkで動き回る範囲 TIME_RANDOM_WALK_PIVOT = 6; -- RandomWalkで一方向に動く時間 --<< 高度調整用 ALT_RELATIVE = 25; -- 相対高度 TIME_JUMP = 3; -- 飛行時間 TIME_WALK = 4; -- 地上時間 --<< 攻撃 DIST_ATK_LIMIT = 800; -- 攻撃限界距離 DIST_ATK_DECENT_MAX = 500; -- 適正距離限界 DIST_ATK_DECENT_MIN = 300; -- 適正距離最小 TIME_WAIT_LONG = 3; -- 待ち時間:長距離 TIME_WAIT_DECENT = 1; -- 待ち時間:適正距離 TIME_WAIT_SHORT = 1; -- 待ち時間:短距離 -- 依存ファイル 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"); --== 起動用フラグ 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; -- ▼ターゲッティング Targetting_CatchUpWithConeInSide( context, DIST_LADER , ANGLE_LADER ); --<< レーダー Targetting_CatchUpWithConeInSide( context, DIST_OPTICAL , ANGLE_OPTICAL ); --<< 視界 -- ▼ブースト頻度 SetEstimation_WalkDashRate( context , 0 , 1 ); --<< walk, dash 確率 SetEstimation_BoostEnableEnergyRange( context , 0 , 1 , 0.4 , 0.8 ); -- ▼行動開始用フラグ処理 if ( 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 --****************************************************************************** --[[ @brief test 攻撃 ]] --****************************************************************************** function InitAttack() -- end -- function Attack( context) -- ▼ローカル変数 local dist = GetToTargetDistance( context ); local rand = RandomRangeInt( 0 , 3 ); local avArmR = GetWeaponAvailability( context, WEAPON_ID__ARMWEP_R); local avBackR = GetWeaponAvailability( context, WEAPON_ID__BACK_R); local avArmL = GetWeaponAvailability( context, WEAPON_ID__ARMWEP_R); local avBackL = GetWeaponAvailability( context, WEAPON_ID__BACK_R); local idBestRWeapon = 0; if ( avArmR < avBackR ) then idBestRWeapon = WEAPON_ID__BACK_R; else idBestRWeapon = WEAPON_ID__ARMWEP_R; end local idBestLWeapon = 0; if ( avArmL < avBackL ) then idBestRWeapon = WEAPON_ID__BACK_L; else idBestRWeapon = WEAPON_ID__ARMWEP_L; end if ( DIST_ATK_LIMIT < dist ) then --<< 攻撃限界よりも遠くにいる Op_Nothing( context , OperationIdentifier( 9 ) , 2 , 2 , 1 , nil ); elseif ( DIST_ATK_DECENT_MAX < dist and dist < DIST_ATK_LIMIT ) then --<< 威嚇射撃(遠距離) Op_ShootRifle( context, OperationIdentifier( 10 ), idBestRWeapon, 2, 6, 0, true, true); Op_ShootRifle( context, OperationIdentifier( 11 ), idBestLWeapon, 2, 6, 0, true, true); elseif ( DIST_ATK_DECENT_MIN < dist and dist < DIST_ATK_DECENT_MAX ) then --<< 適正距離内 Op_ShootRifle( context, OperationIdentifier( 12 ), idBestRWeapon, 2, 6, 0, true, true); Op_ShootRifle( context, OperationIdentifier( 13 ), idBestLWeapon, 2, 6, 0, true, true); elseif ( dist < DIST_ATK_DECENT_MIN ) then --<< 焦る(短距離) Op_ShootRifle( context, OperationIdentifier( 14 ), idBestRWeapon, 2, 6, 0, true, true); Op_ShootRifle( context, OperationIdentifier( 15 ), idBestLWeapon, 2, 6, 0, true, true); end end