Files
SoaFE/DATA/SCRIPTS/AI/UNRESTRICTEDGRABLAND.LUA
2026-02-28 14:00:45 -06:00

105 lines
3.6 KiB
Lua

-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/AI/UnrestrictedGrabLand.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/UnrestrictedGrabLand.lua $
--
-- Original Author: James Yarrow
--
-- $Author: Brian_Hayes $
--
-- $Change: 637819 $
--
-- $DateTime: 2017/03/22 10:16:16 $
--
-- $Revision: #1 $
--
--/////////////////////////////////////////////////////////////////////////////////////////////////
--A plan to rapidly grab land control that bypasses timing restrictions on AI attacks.
require("pgtaskforce")
-- Tell the script pooling system to pre-cache this number of scripts.
ScriptPoolCount = 4
function Definitions()
MinContrastScale = 1.1
MaxContrastScale = 1.25
Category = "Unrestricted_Grab_Land"
TaskForce = {
{
"MainForce"
, "Infantry | Vehicle | Air = 100%"
}
}
RequiredCategories = { "Infantry" }
end
function MainForce_Thread()
-- Since we're using plan failure to adjust contrast, we're
-- only concerned with failures in battle. Default the
-- plan to successful and then
-- only on the event of our task force being killed is the
-- plan set to a failed state.
MainForce.Set_Plan_Result(true)
--For fast execution, build and attack in one plan rather than having the first few iterations
--feed the freestore
AssembleForce(MainForce)
if not LaunchUnits(MainForce) then
ScriptExit()
end
BlockOnCommand(MainForce.Move_To(Target))
if MainForce.Get_Force_Count() == 0 then
MainForce.Set_Plan_Result(false)
ScriptExit()
end
if Invade(MainForce) == false then
MainForce.Set_Plan_Result(false)
ScriptExit()
end
ScriptExit()
end
function MainForce_Production_Failed(failed_object_type)
ScriptExit()
end
function MainForce_Original_Target_Owner_Changed(tf, old_owner, new_owner)
--Ignore changes to neutral - it might just be temporary on the way to
--passing into my control.
if new_owner ~= PlayerObject and new_owner.Is_Neutral() == false then
ScriptExit()
end
end