Initial commit

This commit is contained in:
2026-02-28 14:00:45 -06:00
commit 16d3170787
1134 changed files with 589134 additions and 0 deletions

View File

@@ -0,0 +1,87 @@
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/AI/SpaceMode/AI_Plan_ExpansionGeneric_DefendSpaceStation.lua#1 $
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- (C) Petroglyph Games, Inc.
--
--
-- ***** ** * *
-- * ** * * *
-- * * * * *
-- * * * * * * * *
-- * * *** ****** * ** **** *** * * * ***** * ***
-- * ** * * * ** * ** ** * * * * ** ** ** *
-- *** ***** * * * * * * * * ** * * * *
-- * * * * * * * * * * * * * * *
-- * * * * * * * * * * ** * * * *
-- * ** * * ** * ** * * ** * * * *
-- ** **** ** * **** ***** * ** *** * *
-- * * *
-- * * *
-- * * *
-- * * * *
-- **** * *
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- C O N F I D E N T I A L S O U R C E C O D E -- D O N O T D I S T R I B U T E
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- $File: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/AI/SpaceMode/AI_Plan_ExpansionGeneric_DefendSpaceStation.lua $
--
-- Original Author: James Yarrow
--
-- $Author: Brian_Hayes $
--
-- $Change: 637819 $
--
-- $DateTime: 2017/03/22 10:16:16 $
--
-- $Revision: #1 $
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
require("pgevents")
function Definitions()
AllowEngagedUnits = true
IgnoreTarget = true
Category = "Defend_Space_Station"
TaskForce = {
{
"MainForce"
, "TaskForceRequired"
, "DenySpecialWeaponAttach"
}
}
end
function MainForce_Thread()
focus_fire_on_target = Find_Nearest(Target, "Frigate | Capital", PlayerObject, false)
while TestValid(focus_fire_on_target) do
-- Cancel all goals
Purge_Goals(PlayerObject)
Sleep(1)
-- Use all idle units, mapwide
MainForce.Collect_All_Free_Units()
while TestValid(focus_fire_on_target) do
MainForce.Collect_All_Free_Units()
BlockOnCommand(MainForce.Attack_Target(focus_fire_on_target), 5)
end
Sleep(1)
MainForce.Set_Plan_Result(true)
focus_fire_on_target = Find_Nearest(Target, "Frigate | Capital", PlayerObject, false)
end
end
function MainForce_Unit_Damaged(tf, unit, attacker, deliberate)
--Override self preservation behavior, just save the station!
end

View File

@@ -0,0 +1,64 @@
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- (c) Galyana's Ultimate Empire at War Modifications
--
-- ****** *** *** ************ *** ***
-- * * * * * * * *
-- * * * * * * *
-- * * * * * * *
-- * * * * * **** * * *
-- * * * ****** * * * *
-- * **** * * * * * * * *** *
-- * * * * * * * * * *
-- * * * * * * * * * *
-- * * * * * * * ** * * *
-- ****** ****** ************ **** ** *******
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- C O N F I D E N T I A L S O U R C E C O D E -- D O N O T D I S T R I B U T E
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- File: GUEaW/Data/Scripts/AI/SpaceMode/AI_Plan_ExpansionGeneric_SkirmishUpgradeSpaceStation.LUA
--
-- Original Editor: Giovanni Galyana
--
-- Final Edit By: Giovanni Galyana
--
-- Date: 4 June, 2019
--
-- Revisions: 3
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
require("pgevents")
function Definitions()
Category = "Skirmish_Upgrade_Space_Station"
IgnoreTarget = true
TaskForce = {
{
"ReserveForce"
,"RS_Level_Two_Starbase_Upgrade | RS_Level_Three_Starbase_Upgrade | RS_Level_Four_Starbase_Upgrade | RS_Level_Five_Starbase_Upgrade | RS_Level_Two_Drydock_Upgrade | RS_Level_Three_Drydock_Upgrade | RS_Level_Four_Drydock_Upgrade | RS_Level_Five_Drydock_Upgrade = 0,1"
,"ES_Level_Two_Starbase_Upgrade | ES_Level_Three_Starbase_Upgrade | ES_Level_Four_Starbase_Upgrade | ES_Level_Five_Starbase_Upgrade | ES_Flak_Defenses | ES_Level_Two_Drydock_Upgrade | ES_Level_Three_Drydock_Upgrade | ES_Level_Four_Drydock_Upgrade | ES_Level_Five_Drydock_Upgrade = 0,1"
,"US_Level_Two_Starbase_Upgrade | US_Level_Three_Starbase_Upgrade | US_Level_Four_Starbase_Upgrade | US_Level_Five_Starbase_Upgrade | US_Level_Two_Drydock_Upgrade | US_Level_Three_Drydock_Upgrade | US_Level_Four_Drydock_Upgrade | US_Level_Five_Drydock_Upgrade = 0,1"
,"HS_Level_Two_Starbase_Upgrade | HS_Level_Three_Starbase_Upgrade | HS_Level_Four_Starbase_Upgrade | HS_Level_Five_Starbase_Upgrade | HS_Level_Two_Drydock_Upgrade | HS_Level_Three_Drydock_Upgrade | HS_Level_Four_Drydock_Upgrade | HS_Level_Five_Drydock_Upgrade = 0,1"
,"RST_Level_Two_Starbase_Upgrade | RST_Level_Three_Starbase_Upgrade | RST_Level_Four_Starbase_Upgrade | RST_Level_Five_Starbase_Upgrade | RST_Level_Two_Drydock_Upgrade | RST_Level_Three_Drydock_Upgrade | RST_Level_Four_Drydock_Upgrade | RST_Level_Five_Drydock_Upgrade = 0,1"
,"EST_Level_Two_Starbase_Upgrade | EST_Level_Three_Starbase_Upgrade | EST_Level_Four_Starbase_Upgrade | EST_Level_Five_Starbase_Upgrade | EST_Flak_Defenses | EST_Level_Two_Drydock_Upgrade | EST_Level_Three_Drydock_Upgrade | EST_Level_Four_Drydock_Upgrade | EST_Level_Five_Drydock_Upgrade = 0,1"
,"UST_Level_Two_Starbase_Upgrade | UST_Level_Three_Starbase_Upgrade | UST_Level_Four_Starbase_Upgrade | UST_Level_Five_Starbase_Upgrade | UST_Level_Two_Drydock_Upgrade | UST_Level_Three_Drydock_Upgrade | UST_Level_Four_Drydock_Upgrade | UST_Level_Five_Drydock_Upgrade = 0,1"
,"HST_Level_Two_Starbase_Upgrade | HST_Level_Three_Starbase_Upgrade | HST_Level_Four_Starbase_Upgrade | HST_Level_Five_Starbase_Upgrade | HST_Level_Two_Drydock_Upgrade | HST_Level_Three_Drydock_Upgrade | HST_Level_Four_Drydock_Upgrade | HST_Level_Five_Drydock_Upgrade = 0,1"
}
}
RequiredCategories = {"Upgrade"}
AllowFreeStoreUnits = false
end
function ReserveForce_Thread()
BlockOnCommand(ReserveForce.Produce_Force())
ReserveForce.Set_Plan_Result(true)
ScriptExit()
end

View File

@@ -0,0 +1,118 @@
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/AI/SpaceMode/AreaSweep.lua#1 $
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- (C) Petroglyph Games, Inc.
--
--
-- ***** ** * *
-- * ** * * *
-- * * * * *
-- * * * * * * * *
-- * * *** ****** * ** **** *** * * * ***** * ***
-- * ** * * * ** * ** ** * * * * ** ** ** *
-- *** ***** * * * * * * * * ** * * * *
-- * * * * * * * * * * * * * * *
-- * * * * * * * * * * ** * * * *
-- * ** * * ** * ** * * ** * * * *
-- ** **** ** * **** ***** * ** *** * *
-- * * *
-- * * *
-- * * *
-- * * * *
-- **** * *
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- C O N F I D E N T I A L S O U R C E C O D E -- D O N O T D I S T R I B U T E
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- $File: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/AI/SpaceMode/AreaSweep.lua $
--
-- Original Author: James Yarrow
--
-- $Author: Brian_Hayes $
--
-- $Change: 637819 $
--
-- $DateTime: 2017/03/22 10:16:16 $
--
-- $Revision: #1 $
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
require("pgevents")
--
-- Space Mode Test Script
--
function Definitions()
DebugMessage("%s -- In Definitions", tostring(Script))
Category = "Sweep_Area"
MinContrastScale = 0.01
MaxContrastScale = 1.3
TaskForce = {
-- First Task Force
{
"MainForce"
,"Fighter | Corvette | Frigate | SpaceHero = 1, 10"
}
}
AllowEngagedUnits = false
kill_target = nil
DebugMessage("%s -- Done Definitions", tostring(Script))
end
function MainForce_Thread()
BlockOnCommand(MainForce.Produce_Force())
QuickReinforce(PlayerObject, AITarget, MainForce)
MainForce.Collect_All_Free_Units("Fighter | Corvette | Frigate")
SetClassPriorities(MainForce, "Attack_Move")
MainForce.Activate_Ability("Turbo", true)
MainForce.Activate_Ability("SPOILER_LOCK", true)
Try_Ability(MainForce, "STEALTH")
BlockOnCommand(MainForce.Attack_Move(AITarget))
MainForce.Activate_Ability("Turbo", false)
MainForce.Activate_Ability("SPOILER_LOCK", false)
-- Try to at least find something, since we bothered coming over here
-- There may be an enemy unit exposed, but the initial attack_move to the cell didn't find it.
MainForce.Set_As_Goal_System_Removable(false)
Target = Find_Nearest(MainForce, "Transport", PlayerObject, false)
if TestValid(Target) then
BlockOnCommand(MainForce.Attack_Move(Target))
else
Target = Find_Nearest(MainForce, "Fighter | Bomber | Corvette", PlayerObject, false)
if TestValid(Target) then
BlockOnCommand(MainForce.Attack_Move(Target))
else
Target = FindDeadlyEnemy(MainForce)
if TestValid(Target) then
BlockOnCommand(MainForce.Attack_Move(Target))
end
end
end
MainForce.Set_Plan_Result(true)
ScriptExit()
end
-- Make sure that units don't sit idle at the end of their move order, waiting for others
function MainForce_Unit_Move_Finished(tf, unit)
DebugMessage("%s -- %s reached end of move, giving new order", tostring(Script), tostring(unit))
-- Assist the tf with whatever is holding it up
kill_target = FindDeadlyEnemy(tf)
if TestValid(kill_target) then
unit.Attack_Move(kill_target)
else
unit.Attack_Move(tf)
end
end

View File

