-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/Demo_Land_Controller_E.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/GameObject/Demo_Land_Controller_E.lua $ -- -- Original Author: Dan Etter -- -- $Author: Brian_Hayes $ -- -- $Change: 637819 $ -- -- $DateTime: 2017/03/22 10:16:16 $ -- -- $Revision: #1 $ -- --///////////////////////////////////////////////////////////////////////////////////////////////// require("PGStateMachine") require("PGStoryMode") function Definitions() -- Object isn't valid at this point so don't do any operations that -- would require it. State_Init is the first chance you have to do -- operations on Object DebugMessage("%s -- In Definitions", tostring(Script)) Define_State("State_Init", State_Init); empire_player = Find_Player("Empire") rebel_player = Find_Player("Rebel") underworld_player = Find_Player("Underworld") enemy_player = Find_Player("Empire") move_command = true destroyer_squad = Find_Object_Type("DESTROYER_DROID_COMPANY") destroyer = Find_Object_Type("DESTROYER_DROID") disruptor_squad = Find_Object_Type("UNDERWORLD_DISRUPTOR_MERC_SQUAD") disruptor = Find_Object_Type("UNDERWORLD_DISRUPTOR_MERC") merc_squad = Find_Object_Type("UNDERWORLD_MERC_SQUAD") merc = Find_Object_Type("UNDERWORLD_MERC") spmat = Find_Object_Type("SPMAT_WALKER") juggernaut = Find_Object_Type("HAV_JUGGERNAUT") dark_phase_1_squad = Find_Object_Type("DARKTROOPER_P1_COMPANY") dark_phase_1 = Find_Object_Type("DARK_TROOPER_PHASEI") dark_phase_2_squad = Find_Object_Type("DARKTROOPER_P2_COMPANY") dark_phase_2 = Find_Object_Type("DARK_TROOPER_PHASEII") dark_phase_3_squad = Find_Object_Type("DARKTROOPER_P3_COMPANY") dark_phase_3 = Find_Object_Type("DARK_TROOPER_PHASEIII") stormtrooper_squad = Find_Object_Type("IMPERIAL_STORMTROOPER_SQUAD") stormtrooper = Find_Object_Type("SQUAD_STORMTROOPER") lancet = Find_Object_Type("LANCET_AIR_ARTILLERY") end function State_Init(message) if (move_command == true) then empire_unit_list = Find_All_Objects_Of_Type(empire_player) rebel_unit_list = Find_All_Objects_Of_Type(rebel_player) underworld_unit_list = Find_All_Objects_Of_Type(underworld_player) empire_reveal = FogOfWar.Reveal_All(empire_player) rebel_reveal = FogOfWar.Reveal_All(rebel_player) uw_reveal = FogOfWar.Reveal_All(underworld_player) eg_list = Find_All_Objects_With_Hint("eg") rg_list = Find_All_Objects_With_Hint("rg") bossk = Find_First_Object("BOSSK") ig88 = Find_First_Object("IG-88") dest0_list = Find_All_Objects_With_Hint("dest0") dest0 = Find_Hint("STORY_TRIGGER_ZONE_00", "dest0") dest1_list = Find_All_Objects_With_Hint("dest1") dest1 = Find_Hint("STORY_TRIGGER_ZONE_00", "dest1") Move_Hunt_Group(eg_list) Move_Hunt_Group(rg_list) Create_Thread("Guard_Self", empire_unit_list) --MessageBox("Fleets Defined") move_command = false end end function Guard_Self(group) for k, unit in pairs(group) do if TestValid(unit) then if unit.Is_Category("Infantry") or unit.Is_Category("Vehicle") then if not (unit.Get_Type() == stormtrooper) and not (unit.Get_Type() == r_infantry) then unit.Guard_Target(unit.Get_Position()) end end end end end function Move_Hunt_Group(group) for k, unit in pairs(group) do if TestValid(unit) then Create_Thread("Hunt_Enemies", unit) end end end function Hunt_Enemies(attacker) while TestValid(attacker) do closest_enemy = Find_Nearest(attacker, enemy_player, true) if TestValid(closest_enemy) then attacker.Attack_Move(closest_enemy) end Sleep(5) end end