-- $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