@@ -0,0 +1,194 @@
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/AI/SpaceMode/BombingRun.lua#1 $
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- (C) Petroglyph Games, Inc.
--
--
-- ***** ** * *
-- * ** * * *
-- * * * * *
-- * * * * * * * *
-- * * *** ****** * ** **** *** * * * ***** * ***
-- * ** * * * ** * ** ** * * * * ** ** ** *
-- *** ***** * * * * * * * * ** * * * *
-- * * * * * * * * * * * * * * *
-- * * * * * * * * * * ** * * * *
-- * ** * * ** * ** * * ** * * * *
-- ** **** ** * **** ***** * ** *** * *
-- * * *
-- * * *
-- * * *
-- * * * *
-- **** * *
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- C O N F I D E N T I A L S O U R C E C O D E -- D O N O T D I S T R I B U T E
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- $File: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/AI/SpaceMode/BombingRun.lua $
--
-- Original Author: Steve_Copeland
--
-- $Author: Brian_Hayes $
--
-- $Change: 637819 $
--
-- $DateTime: 2017/03/22 10:16:16 $
--
-- $Revision: #1 $
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
require("pgevents")
function Definitions()
AllowEngagedUnits = false
IgnoreTarget = true
Category = "Bomb_Unit"
TaskForce = {
{
"BomberForce"
,"Bomber = 3,10"
},
{
"FighterForce"
,"Fighter = 1,4"
}
}
direction_table = {
"back"
,"left"
,"right"
}
convenient_space_field_range = 2000
path_through = "ASTEROID | NEBULA" -- "ASTEROID | NEBULA | ION_FIELD"
time_to_drop_bombs = 2
bombers_reinforced = false
rallied = false
send_fighters = false
end
function BomberForce_Thread()
BlockOnCommand(BomberForce.Produce_Force())
BomberForce.Set_As_Goal_System_Removable(false)
QuickReinforce(PlayerObject, AITarget, BomberForce, FighterForce)
bombers_reinforced = true
-- Do some setup if the bombers arent' already too close
-- Also, don't bother with this setup if the tactical game is well underway
if (BomberForce.Get_Distance(AITarget) > 1000) and (EvaluatePerception("Game_Age", PlayerObject) < 360) then
BomberForce.Set_Targeting_Priorities("Bomber_Hit_And_Run", "Bomber")
send_fighters = true
BomberForce.Activate_Ability("SPOILER_LOCK", true)
-- Try to let the fighters get ahead of the bombers
while not Fighters_Closer_To_Target() and not Fighters_Engaged_Target() do
Obscure(BomberForce, 1000, true, "ASTEROID | NEBULA")
Sleep(1)
end
end
DebugMessage("bomber force target: %s", tostring(AITarget))
BlockOnCommand(BomberForce.Attack_Target(AITarget, BomberForce.Get_Self_Threat_Max()))
ScriptExit()
end
function Fighters_Closer_To_Target()
if BomberForce.Get_Force_Count == 0 or (not TestValid(FighterForce)) or FighterForce.Get_Force_Count == 0 then
return false
elseif FighterForce.Get_Distance(AITarget) < BomberForce.Get_Distance(AITarget) then
return true
end
end
function Fighters_Engaged_Target()
return TestValid(FighterForce) and (FindDeadlyEnemy(FighterForce) == AITarget)
end
-- Handle a hardpoint achieving range on the attack target
function BomberForce_Hardpoint_Target_In_Range(tf, unit, target)
BomberForce.Activate_Ability("SPOILER_LOCK", false)
-- Create a timer for this squadron to flee after it's had a chance to drop the rest of it's bombs
--Register_Timer(Repeat_Attack, time_to_drop_bombs, unit)
end
function Repeat_Attack(unit)
run_target = FindTarget(BomberForce, "Good_Space_Artillery_Area", "Tactical_Location", 0.8, 3000.0)
if run_target then
MessageBox("%s %.3f -- Bomber squad fleeing to %s.", tostring(Script), GetCurrentTime(), tostring(run_target))
GoKite(BomberForce, unit, run_target, false)
Sleep(4)
end
unit.Attack_Target(AITarget)
-- Once one attack is done, we'll let desirability drops end the plan
BomberForce.Set_As_Goal_System_Removable(true)
end
function FighterForce_Thread()
BlockOnCommand(FighterForce.Produce_Force())
QuickReinforce(PlayerObject, AITarget, FighterForce, BomberForce)
SetClassPriorities(FighterForce, "Attack_Move")
Try_Ability(FighterForce, "STEALTH")
if (EvaluatePerception("Game_Age", PlayerObject) < 360) then
while not bombers_reinforced do
reinforce_target = FindTarget(FighterForce, "Space_Area_Is_Hidden", "Tactical_Location", 0.8, 3000.0)
if reinforce_target then
BlockOnCommand(FighterForce.Move_To(reinforce_target), -1, Bombers_Have_Reinforced)
else
Sleep(1)
end
end
-- BlockOnCommand(FighterForce.Move_To(BomberForce, FighterForce.Get_Self_Threat_Max()))
rallied = true
while not send_fighters do
Escort(FighterForce, BomberForce)
end
end
BlockOnCommand(FighterForce.Attack_Target(AITarget))
end
function Bombers_Have_Reinforced()
return bombers_reinforced
end
--function Fighters_Have_Rallied()
-- return rallied
--end
function BomberForce_Original_Target_Destroyed()
DebugMessage("%s-- killed plan because original target destroyed", tostring(Script))
ScriptExit()
end
function FighterForce_Original_Target_Destroyed()
DebugMessage("%s-- killed plan because original target destroyed", tostring(Script))
ScriptExit()
end

View File

@@ -0,0 +1,100 @@
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- (c) Galyana's Ultimate Empire at War Modifications
--
-- ****** *** *** ************ *** ***
-- * * * * * * * *
-- * * * * * * *
-- * * * * * * *
-- * * * * * **** * * *
-- * * * ****** * * * *
-- * **** * * * * * * * *** *
-- * * * * * * * * * *
-- * * * * * * * * * *
-- * * * * * * * ** * * *
-- ****** ****** ************ **** ** *******
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- C O N F I D E N T I A L S O U R C E C O D E -- D O N O T D I S T R I B U T E
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- File: GUEaW/Data/Scripts/AI/SpaceMode/BuildRefinerySpace.LUA
--
-- Original Editor: Giovanni Galyana
--
-- Final Edit By: Giovanni Galyana
--
-- Date: 2 October, 2022
--
-- Revisions: 2
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
require("pgevents")
function Definitions()
Category = "Build_Refinery_Space"
IgnoreTarget = true
TaskForce = {
{
"MainForce"
,"UC_Empire_Mineral_Extractor | UC_Rebel_Mineral_Extractor_Armored | UC_Hutt_Mineral_Extractor | UC_Underworld_Mineral_Extractor | UC_Pirate_Mineral_Extractor = 1"
}
}
-- RequiredCategories = {"Structure"}
AllowFreeStoreUnits = false
good_pad = nil
pad = nil
refinery = nil
end
function MainForce_Thread()
-- Make sure we use a build pad that's not too near to the enemy base
nearby_pad_list = MainForce.Get_Reserved_Build_Pads()
for i, pad in pairs(nearby_pad_list) do
if EvaluatePerception("Distance_To_Nearest_Enemy_Starbase", PlayerObject, pad) > 2000 then
good_pad = pad
break
end
end
if good_pad then
faction_name = PlayerObject.Get_Faction_Name()
if faction_name == "EMPIRE" then
MainForce.Build("UC_Empire_Mineral_Extractor", good_pad)
elseif faction_name == "REBEL" then
MainForce.Build("UC_Rebel_Mineral_Extractor_Armored", good_pad)
elseif faction_name == "PIRATES" then
MainForce.Build("UC_Pirate_Mineral_Extractor", good_pad)
elseif faction_name == "HUTTS" then
MainForce.Build("UC_Hutt_Mineral_Extractor", good_pad)
elseif faction_name == "UNDERWORLD" then
MainForce.Build("UC_Underworld_Mineral_Extractor", good_pad)
else
MessageBox("unexpected faction name: %s", faction_name)
end
-- Make sure we track the results
MainForce.Set_As_Goal_System_Removable(false)
-- If it survives X seconds, consider it a successful plan
Sleep(30)
if TestValid(good_pad) then
refinery = good_pad.Get_Build_Pad_Contents()
if TestValid(refinery) then
MainForce.Set_Plan_Result(true)
end
end
else
-- This plan/target sucks. Pause for a moment, then release the allocated cash.
Sleep(5)
end
ScriptExit()
end

View File

@@ -0,0 +1,57 @@
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- (c) Galyana's Ultimate Empire at War Modifications
--
-- ****** *** *** ************ *** ***
-- * * * * * * * *
-- * * * * * * *
-- * * * * * * *
-- * * * * * **** * * *
-- * * * ****** * * * *
-- * **** * * * * * * * *** *
-- * * * * * * * * * *
-- * * * * * * * * * *
-- * * * * * * * ** * * *
-- ****** ****** ************ **** ** *******
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- C O N F I D E N T I A L S O U R C E C O D E -- D O N O T D I S T R I B U T E
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- File: GUEaW/Data/Scripts/AI/SpaceMode/BuildStructureSpace.LUA
--
-- Original Editor: Giovanni Galyana
--
-- Final Edit By: Giovanni Galyana
--
-- Date: 7 March, 2019
--
-- Revisions: 2
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
require("pgevents")
function Definitions()
Category = "Build_Structure_Space"
IgnoreTarget = true
TaskForce = {
{
"MainForce"
,"UC_Empire_Defense_Satellite_Laser | UC_Empire_Defense_Satellite_TurboLaser | UC_Empire_Defense_Satellite_Missile | UC_Empire_Defense_Satellite_Flak | UC_Empire_Defense_Satellite_Tractor | UC_Empire_Defense_Satellite_Interdictor = 0,1"
,"UC_Rebel_Defense_Satellite_Laser | UC_Rebel_Defense_Satellite_TurboLaser | UC_Rebel_Defense_Satellite_Missile | UC_Rebel_Defense_Satellite_Torpedo | UC_Rebel_Defense_Satellite_LRS | UC_Rebel_Defense_Satellite_Repair = 0,1"
,"UC_Underworld_Defense_Satellite_Laser | UC_Underworld_Defense_Satellite_Missile | UC_Underworld_Defense_Satellite_Plasma | UC_Underworld_Defense_Satellite_MassDriver | UC_Underworld_Defense_Satellite_DBM | UC_Underworld_Defense_Satellite_Sensor = 0,1"
,"UC_Hutt_Defense_Satellite_Laser | UC_Hutt_Defense_Satellite_Missile | UC_Hutt_Flak_Beam_Turret | UC_Hutt_Beam_Turret | UC_Hutt_Heavy_Beam_Turret | UC_Hutt_Defense_Satellite_Emitter = 0,1"
,"UC_Pirate_Defense_Satellite_Laser | UC_Pirate_Defense_Satellite_TurboLaser | UC_Pirate_Defense_Satellite_Missile = 0,1"
}
}
RequiredCategories = {"Structure"}
AllowFreeStoreUnits = false
end
function MainForce_Thread()
BlockOnCommand(MainForce.Build_All())
MainForce.Set_Plan_Result(true)
ScriptExit()
end

View File

@@ -0,0 +1,117 @@
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/AI/SpaceMode/BurnUnits.lua#1 $
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- (C) Petroglyph Games, Inc.
--
--
-- ***** ** * *
-- * ** * * *
-- * * * * *
-- * * * * * * * *
-- * * *** ****** * ** **** *** * * * ***** * ***
-- * ** * * * ** * ** ** * * * * ** ** ** *
-- *** ***** * * * * * * * * ** * * * *
-- * * * * * * * * * * * * * * *
-- * * * * * * * * * * ** * * * *
-- * ** * * ** * ** * * ** * * * *
-- ** **** ** * **** ***** * ** *** * *
-- * * *
-- * * *
-- * * *
-- * * * *
-- **** * *
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- C O N F I D E N T I A L S O U R C E C O D E -- D O N O T D I S T R I B U T E
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- $File: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/AI/SpaceMode/BurnUnits.lua $
--
-- Original Author: Steve_Copeland
--
-- $Author: Brian_Hayes $
--
-- $Change: 637819 $
--
-- $DateTime: 2017/03/22 10:16:16 $
--
-- $Revision: #1 $
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
require("pgevents")
function Definitions()
AllowEngagedUnits = true
IgnoreTarget = true
Category = "Burn_Units_Space"
TaskForce = {
{
"MainForce"
, "TaskForceRequired"
, "DenySpecialWeaponAttach"
}
}
end
function MainForce_Thread()
-- Cheat to wrap the game up if this is a firesale
if (EvaluatePerception("Should_Firesale_Space", PlayerObject) > 0) then
reveal_ai = FogOfWar.Reveal_All(PlayerObject)
MainForce.Set_As_Goal_System_Removable(false)
-- We're now also revealing FOW here for the human player (was previously handled by a hard-coded system)
-- Make sure that there isn't a scripted scenario underway that doesn't want automatic FOW reveals
if Is_Multiplayer_Mode() == false and ((EvaluatePerception("Is_Skirmish_Mode", PlayerObject) == 1) or
(GlobalValue.Get("Allow_AI_Controlled_Fog_Reveal") == 1)) then
reveal_human = FogOfWar.Reveal_All(Find_Player("local"))
end
end
-- Do this at least once (it may just be an attempt to burn off extra units, rather than a firesale)
repeat
-- Cancel all goals
Purge_Goals(PlayerObject)
Sleep(1)
-- Use all idle units, mapwide
MainForce.Collect_All_Free_Units()
target = Find_Nearest(MainForce, "Structure | Capital", PlayerObject, false)
if target == nil then
target = Find_Nearest(MainForce, PlayerObject, false)
end
while TestValid(target) do
DebugMessage("%s-- collecting all free units and attacking target:%s", tostring(Script), tostring(target))
MainForce.Collect_All_Free_Units()
BlockOnCommand(MainForce.Attack_Move(target), 20)
end
Sleep(5)
MainForce.Set_Plan_Result(true)
-- If this is a firesale condition, continue to burn off units
-- This must be done within the same plan because we don't want to destroy the
-- reveal objects turning FOW back on (which would result in the FOW being toggled repeatedly).
until (EvaluatePerception("Should_Firesale_Space", PlayerObject) == 0)
MainForce.Release_Forces(1.0)
Sleep(30)
end
-- Override default event to prevent plan from ending under firesale conditions
-- We want the fog of war reveal for the player to persist.
function MainForce_No_Units_Remaining()
end
function MainForce_Unit_Damaged(tf, unit, attacker, deliberate)
--Override self preservation behavior - the whole purpose of this plan is to kill or be killed
end

View File

@@ -0,0 +1,100 @@
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/AI/SpaceMode/DestroyUnit.lua#1 $
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- (C) Petroglyph Games, Inc.
--
--
-- ***** ** * *
-- * ** * * *
-- * * * * *
-- * * * * * * * *
-- * * *** ****** * ** **** *** * * * ***** * ***
-- * ** * * * ** * ** ** * * * * ** ** ** *
-- *** ***** * * * * * * * * ** * * * *
-- * * * * * * * * * * * * * * *
-- * * * * * * * * * * ** * * * *
-- * ** * * ** * ** * * ** * * * *
-- ** **** ** * **** ***** * ** *** * *
-- * * *
-- * * *
-- * * *
-- * * * *
-- **** * *
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- C O N F I D E N T I A L S O U R C E C O D E -- D O N O T D I S T R I B U T E
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- $File: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/AI/SpaceMode/DestroyUnit.lua $
--
-- Original Author: James Yarrow
--
-- $Author: Brian_Hayes $
--
-- $Change: 637819 $
--
-- $DateTime: 2017/03/22 10:16:16 $
--
-- $Revision: #1 $
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
require("pgevents")
function Definitions()
DebugMessage("%s -- In Definitions", tostring(Script))
AllowEngagedUnits = false
MinContrastScale = 1.1
MaxContrastScale = 3.0
Category = "Destroy_Unit"
TaskForce = {
{
"MainForce"
,"Fighter = 0, 2" -- don't take too many fighters because we allow engaged units
,"Fighter | Corvette | Frigate | Capital | Super | SpaceHero = 1, 20"
}
}
ChangedTarget = false
AttackingShields = false
DropCurrentTarget = false
kill_target = nil
DebugMessage("%s -- Done Definitions", tostring(Script))
end
function MainForce_Thread()
DebugMessage("%s -- In MainForce_Thread.", tostring(Script))
BlockOnCommand(MainForce.Produce_Force())
QuickReinforce(PlayerObject, AITarget, MainForce)
MainForce.Enable_Attack_Positioning(true)
DebugMessage("MainForce constructed at stage area!")
DebugMessage("%s -- Attack-moving to %s", tostring(Script), tostring (AITarget))
SetClassPriorities(MainForce, "Attack_Move")
BlockOnCommand(MainForce.Attack_Move(AITarget, MainForce.Get_Self_Threat_Max()))
MainForce.Set_Plan_Result(true)
DebugMessage("%s -- MainForce Done! Exiting Script!", tostring(Script))
ScriptExit()
end
-- Make sure that units don't sit idle at the end of their move order, waiting for others
function MainForce_Unit_Move_Finished(tf, unit)
DebugMessage("%s -- %s reached end of move, giving new order", tostring(Script), tostring(unit))
-- Assist the tf with whatever is holding it up
kill_target = FindDeadlyEnemy(tf)
if TestValid(kill_target) then
unit.Attack_Move(kill_target)
else
unit.Attack_Move(tf)
end
end

View File

@@ -0,0 +1,95 @@
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/AI/SpaceMode/DestroyUnitMinimal.lua#1 $
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- (C) Petroglyph Games, Inc.
--
--
-- ***** ** * *
-- * ** * * *
-- * * * * *
-- * * * * * * * *
-- * * *** ****** * ** **** *** * * * ***** * ***
-- * ** * * * ** * ** ** * * * * ** ** ** *
-- *** ***** * * * * * * * * ** * * * *
-- * * * * * * * * * * * * * * *
-- * * * * * * * * * * ** * * * *
-- * ** * * ** * ** * * ** * * * *
-- ** **** ** * **** ***** * ** *** * *
-- * * *
-- * * *
-- * * *
-- * * * *
-- **** * *
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- C O N F I D E N T I A L S O U R C E C O D E -- D O N O T D I S T R I B U T E
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- $File: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/AI/SpaceMode/DestroyUnitMinimal.lua $
--
-- Original Author: James Yarrow
--
-- $Author: Brian_Hayes $
--
-- $Change: 637819 $
--
-- $DateTime: 2017/03/22 10:16:16 $
--
-- $Revision: #1 $
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
require("pgevents")
function Definitions()
DebugMessage("%s -- In Definitions", tostring(Script))
AllowEngagedUnits = false
MinContrastScale = 0.0
MaxContrastScale = 1.3
Category = "Destroy_Unit_Minimal"
TaskForce = {
{
"MainForce"
,"Fighter | Corvette | Frigate | Capital | Super = 1, 20"
}
}
ChangedTarget = false
AttackingShields = false
DropCurrentTarget = false
DebugMessage("%s -- Done Definitions", tostring(Script))
end
function MainForce_Thread()
DebugMessage("%s -- In MainForce_Thread.", tostring(Script))
BlockOnCommand(MainForce.Produce_Force())
QuickReinforce(PlayerObject, AITarget, MainForce)
MainForce.Enable_Attack_Positioning(true)
DebugMessage("MainForce constructed at stage area!")
MainForce.Enable_Attack_Positioning(true)
DebugMessage("%s -- Attacking %s", tostring(Script), tostring (AITarget))
SetClassPriorities(MainForce, "Attack_Move")
BlockOnCommand(MainForce.Attack_Move(AITarget))
MainForce.Set_Plan_Result(true)
DebugMessage("%s -- MainForce Done! Exiting Script!", tostring(Script))
ScriptExit()
end
function MainForce_No_Units_Remaining()
DebugMessage("%s -- All units dead or non-buildable. Abandonning plan.", tostring(Script))
ScriptExit()
end
function MainForce_Target_Destroyed()
DebugMessage("%s -- Target destroyed! Exiting Script.", tostring(Script))
ScriptExit()
end

View File

@@ -0,0 +1,85 @@
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/AI/SpaceMode/EscortPlan.lua#1 $
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- (C) Petroglyph Games, Inc.
--
--
-- ***** ** * *
-- * ** * * *
-- * * * * *
-- * * * * * * * *
-- * * *** ****** * ** **** *** * * * ***** * ***
-- * ** * * * ** * ** ** * * * * ** ** ** *
-- *** ***** * * * * * * * * ** * * * *
-- * * * * * * * * * * * * * * *
-- * * * * * * * * * * ** * * * *
-- * ** * * ** * ** * * ** * * * *
-- ** **** ** * **** ***** * ** *** * *
-- * * *
-- * * *
-- * * *
-- * * * *
-- **** * *
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- C O N F I D E N T I A L S O U R C E C O D E -- D O N O T D I S T R I B U T E
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- $File: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/AI/SpaceMode/EscortPlan.lua $
--
-- Original Author: Brian Hayes
--
-- $Author: Brian_Hayes $
--
-- $Change: 637819 $
--
-- $DateTime: 2017/03/22 10:16:16 $
--
-- $Revision: #1 $
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
require("pgevents")
--
-- Space Mode Escort
--
function Definitions()
DebugMessage("%s -- In Definitions", tostring(Script))
AllowEngagedUnits = false
Category = "Space_Escort_Goal"
IgnoreTarget = true
TaskForce = {
-- First Task Force
{
"MainForce"
,"Fighter = 1,4"
,"Interdictor_Cruiser = 0,1"
}
}
end
function MainForce_Thread()
DebugMessage("%s -- In MainForce_Thread.", tostring(Script))
BlockOnCommand(MainForce.Produce_Force());
QuickReinforce(PlayerObject, AITarget, MainForce)
DebugMessage("MainForce constructed at stage area!")
Sleep(1)
DebugMessage("Taskforce %s (of var type: %s) following object %s.", tostring(MainForce), type(MainForce), tostring(Target))
--BlockOnCommand(MainForce.Follow_Target(AITarget))
-- Give an initial order to put the escorts in a state that the Escort function expects
MainForce.Guard_Target(AITarget)
while true do
Escort(MainForce, AITarget)
end
DebugMessage("%s -- MainForce Done! Exiting Script!", tostring(Script))
ScriptExit()
end

View File

@@ -0,0 +1,67 @@
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- (c) Galyana's Ultimate Empire at War Modifications
--
-- ****** *** *** ************ *** ***
-- * * * * * * * *
-- * * * * * * *
-- * * * * * * *
-- * * * * * **** * * *
-- * * * ****** * * * *
-- * **** * * * * * * * *** *
-- * * * * * * * * * *
-- * * * * * * * * * *
-- * * * * * * * ** * * *
-- ****** ****** ************ **** ** *******
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- C O N F I D E N T I A L S O U R C E C O D E -- D O N O T D I S T R I B U T E
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- File: GUEaW/Data/Scripts/AI/SpaceMode/FireDeathStar.LUA
--
-- Original Editor: Giovanni Galyana
--
-- Final Edit By: Giovanni Galyana
--
-- Date: 7 March, 2019
--
-- Revisions: 0
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
require("pgevents")
function Definitions()
DebugMessage("%s -- In Definitions", tostring(Script))
Category = "Fire_Death_Star"
IgnoreTarget = true
TaskForce =
{
{
"MainForce"
, "TaskForceRequired"
}
}
DebugMessage("%s -- Done Definitions", tostring(Script))
end
function MainForce_Thread()
BlockOnCommand(MainForce.Produce_Force())
ds = Find_First_Object("Death_Star_II")
while not TestValid(ds) do
-- Death star isn't present, hang this plan indefinately
Sleep(100)
end
repeat
Sleep(1)
until ds.Is_Tactical_Superweapon_Ready() and (Evaluate_In_Galactic_Context("Want_To_Fire_DS", PlayerObject) ~= 0)
ds.Fire_Tactical_Superweapon()
Sleep(30)
ScriptExit()
end

View File

@@ -0,0 +1,145 @@
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/AI/SpaceMode/FlankPlan.lua#1 $
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- (C) Petroglyph Games, Inc.
--
--
-- ***** ** * *
-- * ** * * *
-- * * * * *
-- * * * * * * * *
-- * * *** ****** * ** **** *** * * * ***** * ***
-- * ** * * * ** * ** ** * * * * ** ** ** *
-- *** ***** * * * * * * * * ** * * * *
-- * * * * * * * * * * * * * * *
-- * * * * * * * * * * ** * * * *
-- * ** * * ** * ** * * ** * * * *
-- ** **** ** * **** ***** * ** *** * *
-- * * *
-- * * *
-- * * *
-- * * * *
-- **** * *
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- C O N F I D E N T I A L S O U R C E C O D E -- D O N O T D I S T R I B U T E
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- $File: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/AI/SpaceMode/FlankPlan.lua $
--
-- Original Author: James Yarrow
--
-- $Author: Brian_Hayes $
--
-- $Change: 637819 $
--
-- $DateTime: 2017/03/22 10:16:16 $
--
-- $Revision: #1 $
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
require("pgevents")
function Definitions()
DebugMessage("%s -- In Definitions", tostring(Script))
AllowEngagedUnits = false
MinContrastScale = 0.75
Category = "Destroy_Unit"
TaskForce = {
{
"MainForce"
,"Corvette | Frigate | Capital | Super = 2,6"
},
{
"FlankForce"
,"Fighter = 1,4"
}
}
ExecuteFlank = true
flank_block = nil
flank_dist = 1000.0
DebugMessage("%s -- Done Definitions", tostring(Script))
end
function MainForce_Thread()
DebugMessage("%s -- In MainForce_Thread.", tostring(Script))
ExecuteFlank = false
BlockOnCommand(MainForce.Produce_Force());
QuickReinforce(PlayerObject, AITarget, MainForce, FlankForce)
DebugMessage("MainForce constructed at stage area!")
MainForce.Enable_Attack_Positioning(true)
SetClassPriorities(MainForce, "Attack_Move")
BlockOnCommand(MainForce.Attack_Move(AITarget, MainForce.Get_Self_Threat_Max()))
DebugMessage("%s -- MainForce Done! Exiting Script!", tostring(Script))
ScriptExit()
end
function FlankForce_Thread()
BlockOnCommand(FlankForce.Produce_Force())
QuickReinforce(PlayerObject, AITarget, FlankForce, MainForce)
-- Parameters = target, direction ("left", "right", "front", "back"), minimum distance from target, threat tolerance
flank_block = FlankForce.Prepare_Ambush(AITarget, "back", flank_dist, 500.0)
if not flank_block then
DebugMessage("Unable to reach BACK flank, trying right.")
flank_block = FlankForce.Prepare_Ambush(AITarget, "right", flank_dist, 500.0)
end
if not flank_block then
DebugMessage("Unable to reach RIGHT flank, trying right.")
flank_block = FlankForce.Prepare_Ambush(AITarget, "left", flank_dist, 500.0)
end
if not flank_block then
DebugMessage("Unable to reach a flank. Abandonning plan.")
ScriptExit()
end
-- Try to stay in position to perform the flank
while not ExecuteFlank do
if flank_block.IsFinished() then
if TestValid(AITarget) and FlankForce.Get_Distance(AITarget) < flank_dist then
DebugMessage("%s -- Attempting to stay out of range and safe.", tostring(Script))
FlankForce.Move_To(Project_By_Unit_Range(AITarget.Get_Game_Object(), FlankForce), FlankForce.Get_Self_Threat_Max())
end
end
Sleep(5)
end
BlockOnCommand(FlankForce.Attack_Target(AITarget))
FlankForce.Enable_Attack_Positioning(false)
ScriptExit()
end
function MainForce_No_Units_Remaining()
DebugMessage("%s -- All units dead or non-buildable. Abandonning plan.", tostring(Script))
ScriptExit()
end
function MainForce_Original_Target_Destroyed()
DebugMessage("%s -- Target destroyed! Exiting Script.", tostring(Script))
ScriptExit()
end
function MainForce_Target_In_Range()
ExecuteFlank = true
MainForce.Enable_Attack_Positioning(true)
end
function FlankForce_Target_In_Range()
FlankForce.Enable_Attack_Positioning(true)
end
function FlankForce_Original_Target_Destroyed()
ScriptExit()
end

View File

@@ -0,0 +1,79 @@
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- (c) Galyana's Ultimate Empire at War Modifications
--
-- ****** *** *** ************ *** ***
-- * * * * * * * *
-- * * * * * * *
-- * * * * * * *
-- * * * * * **** * * *
-- * * * ****** * * * *
-- * **** * * * * * * * *** *
-- * * * * * * * * * *
-- * * * * * * * * * *
-- * * * * * * * ** * * *
-- ****** ****** ************ **** ** *******
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- C O N F I D E N T I A L S O U R C E C O D E -- D O N O T D I S T R I B U T E
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- File: GUEaW/Data/Scripts/AI/SpaceMode/GroundToSpaceDamage.LUA
--
-- Original Editor: Giovanni Galyana
--
-- Final Edit By: Giovanni Galyana
--
-- Date: 9 July, 2020
--
-- Revisions: 3
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
require("pgevents")
function Definitions()
DebugMessage("%s -- In Definitions", tostring(Script))
Category = "Ground_To_Space_Damage"
IgnoreTarget = true
TaskForce =
{
{
"MainForce"
,"DenySpecialWeaponAttach"
,"DenyHeroAttach"
,"Ground_Empire_Hypervelocity_Gun | Skirmish_Hypervelocity_Gun | Ground_Hutts_Hypervelocity_Gun | Skirmish_Hyper_Beam_Gun | Skirmish_Plasma_Cannon = 1"
}
}
DebugMessage("%s -- Done Definitions", tostring(Script))
end
function MainForce_Thread()
BlockOnCommand(MainForce.Produce_Force())
-- Keep firing at the biggest (and probably slowest) enemy until it's dead
-- AITarget = FindTarget(MainForce, "Needs_Hypervelocity_Shot", "Enemy_Unit", 1.0)
-- DebugMessage("%s -- Found Target %s", tostring(Script), tostring(AITarget))
-- Try to fire each variety this weapon might be
MainForce.Fire_Special_Weapon("Ground_Empire_Hypervelocity_Gun", AITarget)
MainForce.Fire_Special_Weapon("Ground_Hutts_Hypervelocity_Gun", AITarget)
MainForce.Fire_Special_Weapon("Skirmish_Hypervelocity_Gun", AITarget)
MainForce.Fire_Special_Weapon("Skirmish_Hyper_Beam_Gun", AITarget)
MainForce.Fire_Special_Weapon("Skirmish_Plasma_Cannon", AITarget)
-- Rely on the Weapon Online event to fire the gun subsequent times
while TestValid(AITarget) do
Sleep(5)
end
ScriptExit()
end
function MainForce_Special_Weapon_Online(tf, special_weapon)
if TestValid(AITarget) then
special_weapon.Fire_Special_Weapon(AITarget, PlayerObject)
else
ScriptExit()
end
end

View File

@@ -0,0 +1,77 @@
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- (c) Galyana's Ultimate Empire at War Modifications
--
-- ****** *** *** ************ *** ***
-- * * * * * * * *
-- * * * * * * *
-- * * * * * * *
-- * * * * * **** * * *
-- * * * ****** * * * *
-- * **** * * * * * * * *** *
-- * * * * * * * * * *
-- * * * * * * * * * *
-- * * * * * * * ** * * *
-- ****** ****** ************ **** ** *******
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- C O N F I D E N T I A L S O U R C E C O D E -- D O N O T D I S T R I B U T E
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- File: GUEaW/Data/Scripts/AI/SpaceMode/GroundToSpaceDisable.LUA
--
-- Original Editor: Giovanni Galyana
--
-- Final Edit By: Giovanni Galyana
--
-- Date: 28 April, 2020
--
-- Revisions: 1
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- Self-attachment script for the Ion Cannon, but currently a custom goal is the best tactic
require("pgevents")
function Definitions()
DebugMessage("%s -- In Definitions", tostring(Script))
Category = "Ground_To_Space_Disable"
IgnoreTarget = true
TaskForce =
{
{
"MainForce"
,"DenySpecialWeaponAttach"
,"DenyHeroAttach"
,"Ground_Ion_Cannon | Skirmish_Ion_Cannon = 1"
}
}
DebugMessage("%s -- Done Definitions", tostring(Script))
end
function MainForce_Thread()
BlockOnCommand(MainForce.Produce_Force())
-- Keep firing at the bigger (and probably slowest) enemies
-- Add some variance, so that we can spread the effect around
-- AITarget = FindTarget(MainForce, "Needs_Ion_Shot", "Enemy_Unit", 0.8)
-- DebugMessage("%s -- Found Target %s", tostring(Script), tostring(AITarget))
-- Just fire once, because the effect isn't that useful to hit the same target in rapid succession
-- if TestValid(AITarget) then
MainForce.Fire_Special_Weapon("Ground_Ion_Cannon", AITarget) -- else
MainForce.Fire_Special_Weapon("Skirmish_Ion_Cannon", AITarget)
-- end
Sleep(5)
ScriptExit()
end
function MainForce_Special_Weapon_Online(tf, special_weapon)
if TestValid(AITarget) then
special_weapon.Fire_Special_Weapon(AITarget, PlayerObject)
else
ScriptExit()
end
end

View File

@@ -0,0 +1,119 @@
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- (c) Galyana's Ultimate Empire at War Modifications
--
-- ****** *** *** ************ *** ***
-- * * * * * * * *
-- * * * * * * *
-- * * * * * * *
-- * * * * * **** * * *
-- * * * ****** * * * *
-- * **** * * * * * * * *** *
-- * * * * * * * * * *
-- * * * * * * * * * *
-- * * * * * * * ** * * *
-- ****** ****** ************ **** ** *******
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- C O N F I D E N T I A L S O U R C E C O D E -- D O N O T D I S T R I B U T E
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- File: GUEaW/Data/Scripts/AI/SpaceMode/HideSurpriseUnits.LUA
--
-- Original Editor: Giovanni Galyana
--
-- Final Edit By: Giovanni Galyana
--
-- Date: 7 March, 2019
--
-- Revisions: 0
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
require("pgevents")
function Definitions()
AllowEngagedUnits = false
Category = "Hide_Surprise_Units"
IgnoreTarget = true
TaskForce =
{
{
"MainForce",
"Marauder_Missile_Cruiser | Broadside_Class_Cruiser | Ultor_Beam_Cruiser = 0,2",
"Bomber = 0,2"
},
{
"EscortForce",
"Fighter = 0,2"
}
}
-- Make sure we don't have an EscortForce only
RequiredCategories = {"Bomber | Corvette"}
end
function MainForce_Thread()
BlockOnCommand(MainForce.Produce_Force())
-- What easier way to keep units hidden than simply not bringing them to the map?
if MainForce.Are_All_Units_On_Free_Store() == false then
ScriptExit()
end
obscured = false
repeat
if obscured and not FindDeadlyEnemy(MainForce) then
Sleep(10)
MainForce.Set_Plan_Result(true)
else
Sleep(1)
end
Try_Ability(MainForce, "STEALTH")
BlockOnCommand(MainForce.Move_To(AITarget, 10))
obscured = Obscure(MainForce, 1500, true, "ASTEROID | NEBULA")
-- Try to find a nearby hiding spot, but look farther if none found
AITarget = FindTarget(MainForce, "Desire_To_Hide_At_Location", "Tactical_Location", 0.8, 1000)
if not AITarget then
AITarget = FindTarget(MainForce, "Desire_To_Hide_At_Location", "Tactical_Location", 0.8, 4000)
end
-- For some reason zeroed desirability isn't propagating to this plan and cancelling it, so use a failsafe
until (not AITarget)-- or (EvaluatePerception("Game_Age", PlayerObject) > 80)
ScriptExit()
end
-- Always run away from any attacker
function MainForce_Unit_Damaged(tf, unit, attacker, deliberate)
if TestValid(unit) and TestValid(attacker) then
GoKite(tf, unit, Project_By_Unit_Range(attacker, unit), false)
end
end
function EscortForce_Thread()
BlockOnCommand(EscortForce.Produce_Force())
-- Give an initial order to put the escorts in a state that the Escort function expects
EscortForce.Guard_Target(MainForce)
EscortAlive = true
while EscortAlive do
Escort(EscortForce, MainForce)
end
end
function MainForce_No_Units_Remaining()
DebugMessage("%s -- All units dead or non-buildable. Abandonning plan.", tostring(Script))
ScriptExit()
end
function EscortForce_No_Units_Remaining()
EscortAlive = false
end

View File

@@ -0,0 +1,100 @@
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/AI/SpaceMode/HideTransports.lua#1 $
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- (C) Petroglyph Games, Inc.
--
--
-- ***** ** * *
-- * ** * * *
-- * * * * *
-- * * * * * * * *
-- * * *** ****** * ** **** *** * * * ***** * ***
-- * ** * * * ** * ** ** * * * * ** ** ** *
-- *** ***** * * * * * * * * ** * * * *
-- * * * * * * * * * * * * * * *
-- * * * * * * * * * * ** * * * *
-- * ** * * ** * ** * * ** * * * *
-- ** **** ** * **** ***** * ** *** * *
-- * * *
-- * * *
-- * * *
-- * * * *
-- **** * *
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- C O N F I D E N T I A L S O U R C E C O D E -- D O N O T D I S T R I B U T E
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- $File: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/AI/SpaceMode/HideTransports.lua $
--
-- Original Author: James Yarrow
--
-- $Author: Brian_Hayes $
--
-- $Change: 637819 $
--
-- $DateTime: 2017/03/22 10:16:16 $
--
-- $Revision: #1 $
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
require("pgevents")
function Definitions()
AllowEngagedUnits = false
Category = "Hide_Transports"
IgnoreTarget = true
TaskForce =
{
{
"MainForce",
"Transport = 1,4"
},
{
"EscortForce",
"Fighter = 0,2"
}
}
end
function MainForce_Thread()
BlockOnCommand(MainForce.Produce_Force())
while true do
AITarget = FindTarget(MainForce, "Space_Area_Is_Hidden", "Tactical_Location", 0.8, 5000.0)
if TestValid(AITarget) then
Try_Ability(MainForce, "STEALTH")
MainForce.Attack_Target(AITarget, 1)
Sleep(10)
else
Sleep(0.1)
end
end
ScriptExit()
end
function EscortForce_Thread()
BlockOnCommand(EscortForce.Produce_Force())
-- Give an initial order to put the escorts in a state that the Escort function expects
EscortForce.Guard_Target(MainForce)
EscortAlive = true
while EscortAlive do
Escort(EscortForce, MainForce)
end
end
function MainForce_No_Units_Remaining()
DebugMessage("%s -- All units dead or non-buildable. Abandonning plan.", tostring(Script))
ScriptExit()
end
function EscortForce_No_Units_Remaining()
EscortAlive = false
end

View File

@@ -0,0 +1,71 @@
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/AI/SpaceMode/MoveToLocation.lua#1 $
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- (C) Petroglyph Games, Inc.
--
--
-- ***** ** * *
-- * ** * * *
-- * * * * *
-- * * * * * * * *
-- * * *** ****** * ** **** *** * * * ***** * ***
-- * ** * * * ** * ** ** * * * * ** ** ** *
-- *** ***** * * * * * * * * ** * * * *
-- * * * * * * * * * * * * * * *
-- * * * * * * * * * * ** * * * *
-- * ** * * ** * ** * * ** * * * *
-- ** **** ** * **** ***** * ** *** * *
-- * * *
-- * * *
-- * * *
-- * * * *
-- **** * *
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- C O N F I D E N T I A L S O U R C E C O D E -- D O N O T D I S T R I B U T E
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- $File: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/AI/SpaceMode/MoveToLocation.lua $
--
-- Original Author: Steve Copeland
--
-- $Author: Brian_Hayes $
--
-- $Change: 637819 $
--
-- $DateTime: 2017/03/22 10:16:16 $
--
-- $Revision: #1 $
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
require("pgevents")
function Definitions()
Category = "Return_To_Base | Patrol_Structure_Space"
IgnoreTarget = true
TaskForce =
{
{
"MainForce"
,"Fighter | Corvette | Frigate | Capital = 1, 5"
}
}
-- Needed for fighters to return to base, because they're frequently given anti-idle orders to attack nearest
AllowEngagedUnits = true
end
function MainForce_Thread()
BlockOnCommand(MainForce.Produce_Force())
-- Move the target to the desired location, with low tolerance threat avoidance.
Try_Ability(MainForce, "STEALTH")
BlockOnCommand(MainForce.Move_To(AITarget, 10))
MainForce.Guard_Target(AITarget)
MainForce.Set_Plan_Result(true)
Sleep(5)
end

View File

@@ -0,0 +1,166 @@
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/AI/SpaceMode/MoveToLocationRush.lua#1 $
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- (C) Petroglyph Games, Inc.
--
--
-- ***** ** * *
-- * ** * * *
-- * * * * *
-- * * * * * * * *
-- * * *** ****** * ** **** *** * * * ***** * ***
-- * ** * * * ** * ** ** * * * * ** ** ** *
-- *** ***** * * * * * * * * ** * * * *
-- * * * * * * * * * * * * * * *
-- * * * * * * * * * * ** * * * *
-- * ** * * ** * ** * * ** * * * *
-- ** **** ** * **** ***** * ** *** * *
-- * * *
-- * * *
-- * * *
-- * * * *
-- **** * *
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- C O N F I D E N T I A L S O U R C E C O D E -- D O N O T D I S T R I B U T E
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- $File: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/AI/SpaceMode/MoveToLocationRush.lua $
--
-- Original Author: Steve Copeland
--
-- $Author: Brian_Hayes $
--
-- $Change: 637819 $
--
-- $DateTime: 2017/03/22 10:16:16 $
--
-- $Revision: #1 $
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
require("pgevents")
function Definitions()
Category = "Secure_Build_Pad_Space"
IgnoreTarget = false
TaskForce =
{
{
"MainForce"
,"Fighter | Corvette = 1"
},
{
"EscortForce"
,"Fighter | Corvette | Frigate = 0,4"
,"EscortForce"
}
}
AllowEngagedUnits = false
wait_for_build_time = 30
end
function MainForce_Thread()
BlockOnCommand(MainForce.Produce_Force())
QuickReinforce(PlayerObject, AITarget, MainForce, EscortForce)
Try_Ability(MainForce, "Turbo")
Try_Ability(MainForce, "SPOILER_LOCK")
Try_Ability(MainForce, "STEALTH")
-- Move the target to the desired location, with low tolerance threat avoidance.
BlockOnCommand(MainForce.Move_To(AITarget, MainForce.Get_Self_Threat_Max()))
MainForce.Activate_Ability("SPOILER_LOCK", false)
if TestValid(Target) then
if (EvaluatePerception("Is_Build_Pad", PlayerObject, Target) == 1) then
-- Build pads may have an existing enemy structure than needs to be removed
-- Note that the enemy player can build structures late or rebuild destroyed structures, thus the need to repeat.
structure = Target.Get_Build_Pad_Contents()
if (structure == nil) or
(TestValid(structure) and PlayerObject.Get_Faction_Name() ~= structure.Get_Owner().Get_Faction_Name()) then
-- Attack any structure that might be there
if TestValid(structure) then
BlockOnCommand(MainForce.Attack_Target(AITarget))
end
--Wait for control to transition
BlockOnCommand(MainForce.Guard_Target(AITarget), 60, Target_Has_Structure)
--It's been a minute. If we still don't have control then give up
if Target.Get_Owner() ~= PlayerObject then
ScriptExit()
end
-- Guard the spot to give another plan the chance to can something here
-- Wait indefinately, if this is a refinery pad and we have no refineries.
if EvaluatePerception("Is_Refinery_Pad_Space", PlayerObject, Target) == 1 then
wait_for_build_time = -1
end
--MessageBox("%s, %s--Guarding for %d", tostring(Script), tostring(Target), wait_for_build_time)
-- Guard the spot until another plan can build something here
BlockOnCommand(MainForce.Guard_Target(AITarget), wait_for_build_time, Target_Has_Structure)
end
else
-- Stand guard so that we can retain usage of this structure
MainForce.Guard_Target(AITarget)
Sleep(10)
end
end
MainForce.Set_Plan_Result(true)
ScriptExit()
end
-- Does the plan's original Target have a friendlystructure on it?
function Target_Has_Structure()
if TestValid(Target) then
structure = Target.Get_Build_Pad_Contents()
return TestValid(structure)
end
return false
end
-- Override default handling, which will kill the plan
function MainForce_Original_Target_Owner_Changed(tf, old_player, new_player)
DebugMessage("%s -- Original target ownership changed.", tostring(Script))
end
function MainForce_Original_Target_Destroyed(tf)
ScriptExit()
end
function EscortForce_Thread()
BlockOnCommand(EscortForce.Produce_Force())
QuickReinforce(PlayerObject, AITarget, EscortForce, MainForce)
-- Give an initial order to put the escorts in a state that the Escort function expects
EscortForce.Guard_Target(MainForce)
EscortAlive = true
while EscortAlive do
Escort(EscortForce, MainForce)
end
end
function EscortForce_No_Units_Remaining()
EscortAlive = false
end
-- Override default handling, which will kill the plan
function EscortForce_Original_Target_Owner_Changed(tf, old_player, new_player)
DebugMessage("%s -- Original target ownership changed.", tostring(Script))
end

View File

@@ -0,0 +1,80 @@
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- (c) Galyana's Ultimate Empire at War Modifications
--
-- ****** *** *** ************ *** ***
-- * * * * * * * *
-- * * * * * * *
-- * * * * * * *
-- * * * * * **** * * *
-- * * * ****** * * * *
-- * **** * * * * * * * *** *
-- * * * * * * * * * *
-- * * * * * * * * * *
-- * * * * * * * ** * * *
-- ****** ****** ************ **** ** *******
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- C O N F I D E N T I A L S O U R C E C O D E -- D O N O T D I S T R I B U T E
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- File: GUEaW/Data/Scripts/AI/SpaceMode/PurchaseSpaceUpgradesGeneric.LUA
--
-- Original Editor: Giovanni Galyana
--
-- Final Edit By: Giovanni Galyana
--
-- Date: 28 October, 2023
--
-- Revisions: 5
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
require("pgevents")
function Definitions()
Category = "Purchase_Space_Upgrades_Generic"
IgnoreTarget = true
TaskForce = {
{
"ReserveForce"
,"DenySpecialWeaponAttach"
,"DenyHeroAttach"
,"RS_Improved_Weapons_L1_Upgrade | RS_Improved_Weapons_L2_Upgrade | RS_Improved_Weapons_L3_Upgrade | RS_Enhanced_Starbase_Shielding_L1_Upgrade | RS_Enhanced_Starbase_Shielding_L2_Upgrade | RS_Enhanced_Starbase_Shielding_L3_Upgrade | RS_Enhanced_Starbase_Shielding_L4_Upgrade | RS_Enhanced_Starbase_Shielding_L5_Upgrade | RS_Enhanced_Shielding_L1_Upgrade | RS_Enhanced_Shielding_L2_Upgrade | RS_Enhanced_Shielding_L3_Upgrade | RS_Enhanced_Shielding_L4_Upgrade | RS_Enhanced_Shielding_L5_Upgrade | RS_Reinforced_Armor_L1_Upgrade | RS_Reinforced_Armor_L2_Upgrade | RS_Reinforced_Armor_L3_Upgrade | RS_Increased_Supplies_L1_Upgrade | RS_Increased_Supplies_L2_Upgrade | RS_Increased_Supplies_L3_Upgrade | RS_Hardened_Mines_L1_Upgrade | RS_Hardened_Mines_L2_Upgrade | RS_Hardened_Mines_L3_Upgrade | RS_More_Garrisons_L1_Upgrade | RS_Ion_Cannon_Use_Upgrade = 0,2"
,"ES_Improved_Weapons_L1_Upgrade | ES_Improved_Weapons_L2_Upgrade | ES_Improved_Weapons_L3_Upgrade | ES_Improved_Weapons_L4_Upgrade | ES_Improved_Weapons_L5_Upgrade | ES_Improved_Defenses_L1_Upgrade | ES_Improved_Defenses_L2_Upgrade | ES_Improved_Defenses_L3_Upgrade | ES_Improved_Defenses_L4_Upgrade | ES_Improved_Defenses_L5_Upgrade | ES_Enhanced_Satellite_Defenses_L1_Upgrade | ES_Enhanced_Satellite_Defenses_L2_Upgrade | ES_Enhanced_Satellite_Defenses_L3_Upgrade | ES_Enhanced_Reactors_L1_Upgrade | ES_Enhanced_Reactors_L2_Upgrade | ES_Enhanced_Reactors_L3_Upgrade | ES_Reinforced_Armor_L1_Upgrade | ES_Reinforced_Armor_L2_Upgrade | ES_Reinforced_Armor_L3_Upgrade | ES_Increased_Supplies_L1_Upgrade | ES_Increased_Supplies_L2_Upgrade | ES_Increased_Supplies_L3_Upgrade | ES_Hypervelocity_Gun_Use_Upgrade = 0,2"
,"US_Carbonite_Coolant_Systems_L1_Upgrade | US_Carbonite_Coolant_Systems_L2_Upgrade | US_Carbonite_Coolant_Systems_L3_Upgrade | US_Targeting_Systems_L1_Upgrade | US_Targeting_Systems_L2_Upgrade | US_Targeting_Systems_L3_Upgrade | US_Reinforced_Structure_L1_Upgrade | US_Reinforced_Structure_L2_Upgrade | US_Reinforced_Structure_L3_Upgrade | US_Magnetically_Sealed_Armor_L1_Upgrade | US_Magnetically_Sealed_Armor_L2_Upgrade | US_Magnetically_Sealed_Armor_L3_Upgrade | US_Cloaking_Generator_L1_Upgrade | US_Cloaking_Generator_L2_Upgrade | US_Upgraded_Electronics_L1_Upgrade | US_Upgraded_Electronics_L2_Upgrade | US_Upgraded_Electronics_L3_Upgrade | US_Extort_Cash_L1_Upgrade | US_Extort_Cash_L2_Upgrade | US_Extort_Cash_L3_Upgrade | US_Extort_Cash_L4_Upgrade | US_Extort_Cash_L5_Upgrade | US_BlackMarket_Reactors_L1_Upgrade | US_BlackMarket_Reactors_L2_Upgrade | US_BlackMarket_Reactors_L3_Upgrade | US_BlackMarket_Reactors_L4_Upgrade | US_BlackMarket_Reactors_L5_Upgrade | US_Bounty_Upgrade | US_Plasma_Cannon_Use_Upgrade = 0,2"
,"HS_Enhanced_Starbase_Shielding_L1_Upgrade | HS_Enhanced_Starbase_Shielding_L2_Upgrade | HS_Reinforced_Structure_L1_Upgrade | HS_Reinforced_Structure_L2_Upgrade | HS_Targeting_Systems_L1_Upgrade | HS_Targeting_Systems_L2_Upgrade | HS_Enhanced_Reactors_L1_Upgrade | HS_Enhanced_Reactors_L2_Upgrade | HS_Enhanced_Reactors_L3_Upgrade | HS_Reinforced_Armor_L1_Upgrade | HS_Reinforced_Armor_L2_Upgrade | HS_Reinforced_Armor_L3_Upgrade | HS_Improved_Weapons_L1_Upgrade | HS_Improved_Weapons_L2_Upgrade | HS_Improved_Weapons_L3_Upgrade | HS_Improved_Defenses_L1_Upgrade | HS_Improved_Defenses_L2_Upgrade | HS_Enhanced_Shielding_L1_Upgrade | HS_Enhanced_Shielding_L2_Upgrade | HS_Enhanced_Shielding_L3_Upgrade | HS_Increased_Supplies_L1_Upgrade | HS_Increased_Supplies_L2_Upgrade | HS_Increased_Supplies_L3_Upgrade | HS_HyperBeam_Gun_Use_Upgrade = 0,2"
,"PS_Extort_Cash_L1_Upgrade | PS_Extort_Cash_L2_Upgrade | PS_Improved_Weapons_L1_Upgrade | PS_Improved_Weapons_L2_Upgrade | PS_Reinforced_Armor_L1_Upgrade | PS_Reinforced_Armor_L2_Upgrade | PS_Enhanced_Reactors_L1_Upgrade | PS_Enhanced_Reactors_L2_Upgrade | PS_Increased_Production_L1_Upgrade | PS_Increased_Production_L2_Upgrade = 0,2"
}
}
RequiredCategories = {"Upgrade"}
AllowFreeStoreUnits = false
end
function ReserveForce_Thread()
BlockOnCommand(ReserveForce.Produce_Force())
ReserveForce.Set_Plan_Result(true)
ReserveForce.Set_As_Goal_System_Removable(false)
-- Give some time to accumulate money.
tech_level = PlayerObject.Get_Tech_Level()
min_credits = 2000
if tech_level == 2 then
min_credits = 4000
elseif tech_level >= 3 then
min_credits = 6000
end
max_sleep_seconds = 120
current_sleep_seconds = 0
while (PlayerObject.Get_Credits() < min_credits) and (current_sleep_seconds < max_sleep_seconds) do
current_sleep_seconds = current_sleep_seconds + 1
Sleep(1)
end
ScriptExit()
end

View File

@@ -0,0 +1,80 @@
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/AI/SpaceMode/RetreatPlan.lua#1 $
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- (C) Petroglyph Games, Inc.
--
--
-- ***** ** * *
-- * ** * * *
-- * * * * *
-- * * * * * * * *
-- * * *** ****** * ** **** *** * * * ***** * ***
-- * ** * * * ** * ** ** * * * * ** ** ** *
-- *** ***** * * * * * * * * ** * * * *
-- * * * * * * * * * * * * * * *
-- * * * * * * * * * * ** * * * *
-- * ** * * ** * ** * * ** * * * *
-- ** **** ** * **** ***** * ** *** * *
-- * * *
-- * * *
-- * * *
-- * * * *
-- **** * *
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- C O N F I D E N T I A L S O U R C E C O D E -- D O N O T D I S T R I B U T E
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- $File: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/AI/SpaceMode/RetreatPlan.lua $
--
-- Original Author: James Yarrow
--
-- $Author: Brian_Hayes $
--
-- $Change: 637819 $
--
-- $DateTime: 2017/03/22 10:16:16 $
--
-- $Revision: #1 $
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
require("pgevents")
function Definitions()
DebugMessage("%s -- In Definitions", tostring(Script))
Category = "Space_Retreat | Land_Retreat"
TaskForce = {
{
"MainForce",
"TaskForceRequired"
}
}
DebugMessage("%s -- Done Definitions", tostring(Script))
end
function MainForce_Thread()
if not MainForce.Withdraw_Units() then
DebugMessage("%s -- unable to retreat", tostring(Script))
ScriptExit()
end
Purge_Goals(PlayerObject)
Try_Ability(MainForce, "STEALTH")
Try_Ability(MainForce, "FORCE_CLOAK")
MainForce.Block_Goal_Proposal()
MainForce.Collect_All_Free_Units()
MainForce.Set_As_Goal_System_Removable(false)
while true do
Sleep(1)
end
ScriptExit()
end

View File

@@ -0,0 +1,233 @@
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- (c) Galyana's Ultimate Empire at War Modifications
--
-- ****** *** *** ************ *** ***
-- * * * * * * * *
-- * * * * * * *
-- * * * * * * *
-- * * * * * **** * * *
-- * * * ****** * * * *
-- * **** * * * * * * * *** *
-- * * * * * * * * * *
-- * * * * * * * * * *
-- * * * * * * * ** * * *
-- ****** ****** ************ **** ** *******
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- C O N F I D E N T I A L S O U R C E C O D E -- D O N O T D I S T R I B U T E
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- File: GUEaW/Data/Scripts/AI/SpaceMode/SpaceArtillery.LUA
--
-- Original Editor: Giovanni Galyana
--
-- Final Edit By: Giovanni Galyana
--
-- Date: 7 March, 2019
--
-- Revisions: 0
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
require("pgevents")
function Definitions()
DebugMessage("%s -- In Definitions", tostring(Script))
AllowEngagedUnits = false
IgnoreTarget = true
Category = "Space_Artillery"
TaskForce = {
{
"MainForce"
,"Marauder_Missile_Cruiser | Broadside_Class_Cruiser | Ultor_Beam_Cruiser = 1,2"
},
{
"EscortForce"
,"Fighter = 0,2"
--,"EscortForce" -- Don't require the escort to have good contrast vs our target's neighbors
}
}
artillery_flee_range = 1000 -- This must be less than the artillery_attack_range for the plan to work
slack_range = 500
convenient_space_field_range = 800
path_through = "ASTEROID | NEBULA" -- "ASTEROID | NEBULA | ION_FIELD"
-- for memory pool cleanup
DebugMessage("%s -- Done Definitions", tostring(Script))
end
function MainForce_Thread()
tf = MainForce
-- Collect the task force and bring in any reinforcements to the current location
BlockOnCommand(tf.Produce_Force())
QuickReinforce(PlayerObject, AITarget, tf)
-- Set up proximities on each member of the main task force
for i, unit in (tf.Get_Unit_Table()) do
-- discover the range of the unit if we need to
if not artillery_attack_range then
artillery_attack_range = unit.Get_Type().Get_Max_Range()
DebugMessage("%s-- got artillery range %d", tostring(Script), artillery_attack_range)
enemy_player = unit.Get_Owner().Get_Enemy()
end
--Register_Prox(unit, Prox_Enemy_In_Range, artillery_attack_range - slack_range, enemy_player)
Register_Prox(unit, Prox_Enemy_In_Range, artillery_attack_range, enemy_player)
Register_Prox(unit, Prox_Enemy_Too_Close, artillery_flee_range, enemy_player)
end
-- Move to the plan's original attack location.
tf.Set_As_Goal_System_Removable(false)
good_loc = AITarget
SafeApproach(good_loc)
-- Make sure we're obscured, if a field is within a reasonable range
Obscure(tf, 1500, true, path_through)
-- Repeat as long as a good attack position exists.
while good_loc do
EvadeUntilSafe(tf, true)
-- Attack the nearest good target, but stop advancing if any enemies come in range
best_target = FindTarget(tf, "Unit_Needs_To_Be_Destroyed", "Enemy_Unit | Enemy_Structure", 1.0, artillery_attack_range + slack_range)
if TestValid(best_target) then
enemies_in_range = false
BlockOnCommand(tf.Attack_Target(best_target, 10, path_through), -1, Enemies_In_Range)
tf.Move_To(tf)
else
best_target = FindTarget(tf, "Unit_Needs_To_Be_Destroyed", "Enemy_Unit | Enemy_Structure", 1.0)
if TestValid(best_target) then
--MessageBox("%s--moving to target:%s", tostring(Script), tostring(best_target))
enemies_in_range = false
BlockOnCommand(tf.Attack_Target(best_target, 10, path_through), -1, Enemies_In_Range)
tf.Move_To(tf)
end
end
if EvaluatePerception("Good_Space_Artillery_Area", PlayerObject, good_loc) ~= 0 then
-- We're in a good place. Just continue to attack our last target until threatened.
if TestValid(best_target) then
enemies_near = false
BlockOnCommand(tf.Attack_Target(best_target, 10, path_through), -1, Threatened)
end
else
-- Find a new attack position because the current one has become useless
good_loc = FindTarget(tf, "Good_Space_Artillery_Area", "Tactical_Location", 0.7)
if good_loc then
SafeApproach(good_loc)
else
-- Apparently this plan now sucks. Hide the artillery and abort.
hiding_loc = FindTarget(MainForce, "Space_Area_Is_Hidden", "Tactical_Location", 1.0, 5000.0)
BlockOnCommand(tf.Move_To(hiding_loc, 10, path_through))
break
end
end
-- Yield to other systems, in case nothing else in this loop does.
Sleep(2)
end
-- Ensure that if this fails that the escort thread ends as well
ScriptExit()
end
--Reapproach if enemies are already within range, otherwise edge up to them.
function SafeApproach(loc)
if Enemies_In_Range() then
BlockOnCommand(tf.Move_To(good_loc, 10, path_through))
else
BlockOnCommand(tf.Move_To(good_loc, 10, path_through), -1, Enemies_In_Range)
end
end
--function Artillery_Behavior(tf)
--end
-- Keeps the task force running away from enemies.
-- Should land the task force in a good attack location.
-- Updates good_loc var and resets enemies_near to false.
function EvadeUntilSafe(tf, use_nebulae)
-- Evade as long as we have an enemy whose threat we're tracking and a nearby enemy
deadly_enemy = FindDeadlyEnemy(tf)
while deadly_enemy or enemies_near do
-- Run from any attacker.
if TestValid(deadly_enemy) then
BlockOnCommand(tf.Move_To(Project_By_Unit_Range(deadly_enemy, tf), 10, path_through))
end
-- Further measures if there's still an enemy close
if enemies_near then
--Hide.
good_loc = FindTarget(tf, "Good_Space_Artillery_Area", "Tactical_Location", 0.7)
if good_loc then
BlockOnCommand(tf.Move_To(good_loc, 10, path_through))
end
-- Make sure we're obscured, if convenient.
Obscure(tf, convenient_space_field_range, use_nebulae, path_through)
end
enemies_near = false
deadly_enemy = FindDeadlyEnemy(tf)
end
end
function Prox_Enemy_In_Range(self_obj, enemy_obj)
enemies_in_range = true
end
function Enemies_In_Range()
return enemies_in_range
end
function Prox_Enemy_Too_Close(self_obj, enemy_obj)
enemies_near = true
end
function Enemies_Are_Near()
return enemies_near
end
-- Something has come too close or attacked us
function Threatened()
return enemies_near or TestValid(FindDeadlyEnemy(tf))
end
function EscortForce_Thread()
BlockOnCommand(EscortForce.Produce_Force())
QuickReinforce(PlayerObject, AITarget, EscortForce, MainForce)
-- Give an initial order to put the escorts in a state that the Escort function expects
EscortForce.Guard_Target(MainForce)
-- Continuously follow and guard the main force
EscortAlive = true
while EscortAlive do
Escort(EscortForce, MainForce, true)
end
end

View File

@@ -0,0 +1,94 @@
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/AI/SpaceMode/SpaceScout.lua#1 $
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- (C) Petroglyph Games, Inc.
--
--
-- ***** ** * *
-- * ** * * *
-- * * * * *
-- * * * * * * * *
-- * * *** ****** * ** **** *** * * * ***** * ***
-- * ** * * * ** * ** ** * * * * ** ** ** *
-- *** ***** * * * * * * * * ** * * * *
-- * * * * * * * * * * * * * * *
-- * * * * * * * * * * ** * * * *
-- * ** * * ** * ** * * ** * * * *
-- ** **** ** * **** ***** * ** *** * *
-- * * *
-- * * *
-- * * *
-- * * * *
-- **** * *
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- C O N F I D E N T I A L S O U R C E C O D E -- D O N O T D I S T R I B U T E
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- $File: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/AI/SpaceMode/SpaceScout.lua $
--
-- Original Author: James Yarrow
--
-- $Author: Brian_Hayes $
--
-- $Change: 637819 $
--
-- $DateTime: 2017/03/22 10:16:16 $
--
-- $Revision: #1 $
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
require("pgevents")
function Definitions()
Category = "Space_Scout"
IgnoreTarget = true
TaskForce =
{
{
"MainForce",
"Fighter | Corvette = 1"
}
}
end
function MainForce_Thread()
BlockOnCommand(MainForce.Produce_Force())
MainForce.Set_As_Goal_System_Removable(false)
QuickReinforce(PlayerObject, AITarget, MainForce)
MainForce.Activate_Ability("Turbo", true)
MainForce.Activate_Ability("SPOILER_LOCK", true)
Try_Ability(MainForce, "STEALTH")
-- Removing this loop to give other plans a chance. If the AI still wants to scout, the plan will be proposed again.
-- while AITarget do
if TestValid(AITarget) then
BlockOnCommand(MainForce.Move_To(AITarget))
MainForce.Set_As_Goal_System_Removable(true)
BlockOnCommand(MainForce.Explore_Area(AITarget), 10)
MainForce.Set_Plan_Result(true)
else
DebugMessage("%s -- Unable to find a target for MainForce.", tostring(Script))
end
-- AITarget = FindTarget(MainForce, "Space_Area_Needs_Scouting", "Tactical_Location", 0.8, 3000.0)
-- end
ScriptExit()
end
function MainForce_No_Units_Remaining()
DebugMessage("%s -- All units dead or non-buildable. Abandonning plan.", tostring(Script))
ScriptExit()
end
function MainForce_Target_Destroyed()
DebugMessage("%s -- Target destroyed! Exiting Script.", tostring(Script))
ScriptExit()
end

View File

@@ -0,0 +1,108 @@
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/AI/SpaceMode/SystematicDisable.lua#1 $
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- (C) Petroglyph Games, Inc.
--
--
-- ***** ** * *
-- * ** * * *
-- * * * * *
-- * * * * * * * *
-- * * *** ****** * ** **** *** * * * ***** * ***
-- * ** * * * ** * ** ** * * * * ** ** ** *
-- *** ***** * * * * * * * * ** * * * *
-- * * * * * * * * * * * * * * *
-- * * * * * * * * * * ** * * * *
-- * ** * * ** * ** * * ** * * * *
-- ** **** ** * **** ***** * ** *** * *
-- * * *
-- * * *
-- * * *
-- * * * *
-- **** * *
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- C O N F I D E N T I A L S O U R C E C O D E -- D O N O T D I S T R I B U T E
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- $File: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/AI/SpaceMode/SystematicDisable.lua $
--
-- Original Author: James Yarrow
--
-- $Author: Brian_Hayes $
--
-- $Change: 637819 $
--
-- $DateTime: 2017/03/22 10:16:16 $
--
-- $Revision: #1 $
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
require("pgevents")
function Definitions()
DebugMessage("%s -- In Definitions", tostring(Script))
IgnoreTarget = true
Category = "AlwaysOff"
TaskForce = {
{
"MainForce"
,"Corvette | Frigate | Capital | Super = 2,6"
},
{
"EscortForce"
-- ,"EscortForce"
,"Fighter = 1,4"
}
}
AllowEngagedUnits = false
DebugMessage("%s -- Done Definitions", tostring(Script))
end
function MainForce_Thread()
BlockOnCommand(MainForce.Produce_Force())
QuickReinforce(PlayerObject, AITarget, MainForce, EscortForce)
BlockOnCommand(MainForce.Attack_Target(AITarget, "Shield_Generator", 500))
BlockOnCommand(MainForce.Attack_Target(AITarget, "Engine", 500))
MainForce.Enable_Attack_Positioning(false)
ScriptExit()
end
function EscortForce_Thread()
BlockOnCommand(EscortForce.Produce_Force())
QuickReinforce(PlayerObject, AITarget, EscortForce, MainForce)
BlockOnCommand(EscortForce.Guard_Target(MainForce))
while true do
Escort(EscortForce, MainForce)
end
end
function MainForce_No_Units_Remaining()
DebugMessage("%s -- All units dead or non-buildable. Abandonning plan.", tostring(Script))
ScriptExit()
end
function MainForce_Target_Destroyed()
DebugMessage("%s -- Target destroyed! Exiting Script.", tostring(Script))
ScriptExit()
end
function EscortForce_No_Units_Remaining()
DebugMessage("%s -- Escort wiped out. Bailing.", tostring(Script))
ScriptExit()
end

View File

@@ -0,0 +1,101 @@
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- (c) Galyana's Ultimate Empire at War Modifications
--
-- ****** *** *** ************ *** ***
-- * * * * * * * *
-- * * * * * * *
-- * * * * * * *
-- * * * * * **** * * *
-- * * * ****** * * * *
-- * **** * * * * * * * *** *
-- * * * * * * * * * *
-- * * * * * * * * * *
-- * * * * * * * ** * * *
-- ****** ****** ************ **** ** *******
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- C O N F I D E N T I A L S O U R C E C O D E -- D O N O T D I S T R I B U T E
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- File: GUEaW/Data/Scripts/AI/SpaceMode/TacticalMultiplayerBuildSpaceUnitsGeneric.LUA
--
-- Original Editor: Giovanni Galyana
--
-- Final Edit By: Giovanni Galyana
--
-- Date: 28 January, 2026
--
-- Revisions: 20
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- Replaced Unit Teams
-- Sykariius_Team_Space_MP | Nikomer_Team_Space_MP | Xizor_Team_Space_MP | Cuarson_Team_Space_MP | Pestelous_Team_Space_MP
-- Bossk_Team_Space_MP | IG88_Team_Space_MP
-- Han_Solo_Team_Space_MP | Red_Squadron
-- Boba_Fett_Team_Space_MP | Darth_Team_Space_MP
require("pgevents")
function Definitions()
Category = "Tactical_Multiplayer_Build_Space_Units_Generic"
IgnoreTarget = true
TaskForce = {
{
"ReserveForce"
,"RS_Level_Two_Starbase_Upgrade | RS_Level_Three_Starbase_Upgrade | RS_Level_Four_Starbase_Upgrade | RS_Level_Five_Starbase_Upgrade | RS_Level_Two_Drydock_Upgrade | RS_Level_Three_Drydock_Upgrade | RS_Level_Four_Drydock_Upgrade | RS_Level_Five_Drydock_Upgrade = 0,1"
,"ES_Level_Two_Starbase_Upgrade | ES_Level_Three_Starbase_Upgrade | ES_Level_Four_Starbase_Upgrade | ES_Level_Five_Starbase_Upgrade | ES_Flak_Defenses | ES_Level_Two_Drydock_Upgrade | ES_Level_Three_Drydock_Upgrade | ES_Level_Four_Drydock_Upgrade | ES_Level_Five_Drydock_Upgrade = 0,1"
,"US_Level_Two_Starbase_Upgrade | US_Level_Three_Starbase_Upgrade | US_Level_Four_Starbase_Upgrade | US_Level_Five_Starbase_Upgrade | US_Level_Two_Drydock_Upgrade | US_Level_Three_Drydock_Upgrade | US_Level_Four_Drydock_Upgrade | US_Level_Five_Drydock_Upgrade = 0,1"
,"HS_Level_Two_Starbase_Upgrade | HS_Level_Three_Starbase_Upgrade | HS_Level_Four_Starbase_Upgrade | HS_Level_Five_Starbase_Upgrade | HS_Level_Two_Drydock_Upgrade | HS_Level_Three_Drydock_Upgrade | HS_Level_Four_Drydock_Upgrade | HS_Level_Five_Drydock_Upgrade = 0,1"
,"RST_Level_Two_Starbase_Upgrade | RST_Level_Three_Starbase_Upgrade | RST_Level_Four_Starbase_Upgrade | RST_Level_Five_Starbase_Upgrade | RST_Level_Two_Drydock_Upgrade | RST_Level_Three_Drydock_Upgrade | RST_Level_Four_Drydock_Upgrade | RST_Level_Five_Drydock_Upgrade = 0,1"
,"EST_Level_Two_Starbase_Upgrade | EST_Level_Three_Starbase_Upgrade | EST_Level_Four_Starbase_Upgrade | EST_Level_Five_Starbase_Upgrade | EST_Flak_Defenses | EST_Level_Two_Drydock_Upgrade | EST_Level_Three_Drydock_Upgrade | EST_Level_Four_Drydock_Upgrade | EST_Level_Five_Drydock_Upgrade = 0,1"
,"UST_Level_Two_Starbase_Upgrade | UST_Level_Three_Starbase_Upgrade | UST_Level_Four_Starbase_Upgrade | UST_Level_Five_Starbase_Upgrade | UST_Level_Two_Drydock_Upgrade | UST_Level_Three_Drydock_Upgrade | UST_Level_Four_Drydock_Upgrade | UST_Level_Five_Drydock_Upgrade = 0,1"
,"HST_Level_Two_Starbase_Upgrade | HST_Level_Three_Starbase_Upgrade | HST_Level_Four_Starbase_Upgrade | HST_Level_Five_Starbase_Upgrade | HST_Level_Two_Drydock_Upgrade | HST_Level_Three_Drydock_Upgrade | HST_Level_Four_Drydock_Upgrade | HST_Level_Five_Drydock_Upgrade = 0,1"
,"PS_Level_Two_Starbase_Upgrade = 0,1"
,"Rebel_Pirate_Fighter_Squadron | Rebel_Cobra_Squadron | Rebel_Prowler-A_Squadron | Rebel_Pirate_IPV | Rebel_Vonosmas_Corvette | Rebel_Pirate_Frigate | Rebel_Guardian_Star_Defender | Rebel_Hammer_SA | Rebel_Providence_SA | Rebel_Zylon_Destroyer | Rebel_Mandator_SSD = 0,2"
,"Empire_Pirate_Fighter_Squadron | Empire_Cobra_Squadron | Empire_Prowler-A_Squadron | Empire_Pirate_IPV | Empire_Vonosmas_Corvette | Empire_Pirate_Frigate | Empire_Guardian_Star_Defender | Empire_Hammer_SA | Empire_Providence_SA | Empire_Zylon_Destroyer | Empire_Mandator_SSD = 0,2"
,"Underworld_Pirate_Fighter_Squadron | Underworld_Cobra_Squadron | Underworld_Prowler-A_Squadron | Underworld_Pirate_IPV | Underworld_Vonosmas_Corvette | Underworld_Guardian_Star_Defender | Underworld_Hammer_SA | Underworld_Providence_SA | Underworld_Zylon_Destroyer | Underworld_Mandator_SSD = 0,2"
,"Hutt_Cobra_Squadron | Hutt_Prowler-A_Squadron | Hutt_Vonosmas_Corvette | Hutt_Guardian_Star_Defender | Hutt_Hammer_SA | Hutt_Providence_SA | Hutt_Zylon_Destroyer | Hutt_Mandator_SSD = 0,2"
,"Z95_Headhunter_Rebel_Squadron | Rebel_X-Wing_Squadron | UEAW_EWing_Squadron | Y-Wing_Squadron | A_Wing_Squadron | B-Wing_Squadron | Corellian_Corvette | Corellian_Gunboat | Venator_Cruiser | Marauder_Missile_Cruiser | Nebulon_B_Frigate | Nebulon_B2_Frigate | Alliance_Assault_Frigate | MC30_Frigate | Nebulon_C_Frigate | UEAW_Nebula_SD | MC80_LibertyType | MC80_HomeOneType | MC99_Star_Dreadnaught | Viscount_Calamari_Cruiser = 0,3"
,"Tie_Fighter_Squadron | TIE_Scout_Squadron | Tie_Bomber_Squadron | UEAW_TIE_Advanced_Squadron | UEAW_Tie_Droid_Squadron | UEAW_Assault_Gunboat_Squadron | TIE_Defender_Squadron | TIE_Interceptor_Squadron | TIE_Bomb_Squadron | TIE_Phantom_Squadron | Tartan_Patrol_Cruiser | Dreadnaught_Heavy_Cruiser | Broadside_Class_Cruiser | Acclamator_Assault_Ship | Acclamator_Assault_Ship_Class_II | Victory_Destroyer | Interdictor_Cruiser | Vinterdictor_Cruiser | Escort_Carrier | Star_Destroyer | Star_Destroyer_Class_II | Star_Destroyer_Class_III | Executor_Super_Star_Destroyer | UEAW_Eclipse = 0,3"
,"Skipray_Squadron | StarViper_Squadron | UEAW_Aggressor_Squadron | Prowler-B_Squadron | Crusader_Gunship | Pinance_Heavy_Corvette | Interceptor4_Frigate | Recusant_Destroyer | Venator_Underworld | Munificent_Frigate | Orion_Dreadnaught | Kedalbe_Battleship | Krayt_Class_Destroyer | Pelleaon_Star_Destroyer | Lucrehulk_Battleship | Vengeance_Frigate | Super_Carrier | Malevolence = 0,3"
,"Hutt_VWing_Squadron | Hutt_Pirate_Fighter_Squadron | Viper_Squadron | Mirage_Squadron | Z95_Headhunter_Hutts_Squadron | Aqulamator_Bomber_Squadron | Gallofree_Corvette | Illuminator_Frigate | Hutt_Pirate_IPV | ShadowClaw_Corvette | Kavadonia_Corvette | Ultor_Beam_Cruiser | Kavadonian_Interceptor_Frigate | Hutt_Pirate_Frigate | Hutt_Dreadnaught | Gladiator_Cruiser | MC30_ION_Frigate | Executor_Frigate | Hutt_Eclipse | Centurion_Destroyer | Venator_SD | SternenKreuzer | Chronoscepter = 0,3"
,"Rogue_Squadron_Space | Red_Squadron_Spawner | Moldy_Crow | Sundered_Heart | Millennium_Falcon | Moff_Falast_Star_Destroyer | Home_One = 0,1"
,"Slave_I | Pellaeon_Acclamator | Arc_Hammer | Mara_Jade_Ship | TIE_Prototype_Spawner | Accuser_Star_Destroyer | Admonitor_Star_Destroyer | ISD_Gorgon = 0,1"
,"Houndstooth | Errant_Venture | IG-2000 | The_Peacebringer = 0,1"
,"Xizor_Virago | Chrysaetos | Qatil | Acklay | Pestelous_ISD | Galyana_SSD = 0,1"
,"Pirate_Fighter_Squadron | Cobra_Squadron | Prowler-A_Squadron | IPV1_System_Patrol_Craft | Vonosmas_Corvette | Pirate_Frigate | Guardian_Star_Defender | Hammer_SA | Providence_SA | Zylon_Destroyer = 0,3"
}
}
RequiredCategories = {"Fighter | Bomber | Corvette | Frigate | Capital | SpaceHero"}
AllowFreeStoreUnits = false
end
function ReserveForce_Thread()
BlockOnCommand(ReserveForce.Produce_Force())
ReserveForce.Set_Plan_Result(true)
ReserveForce.Set_As_Goal_System_Removable(false)
-- Give some time to accumulate money.
tech_level = PlayerObject.Get_Tech_Level()
min_credits = 2000
max_sleep_seconds = 30
if tech_level == 2 then
min_credits = 4000
max_sleep_seconds = 50
elseif tech_level >= 3 then
min_credits = 6000
max_sleep_seconds = 80
end
current_sleep_seconds = 0
while (PlayerObject.Get_Credits() < min_credits) and (current_sleep_seconds < max_sleep_seconds) do
current_sleep_seconds = current_sleep_seconds + 1
Sleep(1)
end
ScriptExit()
end

View File

@@ -0,0 +1,129 @@
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/AI/SpaceMode/TurboAttack.lua#1 $
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- (C) Petroglyph Games, Inc.
--
--
-- ***** ** * *
-- * ** * * *
-- * * * * *
-- * * * * * * * *
-- * * *** ****** * ** **** *** * * * ***** * ***
-- * ** * * * ** * ** ** * * * * ** ** ** *
-- *** ***** * * * * * * * * ** * * * *
-- * * * * * * * * * * * * * * *
-- * * * * * * * * * * ** * * * *
-- * ** * * ** * ** * * ** * * * *
-- ** **** ** * **** ***** * ** *** * *
-- * * *
-- * * *
-- * * *
-- * * * *
-- **** * *
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- C O N F I D E N T I A L S O U R C E C O D E -- D O N O T D I S T R I B U T E
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- $File: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/AI/SpaceMode/TurboAttack.lua $
--
-- Original Author: James Yarrow
--
-- $Author: Brian_Hayes $
--
-- $Change: 637819 $
--
-- $DateTime: 2017/03/22 10:16:16 $
--
-- $Revision: #1 $
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
require("pgevents")
--
-- Plan for corvettes to exploit their turbo or power to weapons abilities in a quick strike on a vulnerable unit.
--
function Definitions()
DebugMessage("%s -- In Definitions", tostring(Script))
Category = "Turbo_Attack_Unit"
TaskForce = {
-- First Task Force
{
"MainForce"
,"DenyHeroAttach"
,"Corellian_Corvette | Corellian_Gunboat | Tartan_Patrol_Cruiser | Slave_I | Sundered_Heart = 1, 10"
}
}
IgnoreTarget = true
AllowEngagedUnits = true
needs_turbo = false
DebugMessage("%s -- Done Definitions", tostring(Script))
end
function MainForce_Thread()
BlockOnCommand(MainForce.Produce_Force());
QuickReinforce(PlayerObject, AITarget, MainForce)
MainForce.Enable_Attack_Positioning(false)
-- Move into position while avoiding threat and without stopping for attacks on the way
needs_turbo = true
Try_Ability(MainForce, "Turbo")
BlockOnCommand(MainForce.Move_To(AITarget, 10, "ASTEROID"))
MainForce.Activate_Ability("Turbo", false)
needs_turbo = false
-- Nah, let attack location plans steal units away
-- MainForce.Set_As_Goal_System_Removable(false)
-- Make a tactical strike on one particular unit (and verify that there's still a good target here).
enemy = FindTarget(MainForce, "Good_Turbo_Attack_Unit_Opportunity", "Enemy_Unit", 1.0)
if TestValid(enemy) then
BlockOnCommand(MainForce.Attack_Target(enemy, 10, "ASTEROID"), 10) -- Timeout after 10 seconds.
end
-- Try to flee to a safe spot after the tactical strike
escape_loc = FindTarget(MainForce, "Space_Area_Is_Hidden", "Tactical_Location", 1.0, 5000.0)
if escape_loc then
needs_turbo = true
MainForce.Activate_Ability("Turbo", true)
BlockOnCommand(MainForce.Move_To(escape_loc, 10, "ASTEROID"))
end
ScriptExit()
end
-- Make sure that units don't sit idle at the end of their move order, waiting for others
function MainForce_Unit_Move_Finished(tf, unit)
if Attacking and not unit.Has_Attack_Target() then
DebugMessage("%s -- %s reached end of move, giving new order", tostring(Script), tostring(unit))
-- Assist the tf with whatever is holding it up
kill_target = FindDeadlyEnemy(tf)
if TestValid(kill_target) then
unit.Attack_Target(kill_target)
else
unit.Attack_Move(tf)
end
end
end
-- Try to recover use of turbo or power to weapons if it was lost while we were trying to use it.
function MainForce_Unit_Ability_Ready(tf, unit, ability)
--MessageBox("%s -- Recovering %s for %s!", tostring(Script), ability, tostring(unit))
if ability == "Turbo" and needs_turbo then
unit.Activate_Ability("Turbo", true)
end
-- Default handler behavior is still desired
Default_Unit_Ability_Ready(tf, unit, ability)
end

View File

@@ -0,0 +1,146 @@
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/AI/SpaceMode/TurboAttackLocation.lua#1 $
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- (C) Petroglyph Games, Inc.
--
--
-- ***** ** * *
-- * ** * * *
-- * * * * *
-- * * * * * * * *
-- * * *** ****** * ** **** *** * * * ***** * ***
-- * ** * * * ** * ** ** * * * * ** ** ** *
-- *** ***** * * * * * * * * ** * * * *
-- * * * * * * * * * * * * * * *
-- * * * * * * * * * * ** * * * *
-- * ** * * ** * ** * * ** * * * *
-- ** **** ** * **** ***** * ** *** * *
-- * * *
-- * * *
-- * * *
-- * * * *
-- **** * *
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
-- C O N F I D E N T I A L S O U R C E C O D E -- D O N O T D I S T R I B U T E
--/////////////////////////////////////////////////////////////////////////////////////////////////
--
-- $File: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/AI/SpaceMode/TurboAttackLocation.lua $
--
-- Original Author: James Yarrow
--
-- $Author: Brian_Hayes $
--
-- $Change: 637819 $
--
-- $DateTime: 2017/03/22 10:16:16 $
--
-- $Revision: #1 $
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
require("pgevents")
--
-- Plan for corvettes to exploit their anti-fighter capabilities while using turbo or power to weapons.
--
function Definitions()
DebugMessage("%s -- In Definitions", tostring(Script))
Category = "Turbo_Attack_Location"
TaskForce = {
-- First Task Force
{
"MainForce"
,"DenyHeroAttach"
,"Corellian_Corvette | Corellian_Gunboat | Tartan_Patrol_Cruiser | Slave_I | Sundered_Heart = 1, 3"
}
}
IgnoreTarget = true
AllowEngagedUnits = true
needs_turbo = false
was_attacked = false
DebugMessage("%s -- Done Definitions", tostring(Script))
end
function MainForce_Thread()
BlockOnCommand(MainForce.Produce_Force());
QuickReinforce(PlayerObject, AITarget, MainForce)
MainForce.Enable_Attack_Positioning(false)
-- Move into position while avoiding threat and without stopping for attacks on the way
needs_turbo = true
Try_Ability(MainForce, "Turbo")
BlockOnCommand(MainForce.Move_To(AITarget))
MainForce.Activate_Ability("Turbo", false)
needs_turbo = false
-- Clear out the area, while it remains favorable for this type of attack.
MainForce.Set_As_Goal_System_Removable(false)
while (EvaluatePerception("Good_Turbo_Attack_Location_Opportunity", PlayerObject, AITarget) > 0) do
enemy = Find_Nearest(MainForce, "SmallShip", PlayerObject, false)
--enemy = Find_Nearest(MainForce, "Fighter", PlayerObject, false)
if TestValid(enemy) then -- FIX and (MainForce.Get_Distance(enemy) < 1000) then
BlockOnCommand(MainForce.Attack_Target(enemy))
else
break
end
end
-- Try to flee to a safe spot after the tactical strike
if was_attacked then
escape_loc = FindTarget(MainForce, "Space_Area_Is_Hidden", "Tactical_Location", 1.0, 5000.0)
if escape_loc then
needs_turbo = true
MainForce.Activate_Ability("Turbo", true)
BlockOnCommand(MainForce.Move_To(escape_loc))
end
end
ScriptExit()
end
-- Make sure that units don't sit idle at the end of their move order, waiting for others
function MainForce_Unit_Move_Finished(tf, unit)
if Attacking and not unit.Has_Attack_Target() then
DebugMessage("%s -- %s reached end of move, giving new order", tostring(Script), tostring(unit))
-- Assist the tf with whatever is holding it up
kill_target = FindDeadlyEnemy(tf)
if TestValid(kill_target) then
unit.Attack_Target(kill_target)
else
unit.Attack_Move(tf)
end
end
end
-- Try to recover use of turbo or power to weapons if it was lost while we were trying to use it.
function MainForce_Unit_Ability_Ready(tf, unit, ability)
--MessageBox("%s -- Recovering %s for %s!", tostring(Script), ability, tostring(unit))
if ability == "Turbo" and needs_turbo then
unit.Activate_Ability("Turbo", true)
end
-- Default handler behavior is still desired
Default_Unit_Ability_Ready(tf, unit, ability)
end
-- Register if we were attacked, and use default behavior as well.
function MainForce_Unit_Damaged(tf, unit, attacker, deliberate)
if deliberate then
was_attacked = true
end
-- Default handler behavior is still desired
Default_Unit_Damaged(tf, unit, attacker, deliberate)
end