Initial commit
This commit is contained in:
82
DATA/SCRIPTS/GAMEOBJECT/BOBAFETTPLAN.LUA
Normal file
82
DATA/SCRIPTS/GAMEOBJECT/BOBAFETTPLAN.LUA
Normal file
@@ -0,0 +1,82 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/BobaFettPlan.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/BobaFettPlan.lua $
|
||||
--
|
||||
-- Original Author: Steve_Copeland
|
||||
--
|
||||
-- $Author: Brian_Hayes $
|
||||
--
|
||||
-- $Change: 637819 $
|
||||
--
|
||||
-- $DateTime: 2017/03/22 10:16:16 $
|
||||
--
|
||||
-- $Revision: #1 $
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
require("HeroPlanAttach")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
|
||||
-- only join plans that meet our expense requirements.
|
||||
MinPlanAttachCost = 45000
|
||||
MaxPlanAttachCost = 0
|
||||
|
||||
-- Commander hit list.
|
||||
Attack_Ability_Type_Names = {
|
||||
"Home_One", "Han_Solo_Team", "Obi_Wan_Team", -- Attack these types.
|
||||
"Katarn_Team" -- Stay away from these types.
|
||||
}
|
||||
Attack_Ability_Weights = {
|
||||
1, 1, 1, 1, 1, 1, -- attack type weights.
|
||||
BAD_WEIGHT -- feared type weights.
|
||||
}
|
||||
Attack_Ability_Types = WeightedTypeList.Create()
|
||||
Attack_Ability_Types.Parse(Attack_Ability_Type_Names, Attack_Ability_Weights)
|
||||
|
||||
-- Prefer task forces with these units.
|
||||
Escort_Ability_Type_Names = { "Capital", "Corvette", "Frigate", "Fleet_Com_Rebel_Team", "Fleet_Com_Empire_Team" }
|
||||
Escort_Ability_Weights = { 10, 10, 10, BAD_WEIGHT, BAD_WEIGHT }
|
||||
Escort_Ability_Types = WeightedTypeList.Create()
|
||||
Escort_Ability_Types.Parse(Escort_Ability_Type_Names, Escort_Ability_Weights)
|
||||
end
|
||||
|
||||
function Evaluate_Attack_Ability(target, goal)
|
||||
return Get_Target_Weight(target, Attack_Ability_Types, Attack_Ability_Weights)
|
||||
end
|
||||
|
||||
function Get_Escort_Ability_Weights(goal)
|
||||
return Escort_Ability_Types
|
||||
end
|
||||
|
||||
function HeroService()
|
||||
|
||||
end
|
||||
|
||||
|
||||
84
DATA/SCRIPTS/GAMEOBJECT/CREDITPOWERUP.LUA
Normal file
84
DATA/SCRIPTS/GAMEOBJECT/CREDITPOWERUP.LUA
Normal file
@@ -0,0 +1,84 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/CreditPowerUp.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/CreditPowerUp.lua $
|
||||
--
|
||||
-- Original Author: James Yarrow
|
||||
--
|
||||
-- $Author: Brian_Hayes $
|
||||
--
|
||||
-- $Change: 637819 $
|
||||
--
|
||||
-- $DateTime: 2017/03/22 10:16:16 $
|
||||
--
|
||||
-- $Revision: #1 $
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
|
||||
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);
|
||||
|
||||
player = nil
|
||||
end
|
||||
|
||||
|
||||
function State_Init(message)
|
||||
|
||||
if message == OnEnter then
|
||||
-- Set up event handling for when an object moves within range
|
||||
Object.Event_Object_In_Range(object_in_range_handler, 150)
|
||||
elseif message == OnUpdate then
|
||||
-- Do nothing
|
||||
elseif message == OnExit then
|
||||
-- Do nothing
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function object_in_range_handler(prox_object, object)
|
||||
|
||||
player = object.Get_Owner()
|
||||
if player.Is_Human() then
|
||||
object.Get_Owner().Give_Money(1000)
|
||||
|
||||
-- Cancel the object in range event from signaling anymore.
|
||||
Object.Cancel_Event_Object_In_Range(object_in_range_handler)
|
||||
|
||||
Object.Despawn()
|
||||
end
|
||||
|
||||
end
|
||||
203
DATA/SCRIPTS/GAMEOBJECT/DARTHVADER.LUA
Normal file
203
DATA/SCRIPTS/GAMEOBJECT/DARTHVADER.LUA
Normal file
@@ -0,0 +1,203 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/DarthVader.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/DarthVader.lua $
|
||||
--
|
||||
-- Original Author: Brian Hayes
|
||||
--
|
||||
-- $Author: Brian_Hayes $
|
||||
--
|
||||
-- $Change: 637819 $
|
||||
--
|
||||
-- $DateTime: 2017/03/22 10:16:16 $
|
||||
--
|
||||
-- $Revision: #1 $
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
-- This include order is important. We need the state service defined in main to override the one in heroplanattach.
|
||||
require("HeroPlanAttach")
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
|
||||
-- only join plans that meet our expense requirements.
|
||||
MinPlanAttachCost = 5000
|
||||
MaxPlanAttachCost = 0
|
||||
|
||||
Attack_Ability_Type_Names = {
|
||||
"Capital", "Corvette", "Frigate", "Fighter" -- Attack these types.
|
||||
}
|
||||
Attack_Ability_Weights = {
|
||||
1, 1, 1, 1 -- attack type weights.
|
||||
}
|
||||
|
||||
Attack_Ability_Types = WeightedTypeList.Create()
|
||||
Attack_Ability_Types.Parse(Attack_Ability_Type_Names, Attack_Ability_Weights)
|
||||
|
||||
-- Prefer task forces with these units.
|
||||
Escort_Ability_Type_Names = { "Infantry", "Fighter", "Corvette", "Frigate", "Capital" }
|
||||
Escort_Ability_Weights = { 1, 2, 3, 4, 5 }
|
||||
Escort_Ability_Types = WeightedTypeList.Create()
|
||||
Escort_Ability_Types.Parse(Escort_Ability_Type_Names, Escort_Ability_Weights)
|
||||
|
||||
-- tactical behavior stuff
|
||||
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init)
|
||||
Define_State("State_AI_Autofire", State_AI_Autofire)
|
||||
Define_State("State_Human_No_Autofire", State_Human_No_Autofire)
|
||||
Define_State("State_Human_Autofire", State_Human_Autofire)
|
||||
|
||||
unit_trigger_number = 10
|
||||
divert_range = 400
|
||||
min_threat_to_use_ability = 10
|
||||
ability_name = "FORCE_WHIRLWIND"
|
||||
area_of_effect = 75
|
||||
|
||||
stealth_reveal_range = 200
|
||||
stealth_ability = "STEALTH"
|
||||
end
|
||||
|
||||
function Evaluate_Attack_Ability(target, goal)
|
||||
return Get_Target_Weight(target, Attack_Ability_Types, Attack_Ability_Weights)
|
||||
end
|
||||
|
||||
function Get_Escort_Ability_Weights(goal)
|
||||
return Escort_Ability_Types
|
||||
end
|
||||
|
||||
function HeroService()
|
||||
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() ~= "Land" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
nearby_unit_count = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
Register_Prox(Object, Unit_Reveal_Prox, stealth_reveal_range)
|
||||
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Register_Prox(Object, Unit_Prox, area_of_effect)
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
else
|
||||
Register_Prox(Object, Unit_Prox, divert_range)
|
||||
Set_Next_State("State_AI_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_AI_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if (nearby_unit_count >= unit_trigger_number) then
|
||||
ConsiderDivertAndAOE(Object, ability_name, area_of_effect, recent_enemy_units, min_threat_to_use_ability)
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_unit_count = 0
|
||||
recent_enemy_units = {}
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_No_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
Set_Next_State("State_Human_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
if nearby_unit_count > 8 then
|
||||
Object.Activate_Ability(ability_name, true)
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_unit_count = 0
|
||||
recent_enemy_units = {}
|
||||
else
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- If an enemy enters the prox, the unit may want to chase them down to use the ability
|
||||
function Unit_Prox(self_obj, trigger_obj)
|
||||
|
||||
-- Vader can only force push infantry
|
||||
if not trigger_obj.Is_Category("Infantry") then
|
||||
return
|
||||
end
|
||||
|
||||
-- Reject heroes, which are often infantry, but we can't affect
|
||||
if trigger_obj.Is_Category("LandHero") then
|
||||
return
|
||||
end
|
||||
|
||||
if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
return
|
||||
end
|
||||
|
||||
if trigger_obj.Is_In_Garrison() then
|
||||
return
|
||||
end
|
||||
|
||||
-- Note: we're explicitly tracking individual infantry here (as opposed to their parents, the squads)
|
||||
|
||||
-- If we haven't seen this unit recently, track him
|
||||
if recent_enemy_units[trigger_obj] == nil then
|
||||
recent_enemy_units[trigger_obj] = trigger_obj
|
||||
nearby_unit_count = nearby_unit_count + 1
|
||||
end
|
||||
end
|
||||
|
||||
-- If a stealthed enemy enters the prox, disable their stealth ability
|
||||
function Unit_Reveal_Prox(self_obj, trigger_obj)
|
||||
if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
return
|
||||
end
|
||||
|
||||
if trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
if trigger_obj.Is_Ability_Active(stealth_ability) then
|
||||
if Is_Campaign_Game() == true then
|
||||
trigger_obj.Cancel_Ability(stealth_ability)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
84
DATA/SCRIPTS/GAMEOBJECT/DEATHSTARPLAN.LUA
Normal file
84
DATA/SCRIPTS/GAMEOBJECT/DEATHSTARPLAN.LUA
Normal file
@@ -0,0 +1,84 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/DeathStarPlan.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/DeathStarPlan.lua $
|
||||
--
|
||||
-- Original Author: Steve_Copeland
|
||||
--
|
||||
-- $Author: Brian_Hayes $
|
||||
--
|
||||
-- $Change: 637819 $
|
||||
--
|
||||
-- $DateTime: 2017/03/22 10:16:16 $
|
||||
--
|
||||
-- $Revision: #1 $
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
require("HeroPlanAttach")
|
||||
|
||||
-- Self Attachment plan is currently unused; the death star has a plan that names it in the task force
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
|
||||
-- only join plans that meet our expense requirements.
|
||||
MinPlanAttachCost = 50000
|
||||
MaxPlanAttachCost = 0
|
||||
|
||||
-- Commander hit list.
|
||||
Attack_Ability_Type_Names = {
|
||||
"Infantry", "Vehicle", "Air", "Structure", -- Attack these types.
|
||||
"Luke_Team" -- Stay away from these types.
|
||||
}
|
||||
Attack_Ability_Weights = {
|
||||
1, 1, 1, 10, -- attack type weights.
|
||||
BAD_WEIGHT -- feared type weights.
|
||||
}
|
||||
Attack_Ability_Types = WeightedTypeList.Create()
|
||||
Attack_Ability_Types.Parse(Attack_Ability_Type_Names, Attack_Ability_Weights)
|
||||
|
||||
-- Prefer task forces with these units.
|
||||
Escort_Ability_Type_Names = {"Fighter", "Capital", "Frigate", "Super" }
|
||||
Escort_Ability_Weights = { 1, 5, 4, 6 }
|
||||
Escort_Ability_Types = WeightedTypeList.Create()
|
||||
Escort_Ability_Types.Parse(Escort_Ability_Type_Names, Escort_Ability_Weights)
|
||||
end
|
||||
|
||||
function Evaluate_Attack_Ability(target, goal)
|
||||
return Get_Target_Weight(target, Attack_Ability_Types, Attack_Ability_Weights)
|
||||
end
|
||||
|
||||
function Get_Escort_Ability_Weights(goal)
|
||||
return Escort_Ability_Types
|
||||
end
|
||||
|
||||
function HeroService()
|
||||
|
||||
end
|
||||
|
||||
|
||||
42
DATA/SCRIPTS/GAMEOBJECT/DEFENSE_STATION_TELEPORT.LUA
Normal file
42
DATA/SCRIPTS/GAMEOBJECT/DEFENSE_STATION_TELEPORT.LUA
Normal file
@@ -0,0 +1,42 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/Defense_Station_Teleport.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- script is activated by the "Defense_Station_Teleport_Marker" via FoW ping ability
|
||||
-- simply check for which station is active (there can only ever be one) and teleport it to the marker location
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
Define_State("State_Init", State_Init);
|
||||
ServiceRate = 1.0
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
rebel_ds = Find_First_Object("Rebel_Defense_Station_GC")
|
||||
empire_ds = Find_First_Object("Empire_Defense_Station_GC")
|
||||
cons_ds = Find_First_Object("Underworld_Defense_Station_GC")
|
||||
hutt_ds = Find_First_Object("Hutt_Defense_Station_GC")
|
||||
|
||||
-- if not TestValid(rebel_ds) or if not TestValid(empire_ds) or if not TestValid(cons_ds) or if not TestValid(hutt_ds) then
|
||||
-- ScriptExit()
|
||||
-- end
|
||||
|
||||
if TestValid(rebel_ds) then
|
||||
rebel_ds.Teleport(Object)
|
||||
elseif TestValid(empire_ds) then
|
||||
empire_ds.Teleport(Object)
|
||||
elseif TestValid(cons_ds) then
|
||||
cons_ds.Teleport(Object)
|
||||
elseif TestValid(hutt_ds) then
|
||||
hutt_ds.Teleport(Object)
|
||||
else ScriptExit()
|
||||
end
|
||||
|
||||
ScriptExit()
|
||||
end
|
||||
end
|
||||
124
DATA/SCRIPTS/GAMEOBJECT/DEMO_ATTRACT_CONTROLLER.LUA
Normal file
124
DATA/SCRIPTS/GAMEOBJECT/DEMO_ATTRACT_CONTROLLER.LUA
Normal file
@@ -0,0 +1,124 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/Demo_Attract_Controller.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_Attract_Controller.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")
|
||||
|
||||
move_command = true
|
||||
|
||||
controller = Find_First_Object("DEMO_CONTROLLER")
|
||||
hyper_gun = Find_Object_Type("GROUND_EMPIRE_HYPERVELOCITY_GUN")
|
||||
ion_cannon = Find_Object_Type("GROUND_ION_CANNON")
|
||||
starviper = Find_Object_Type("STARVIPER_FIGHTER")
|
||||
tie_phantom = Find_Object_Type("TIE_PHANTOM")
|
||||
tie_fighter = Find_Object_Type("TIE_FIGHTER")
|
||||
tie_bomber = Find_Object_Type("TIE_BOMBER")
|
||||
b_wing = Find_Object_Type("B-WING")
|
||||
x_wing = Find_Object_Type("X-WING")
|
||||
a_wing = Find_Object_Type("A-WING")
|
||||
star_base = Find_Object_Type("REBEL_STAR_BASE_3")
|
||||
|
||||
end
|
||||
|
||||
|
||||
function State_Init(message)
|
||||
|
||||
if (move_command == true) then
|
||||
|
||||
empire_reveal = FogOfWar.Reveal_All(empire_player)
|
||||
rebel_reveal = FogOfWar.Reveal_All(rebel_player)
|
||||
uw_reveal = FogOfWar.Reveal_All(underworld_player)
|
||||
|
||||
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)
|
||||
|
||||
e_goto_list = Find_All_Objects_Of_Type ("STORY_TRIGGER_ZONE_02")
|
||||
r_goto_list = Find_All_Objects_Of_Type ("STORY_TRIGGER_ZONE_00")
|
||||
uw_goto_list = Find_All_Objects_Of_Type ("STORY_TRIGGER_ZONE_01")
|
||||
|
||||
Move_Fleet(empire_unit_list, e_goto_list)
|
||||
Move_Fleet(rebel_unit_list, r_goto_list)
|
||||
Move_Fleet(underworld_unit_list, uw_goto_list)
|
||||
|
||||
--MessageBox("Fleets Defined")
|
||||
|
||||
move_command = false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function Move_Fleet(list, loc_list)
|
||||
for k, unit in pairs(list) do
|
||||
if TestValid(unit) then
|
||||
if not
|
||||
(unit.Get_Type() == hyper_gun) and not
|
||||
(unit.Get_Type() == ion_cannon) and not
|
||||
(unit.Get_Type() == star_base) and not
|
||||
(unit.Get_Type() == starviper) and not
|
||||
(unit.Get_Type() == tie_phantom) and not
|
||||
(unit.Get_Type() == tie_fighter) and not
|
||||
(unit.Get_Type() == tie_bomber) and not
|
||||
(unit.Get_Type() == a_wing) and not
|
||||
(unit.Get_Type() == x_wing) and not
|
||||
(unit.Get_Type() == b_wing) then
|
||||
|
||||
rand_loc = GameRandom(1,3)
|
||||
unit.Attack_Move(loc_list[rand_loc].Get_Position())
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
167
DATA/SCRIPTS/GAMEOBJECT/DEMO_DEATHSTAR_CONTROLLER.LUA
Normal file
167
DATA/SCRIPTS/GAMEOBJECT/DEMO_DEATHSTAR_CONTROLLER.LUA
Normal file
@@ -0,0 +1,167 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/Demo_DeathStar_Controller.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_DeathStar_Controller.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()
|
||||
|
||||
StoryModeEvents =
|
||||
{
|
||||
Demo_Executor_Destroyed = State_Demo_Executor_Destroyed,
|
||||
Demo_SuperLaser_Started = State_Demo_SuperLaser_Started,
|
||||
Demo_Start = State_Demo_Start
|
||||
}
|
||||
|
||||
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")
|
||||
|
||||
move_command = true
|
||||
|
||||
end
|
||||
|
||||
|
||||
function State_Init(message)
|
||||
|
||||
if (move_command == true) then
|
||||
|
||||
empire_reveal = FogOfWar.Reveal_All(empire_player)
|
||||
rebel_reveal = FogOfWar.Reveal_All(rebel_player)
|
||||
uw_reveal = FogOfWar.Reveal_All(underworld_player)
|
||||
|
||||
--MessageBox("Fleets Defined")
|
||||
|
||||
move_command = false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function State_Demo_Executor_Destroyed(message)
|
||||
if message == OnEnter then
|
||||
--MessageBox("Executor Cinematic Started")
|
||||
Create_Thread("Executor_Cinematic")
|
||||
end
|
||||
end
|
||||
|
||||
function State_Demo_SuperLaser_Started(message)
|
||||
if message == OnEnter then
|
||||
--MessageBox("Cinematic Started")
|
||||
Create_Thread("SuperLaser_Cinematic")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- ##########################################################################################
|
||||
-- Executor Cinematic functions
|
||||
-- ##########################################################################################
|
||||
|
||||
function Executor_Cinematic()
|
||||
Fade_Screen_Out(0)
|
||||
Suspend_AI(1)
|
||||
Lock_Controls(1)
|
||||
Start_Cinematic_Camera()
|
||||
Letter_Box_In(0)
|
||||
|
||||
executor = Find_First_Object("EXECUTOR_DEATH_CLONE")
|
||||
|
||||
Set_Cinematic_Camera_Key(executor, 4000, 10, 70, 1, 1, 1, 0)
|
||||
Set_Cinematic_Target_Key(executor, 0, 0, 0, 0, 0, 0, 0)
|
||||
|
||||
Fade_Screen_In(0)
|
||||
Transition_Cinematic_Camera_Key(executor, 16, 2000, 5, 130, 1, 1, 1, 0)
|
||||
|
||||
Sleep(15)
|
||||
|
||||
Fade_Screen_Out(1)
|
||||
Lock_Controls(0)
|
||||
Sleep(1)
|
||||
End_Cinematic_Camera()
|
||||
Letter_Box_Out(0)
|
||||
Suspend_AI(0)
|
||||
Sleep(1)
|
||||
Fade_Screen_In(1)
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
-- ##########################################################################################
|
||||
-- Super Laser Cinematic functions
|
||||
-- ##########################################################################################
|
||||
|
||||
function SuperLaser_Cinematic()
|
||||
Fade_Screen_Out(0)
|
||||
Suspend_AI(1)
|
||||
Lock_Controls(1)
|
||||
Start_Cinematic_Camera()
|
||||
Letter_Box_In(0)
|
||||
|
||||
deathstar = Find_First_Object("DEATH_STAR_II")
|
||||
home_one = Find_First_Object("HOME_ONE")
|
||||
|
||||
Set_Cinematic_Camera_Key(home_one, 2000, 30, 15, 1, 1, 1, 0)
|
||||
Set_Cinematic_Target_Key(deathstar, 0, 2500, 0, 0, 0, 0, 0)
|
||||
|
||||
Fade_Screen_In(2)
|
||||
Transition_Cinematic_Camera_Key(home_one, 18, 1700, 5, 45, 1, 1, 1, 0)
|
||||
|
||||
Sleep(2)
|
||||
Transition_Cinematic_Target_Key(deathstar, 18, 0, 0, 1500, 0, 0, 0, 0)
|
||||
Sleep(14)
|
||||
|
||||
Fade_Screen_Out(1)
|
||||
Sleep(1)
|
||||
Lock_Controls(0)
|
||||
Sleep(1)
|
||||
End_Cinematic_Camera()
|
||||
Letter_Box_Out(0)
|
||||
Suspend_AI(0)
|
||||
Fade_Screen_In(1)
|
||||
|
||||
|
||||
|
||||
end
|
||||
304
DATA/SCRIPTS/GAMEOBJECT/DEMO_FELUCIA_CONTROLLER.LUA
Normal file
304
DATA/SCRIPTS/GAMEOBJECT/DEMO_FELUCIA_CONTROLLER.LUA
Normal file
@@ -0,0 +1,304 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/Demo_Felucia_Controller.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_Felucia_Controller.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()
|
||||
|
||||
StoryModeEvents =
|
||||
{
|
||||
Demo_Bombard_Started = State_Demo_Bombard_Started
|
||||
}
|
||||
|
||||
-- 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")
|
||||
|
||||
move_command = true
|
||||
cine_triggered = false
|
||||
camera_offset = 225
|
||||
|
||||
invulnerable = true
|
||||
|
||||
stormtrooper = Find_Object_Type("SQUAD_STORMTROOPER")
|
||||
wall_corner = Find_Object_Type("EMPIRE_WALL_CORNER")
|
||||
wall_inside_corner = Find_Object_Type("EMPIRE_WALL__INSIDE_CORNER")
|
||||
wall = Find_Object_Type("EMPIRE_WALL")
|
||||
turbo_tower = Find_Object_Type("E_GROUND_TURBOLASER_TOWER")
|
||||
hv_gun = Find_Object_Type("GROUND_EMPIRE_HYPERVELOCITY_GUN")
|
||||
command_center = Find_Object_Type("IMPERIAL_COMMAND_CENTER")
|
||||
power = Find_Object_Type("POWER_GENERATOR_E")
|
||||
research = Find_Object_Type("E_GROUND_RESEARCH_FACILITY")
|
||||
bunker = Find_Object_Type("GARRISON_BUNKER_EMPIRE")
|
||||
barracks = Find_Object_Type("E_GROUND_BARRACKS")
|
||||
facotry = Find_Object_Type("E_GROUND_HEAVY_VEHICLE_FACTORY")
|
||||
array = Find_Object_Type("COMMUNICATIONS_ARRAY_E")
|
||||
shuttle = Find_Object_Type("LANDED_EMPIRE_SHUTTLE")
|
||||
platform = Find_Object_Type("EMPIRE_LANDING_PLATFORM_2X")
|
||||
build_pad = Find_Object_Type("SKIRMISH_BUILD_PAD")
|
||||
turret = Find_Object_Type("EMPIRE_ANTI_INFANTRY_TURRET")
|
||||
reinforcement_point = Find_Object_Type("REINFORCEMENT_POINT_EMPIRE")
|
||||
|
||||
end
|
||||
|
||||
|
||||
function State_Init(message)
|
||||
|
||||
if (move_command == true) then
|
||||
|
||||
empire_reveal = FogOfWar.Reveal_All(empire_player)
|
||||
rebel_reveal = FogOfWar.Reveal_All(rebel_player)
|
||||
uw_reveal = FogOfWar.Reveal_All(underworld_player)
|
||||
|
||||
underworld_player.Give_Money(10000)
|
||||
|
||||
controller = Find_First_Object("FELUCIA_DEMO_CONTROLLER")
|
||||
|
||||
empire_unit_list = Find_All_Objects_Of_Type(empire_player)
|
||||
empire_goto = Find_Hint("STORY_TRIGGER_ZONE_00", "empiregoto")
|
||||
|
||||
uw_unit_list = Find_All_Objects_Of_Type(underworld_player)
|
||||
|
||||
--MessageBox("Fleets Defined")
|
||||
|
||||
move_command = false
|
||||
|
||||
current_cinematic_thread = Create_Thread("Intro_Cinematic")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function State_Demo_Bombard_Started(message)
|
||||
if message == OnEnter then
|
||||
Create_Thread("Bombardment_Cinematic")
|
||||
end
|
||||
end
|
||||
|
||||
function Move_Units(list)
|
||||
for k, unit in pairs(list) do
|
||||
if TestValid(unit) then
|
||||
if unit.Is_Category("Infantry") or unit.Is_Category("Vehicle") then
|
||||
if not
|
||||
-- (unit.Get_Type() == wall_corner) and not
|
||||
-- (unit.Get_Type() == wall_inside_corner) and not
|
||||
-- (unit.Get_Type() == wall) and not
|
||||
-- (unit.Get_Type() == turbo_tower) and not
|
||||
-- (unit.Get_Type() == hv_gun) and not
|
||||
-- (unit.Get_Type() == command_center) and not
|
||||
-- (unit.Get_Type() == power) and not
|
||||
-- (unit.Get_Type() == research) and not
|
||||
-- (unit.Get_Type() == bunker) and not
|
||||
-- (unit.Get_Type() == barracks) and not
|
||||
-- (unit.Get_Type() == facotry) and not
|
||||
-- (unit.Get_Type() == array) and not
|
||||
-- (unit.Get_Type() == shuttle) and not
|
||||
-- (unit.Get_Type() == platform) and not
|
||||
-- (unit.Get_Type() == build_pad) and not
|
||||
-- (unit.Get_Type() == turret) and not
|
||||
-- (unit.Get_Type() == reinforcement_point) and not
|
||||
(unit.Get_Type() == stormtrooper) then
|
||||
unit.Move_To(empire_goto.Get_Position())
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Story_Handle_Esc()
|
||||
if current_cinematic_thread ~= nil then
|
||||
Thread.Kill(current_cinematic_thread)
|
||||
current_cinematic_thread = nil
|
||||
Create_Thread("End_Camera")
|
||||
end
|
||||
end
|
||||
|
||||
function Make_Invulnerable(list, condition)
|
||||
for k, unit in pairs(list) do
|
||||
if TestValid(unit) then
|
||||
if invulnerable == true then
|
||||
unit.Make_Invulnerable(true)
|
||||
else
|
||||
unit.Make_Invulnerable(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- ##########################################################################################
|
||||
-- Intro Cinematic functions
|
||||
-- ##########################################################################################
|
||||
|
||||
function Intro_Cinematic()
|
||||
invulnerable = true
|
||||
Create_Thread("Make_Invulnerable", uw_unit_list, invulnerable)
|
||||
|
||||
Suspend_AI(1)
|
||||
Lock_Controls(1)
|
||||
Start_Cinematic_Camera()
|
||||
Letter_Box_In(2)
|
||||
|
||||
--Sleep(1)
|
||||
|
||||
tyber = Find_First_Object("TYBER_ZANN")
|
||||
|
||||
Transition_Cinematic_Camera_Key(tyber, 7, 50, 35, 135, 1, 1, 1, 0)
|
||||
Transition_Cinematic_Target_Key(tyber, 5, 0, 0, 10, 0, 0, 0, 0)
|
||||
Sleep(7)
|
||||
|
||||
Transition_Cinematic_Camera_Key(tyber, 5, 50, 35, 225, 1, 1, 1, 0)
|
||||
|
||||
Sleep(4.5)
|
||||
|
||||
while true do
|
||||
camera_offset = camera_offset + 90
|
||||
Transition_Cinematic_Camera_Key(tyber, 5, 50, 35, camera_offset, 1, 1, 1, 0)
|
||||
|
||||
if camera_offset == 315 then
|
||||
camera_offset = -45
|
||||
end
|
||||
|
||||
Sleep(4.5)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function End_Camera()
|
||||
Transition_To_Tactical_Camera(2)
|
||||
Letter_Box_Out(2)
|
||||
Sleep(2)
|
||||
Lock_Controls(0)
|
||||
End_Cinematic_Camera()
|
||||
Suspend_AI(0)
|
||||
|
||||
invulnerable = false
|
||||
Create_Thread("Make_Invulnerable", uw_unit_list, invulnerable)
|
||||
end
|
||||
|
||||
-- ##########################################################################################
|
||||
-- Orbital Bombardment Cinematic functions
|
||||
-- ##########################################################################################
|
||||
|
||||
function Bombardment_Cinematic()
|
||||
Fade_Screen_Out(0)
|
||||
Suspend_AI(1)
|
||||
Lock_Controls(1)
|
||||
Start_Cinematic_Camera()
|
||||
Letter_Box_In(0)
|
||||
|
||||
Allow_Localized_SFX(false)
|
||||
Weather_Audio_Pause(true)
|
||||
Enable_Fog(false)
|
||||
|
||||
krayt = Find_Hint("PROP_KRAYT_CINE_UNIT", "firingkrayt")
|
||||
interceptor = Find_First_Object("PROP_INTERCEPTOR_CINE_UNIT")
|
||||
felucia = Find_First_Object("PROP_FELUCIA_PLANET_CINE_UNIT")
|
||||
|
||||
krayt.Prevent_AI_Usage(true)
|
||||
|
||||
interceptor.Play_SFX_Event("Structure_Magnepulse_Charge")
|
||||
|
||||
--Set_Cinematic_Camera_Key(krayt, 200, 10, -60, 1, 1, 1, 0)
|
||||
Set_Cinematic_Camera_Key(krayt, 700, 15, 75, 1, 1, 1, 0)
|
||||
Set_Cinematic_Target_Key(felucia, 0, 0, 0, 1, 1, 0, 0)
|
||||
|
||||
Fade_Screen_In(2)
|
||||
--Transition_Cinematic_Camera_Key(krayt, 8, 200, 10, 45, 1, 1, 1, 0)
|
||||
Transition_Cinematic_Camera_Key(krayt, 16, 200, 10, 45, 1, 1, 1, 0)
|
||||
|
||||
Sleep(2.60)
|
||||
krayt.Play_SFX_Event("Structure_Magnepulse_Charge")
|
||||
Sleep(4.30)
|
||||
|
||||
krayt.Play_Animation("Cinematic", false, 0)
|
||||
Sleep(2.65)
|
||||
krayt.Play_SFX_Event("Unit_Ion_Cannon_Fire")
|
||||
Sleep(2.75)
|
||||
krayt.Play_SFX_Event("Unit_Hyper_Velocity_Fire")
|
||||
Sleep(2)
|
||||
|
||||
Transition_Cinematic_Target_Key(krayt, 8, 0, 0, 0, 0, 0, 0, 0)
|
||||
Fade_Screen_Out(1)
|
||||
|
||||
Create_Thread("Move_Units", empire_unit_list)
|
||||
Sleep(1)
|
||||
|
||||
Allow_Localized_SFX(true)
|
||||
Weather_Audio_Pause(false)
|
||||
-- Enable_Fog(true)
|
||||
|
||||
-- -- Set_Cinematic_Camera_Key(target_pos, xoffset_dist, yoffset_pitch, zoffset_yaw, angles?, attach_object, use_object_rotation, cinematic_animation)
|
||||
-- Set_Cinematic_Camera_Key(controller, 850, 35, 30, 1, 1, 0, 0)
|
||||
-- -- Set_Cinematic_Target_Key(target_pos, x_dist, y_pitch, z_yaw, euler, pobj, use_object_rotation, cinematic_animation)
|
||||
-- Set_Cinematic_Target_Key(controller, 0, -20, 15, 1, 1, 0, 0)
|
||||
|
||||
Set_Cinematic_Camera_Key(controller, 700, 90, 15, 1, 1, 0, 0)
|
||||
Set_Cinematic_Target_Key(controller, 0, 0, 0, 1, 1, 0, 0)
|
||||
|
||||
Fade_Screen_In(2)
|
||||
|
||||
-- -- Transition_Cinematic_Camera_Key(target_pos, time, xoffset_dist, yoffset_pitch, zoffset_yaw, angles?, attach_object, use_object_rotation, cinematic_animation)
|
||||
-- Transition_Cinematic_Camera_Key(controller, 15, 850, 35, 100, 1, 1, 0, 0)
|
||||
Transition_Cinematic_Camera_Key(controller, 7, 835, 47, 90, 1, 1, 0, 0)
|
||||
|
||||
Sleep(10)
|
||||
|
||||
Fade_Screen_Out(1)
|
||||
Sleep(1)
|
||||
Lock_Controls(0)
|
||||
Sleep(1)
|
||||
End_Cinematic_Camera()
|
||||
Letter_Box_Out(0)
|
||||
Suspend_AI(0)
|
||||
Fade_Screen_In(1)
|
||||
|
||||
|
||||
|
||||
end
|
||||
227
DATA/SCRIPTS/GAMEOBJECT/DEMO_LAND_CONTROLLER.LUA
Normal file
227
DATA/SCRIPTS/GAMEOBJECT/DEMO_LAND_CONTROLLER.LUA
Normal file
@@ -0,0 +1,227 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/Demo_Land_Controller.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.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")
|
||||
|
||||
move_command = true
|
||||
|
||||
controller = Find_First_Object("DEMO_CONTROLLER_LAND")
|
||||
mptl = Find_Object_Type("MPTL")
|
||||
t4b = Find_Object_Type("T4B_TANK")
|
||||
t2b = Find_Object_Type("T2B_TANK")
|
||||
luke = Find_Object_Type("LUKE_SKYWALKER_JEDI")
|
||||
yoda = Find_Object_Type("YODA")
|
||||
speeder = Find_Object_Type("SNOWSPEEDER")
|
||||
r_infantry_squad = Find_Object_Type("REBEL_INFANTRY_SQUAD")
|
||||
r_infantry = Find_Object_Type("SQUAD_REBEL_TROOPER")
|
||||
|
||||
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")
|
||||
yoda = Find_First_Object("YODA")
|
||||
|
||||
speeder_list = Find_All_Objects_Of_Type("SNOWSPEEDER")
|
||||
lancet_list = Find_All_Objects_Of_Type("LANCET_AIR_ARTILLERY")
|
||||
|
||||
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")
|
||||
|
||||
Create_Thread("Move_IG88", ig88)
|
||||
Create_Thread("Move_Bossk", bossk)
|
||||
|
||||
Create_Thread("Move_Destroyer_group", eg_list)
|
||||
Create_Thread("Move_Destroyer_group1", rg_list)
|
||||
|
||||
Create_Thread("Guard_Self", empire_unit_list)
|
||||
Create_Thread("Guard_Self", rebel_unit_list)
|
||||
|
||||
Create_Thread("Yoda_Attack", yoda)
|
||||
|
||||
--MessageBox("Fleets Defined")
|
||||
|
||||
move_command = false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function Yoda_Attack(unit)
|
||||
while true do
|
||||
if TestValid(unit) then
|
||||
closest_enemy = Find_Nearest(unit, underworld_player, true)
|
||||
if TestValid(closest_enemy) then
|
||||
unit.Activate_Ability("BERSERKER", closest_enemy)
|
||||
end
|
||||
end
|
||||
Sleep(1)
|
||||
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_Air_Units(group)
|
||||
for k, unit in pairs(group) do
|
||||
if TestValid(unit) then
|
||||
unit.Attack_Move(dest0.Get_Position())
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Move_Air_Units1(group)
|
||||
for k, unit in pairs(group) do
|
||||
if TestValid(unit) then
|
||||
unit.Attack_Move(dest1.Get_Position())
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Move_IG88(unit)
|
||||
rand_loc = GameRandom(1,3)
|
||||
if TestValid(unit) then
|
||||
unit.Attack_Move(dest0_list[rand_loc].Get_Position())
|
||||
end
|
||||
end
|
||||
|
||||
function Move_Bossk(unit)
|
||||
rand_loc = GameRandom(1,3)
|
||||
if TestValid(unit) then
|
||||
unit.Attack_Move(dest1_list[rand_loc].Get_Position())
|
||||
end
|
||||
end
|
||||
|
||||
function Move_Destroyer_group(group)
|
||||
rand_loc = GameRandom(1,3)
|
||||
for k, unit in pairs(group) do
|
||||
|
||||
if TestValid(unit) then
|
||||
unit.Attack_Move(dest0_list[rand_loc].Get_Position())
|
||||
end
|
||||
end
|
||||
|
||||
-- sleeptimer = GameRandom(8, 11)
|
||||
-- Sleep(sleeptimer)
|
||||
-- Deploy_Destroyer_group(group, dest0_list[rand_loc])
|
||||
end
|
||||
|
||||
function Move_Destroyer_group1(group)
|
||||
rand_loc = GameRandom(1,3)
|
||||
for k, unit in pairs(group) do
|
||||
|
||||
if TestValid(unit) then
|
||||
unit.Attack_Move(dest1_list[rand_loc].Get_Position())
|
||||
end
|
||||
end
|
||||
|
||||
-- sleeptimer = GameRandom(12, 14)
|
||||
-- Sleep(sleeptimer)
|
||||
-- Deploy_Destroyer_group(group, dest0_list[rand_loc])
|
||||
end
|
||||
|
||||
--function Deploy_Destroyer_group(group, loc)
|
||||
-- for k, unit in pairs(group) do
|
||||
-- if TestValid(unit) then
|
||||
-- unit.Activate_Ability("DEPLOY", true)
|
||||
-- end
|
||||
-- end
|
||||
--
|
||||
--end
|
||||
152
DATA/SCRIPTS/GAMEOBJECT/DEMO_LAND_CONTROLLER_E.LUA
Normal file
152
DATA/SCRIPTS/GAMEOBJECT/DEMO_LAND_CONTROLLER_E.LUA
Normal file
@@ -0,0 +1,152 @@
|
||||
-- $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
|
||||
|
||||
227
DATA/SCRIPTS/GAMEOBJECT/DEMO_LAND_CONTROLLER_R.LUA
Normal file
227
DATA/SCRIPTS/GAMEOBJECT/DEMO_LAND_CONTROLLER_R.LUA
Normal file
@@ -0,0 +1,227 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/Demo_Land_Controller_R.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_R.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")
|
||||
|
||||
move_command = true
|
||||
|
||||
controller = Find_First_Object("DEMO_CONTROLLER_LAND")
|
||||
mptl = Find_Object_Type("MPTL")
|
||||
t4b = Find_Object_Type("T4B_TANK")
|
||||
t2b = Find_Object_Type("T2B_TANK")
|
||||
luke = Find_Object_Type("LUKE_SKYWALKER_JEDI")
|
||||
yoda = Find_Object_Type("YODA")
|
||||
speeder = Find_Object_Type("SNOWSPEEDER")
|
||||
r_infantry_squad = Find_Object_Type("REBEL_INFANTRY_SQUAD")
|
||||
r_infantry = Find_Object_Type("SQUAD_REBEL_TROOPER")
|
||||
|
||||
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")
|
||||
yoda = Find_First_Object("YODA")
|
||||
|
||||
speeder_list = Find_All_Objects_Of_Type("SNOWSPEEDER")
|
||||
lancet_list = Find_All_Objects_Of_Type("LANCET_AIR_ARTILLERY")
|
||||
|
||||
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")
|
||||
|
||||
Create_Thread("Move_IG88", ig88)
|
||||
Create_Thread("Move_Bossk", bossk)
|
||||
|
||||
Create_Thread("Move_Destroyer_group", eg_list)
|
||||
Create_Thread("Move_Destroyer_group1", rg_list)
|
||||
|
||||
Create_Thread("Guard_Self", empire_unit_list)
|
||||
Create_Thread("Guard_Self", rebel_unit_list)
|
||||
|
||||
Create_Thread("Yoda_Attack", yoda)
|
||||
|
||||
--MessageBox("Fleets Defined")
|
||||
|
||||
move_command = false
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function Yoda_Attack(unit)
|
||||
while true do
|
||||
if TestValid(unit) then
|
||||
closest_enemy = Find_Nearest(unit, underworld_player, true)
|
||||
if TestValid(closest_enemy) then
|
||||
unit.Activate_Ability("BERSERKER", closest_enemy)
|
||||
end
|
||||
end
|
||||
Sleep(1)
|
||||
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_Air_Units(group)
|
||||
for k, unit in pairs(group) do
|
||||
if TestValid(unit) then
|
||||
unit.Attack_Move(dest0.Get_Position())
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Move_Air_Units1(group)
|
||||
for k, unit in pairs(group) do
|
||||
if TestValid(unit) then
|
||||
unit.Attack_Move(dest1.Get_Position())
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Move_IG88(unit)
|
||||
rand_loc = GameRandom(1,3)
|
||||
if TestValid(unit) then
|
||||
unit.Attack_Move(dest0_list[rand_loc].Get_Position())
|
||||
end
|
||||
end
|
||||
|
||||
function Move_Bossk(unit)
|
||||
rand_loc = GameRandom(1,3)
|
||||
if TestValid(unit) then
|
||||
unit.Attack_Move(dest1_list[rand_loc].Get_Position())
|
||||
end
|
||||
end
|
||||
|
||||
function Move_Destroyer_group(group)
|
||||
rand_loc = GameRandom(1,3)
|
||||
for k, unit in pairs(group) do
|
||||
|
||||
if TestValid(unit) then
|
||||
unit.Attack_Move(dest0_list[rand_loc].Get_Position())
|
||||
end
|
||||
end
|
||||
|
||||
-- sleeptimer = GameRandom(8, 11)
|
||||
-- Sleep(sleeptimer)
|
||||
-- Deploy_Destroyer_group(group, dest0_list[rand_loc])
|
||||
end
|
||||
|
||||
function Move_Destroyer_group1(group)
|
||||
rand_loc = GameRandom(1,3)
|
||||
for k, unit in pairs(group) do
|
||||
|
||||
if TestValid(unit) then
|
||||
unit.Attack_Move(dest1_list[rand_loc].Get_Position())
|
||||
end
|
||||
end
|
||||
|
||||
-- sleeptimer = GameRandom(12, 14)
|
||||
-- Sleep(sleeptimer)
|
||||
-- Deploy_Destroyer_group(group, dest0_list[rand_loc])
|
||||
end
|
||||
|
||||
--function Deploy_Destroyer_group(group, loc)
|
||||
-- for k, unit in pairs(group) do
|
||||
-- if TestValid(unit) then
|
||||
-- unit.Activate_Ability("DEPLOY", true)
|
||||
-- end
|
||||
-- end
|
||||
--
|
||||
--end
|
||||
@@ -0,0 +1,64 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/Despawn_Spectator_Upgrades_E_Barracks.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- Note: Script assumes only 1 structure is ever present
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
Define_State("State_Init", State_Init);
|
||||
ServiceRate = 1.0
|
||||
|
||||
spectator_player = nil
|
||||
|
||||
team_1_upgrades_list =
|
||||
{
|
||||
"Spectator_T1_EL_Increased_Mobility_Upgrade",
|
||||
"Spectator_T1_EL_Increased_Mobility_L2_Upgrade",
|
||||
"Spectator_T1_EL_Increased_Mobility_L3_Upgrade",
|
||||
"Spectator_T1_EL_Scout_Snipers_Upgrade",
|
||||
"Spectator_T1_EL_Overclocked_Snipers_Upgrade",
|
||||
"Spectator_T1_EL_Weatherproof_Upgrade"
|
||||
}
|
||||
|
||||
team_2_upgrades_list =
|
||||
{
|
||||
"Spectator_T2_EL_Increased_Mobility_Upgrade",
|
||||
"Spectator_T2_EL_Increased_Mobility_L2_Upgrade",
|
||||
"Spectator_T2_EL_Increased_Mobility_L3_Upgrade",
|
||||
"Spectator_T2_EL_Scout_Snipers_Upgrade",
|
||||
"Spectator_T2_EL_Overclocked_Snipers_Upgrade",
|
||||
"Spectator_T2_EL_Weatherproof_Upgrade"
|
||||
}
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
spectator_player = Find_First_Object("Spectator_Reveal_Marker_Land")
|
||||
|
||||
if not spectator_player then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Get_Team() == 0 then
|
||||
for i, upgrade_name in pairs(team_1_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
else
|
||||
if Object.Get_Owner().Get_Team() == 1 then
|
||||
for i, upgrade_name in pairs(team_2_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,60 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/Despawn_Spectator_Upgrades_E_CommandCenter.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- Note: Script assumes only 1 structure is ever present
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
Define_State("State_Init", State_Init);
|
||||
ServiceRate = 1.0
|
||||
|
||||
spectator_player = nil
|
||||
|
||||
team_1_upgrades_list =
|
||||
{
|
||||
"Spectator_T1_EC_Level_Two_Tech_Upgrade",
|
||||
"Spectator_T1_EC_Level_Three_Tech_Upgrade",
|
||||
"Spectator_T1_EC_Level_Four_Tech_Upgrade",
|
||||
"Spectator_T1_EC_Level_Five_Tech_Upgrade"
|
||||
}
|
||||
|
||||
team_2_upgrades_list =
|
||||
{
|
||||
"Spectator_T2_EC_Level_Two_Tech_Upgrade",
|
||||
"Spectator_T2_EC_Level_Three_Tech_Upgrade",
|
||||
"Spectator_T2_EC_Level_Four_Tech_Upgrade",
|
||||
"Spectator_T2_EC_Level_Five_Tech_Upgrade"
|
||||
}
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
spectator_player = Find_First_Object("Spectator_Reveal_Marker_Land")
|
||||
|
||||
if not spectator_player then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Get_Team() == 0 then
|
||||
for i, upgrade_name in pairs(team_1_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
else
|
||||
if Object.Get_Owner().Get_Team() == 1 then
|
||||
for i, upgrade_name in pairs(team_2_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,68 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/Despawn_Spectator_Upgrades_E_HeavyFactory.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- Note: Script assumes only 1 structure is ever present
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
Define_State("State_Init", State_Init);
|
||||
ServiceRate = 1.0
|
||||
|
||||
spectator_player = nil
|
||||
|
||||
team_1_upgrades_list =
|
||||
{
|
||||
"Spectator_T1_EL_Heavy_Reflective_Armor_L1_Upgrade",
|
||||
"Spectator_T1_EL_Heavy_Reflective_Armor_L2_Upgrade",
|
||||
"Spectator_T1_EL_Enhanced_Reactors_L2_Upgrade",
|
||||
"Spectator_T1_EL_Upgraded_Cooling_Systems_L2_Upgrade",
|
||||
"Spectator_T1_EL_Fortified_Transports_Upgrade",
|
||||
"Spectator_T1_EL_Improved_ATAT_Reactors_L1_Upgrade",
|
||||
"Spectator_T1_EL_Improved_ATAT_Reactors_L2_Upgrade",
|
||||
"Spectator_T1_EL_Siege_Bombers_Upgrade"
|
||||
}
|
||||
|
||||
team_2_upgrades_list =
|
||||
{
|
||||
"Spectator_T2_EL_Heavy_Reflective_Armor_L1_Upgrade",
|
||||
"Spectator_T2_EL_Heavy_Reflective_Armor_L2_Upgrade",
|
||||
"Spectator_T2_EL_Enhanced_Reactors_L2_Upgrade",
|
||||
"Spectator_T2_EL_Upgraded_Cooling_Systems_L2_Upgrade",
|
||||
"Spectator_T2_EL_Fortified_Transports_Upgrade",
|
||||
"Spectator_T2_EL_Improved_ATAT_Reactors_L1_Upgrade",
|
||||
"Spectator_T2_EL_Improved_ATAT_Reactors_L2_Upgrade",
|
||||
"Spectator_T2_EL_Siege_Bombers_Upgrade"
|
||||
}
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
spectator_player = Find_First_Object("Spectator_Reveal_Marker_Land")
|
||||
|
||||
if not spectator_player then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Get_Team() == 0 then
|
||||
for i, upgrade_name in pairs(team_1_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
else
|
||||
if Object.Get_Owner().Get_Team() == 1 then
|
||||
for i, upgrade_name in pairs(team_2_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,60 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/Despawn_Spectator_Upgrades_E_LightFactory.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- Note: Script assumes only 1 structure is ever present
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
Define_State("State_Init", State_Init);
|
||||
ServiceRate = 1.0
|
||||
|
||||
spectator_player = nil
|
||||
|
||||
team_1_upgrades_list =
|
||||
{
|
||||
"Spectator_T1_EL_Light_Reflective_Armor_L1_Upgrade",
|
||||
"Spectator_T1_EL_Light_Reflective_Armor_L2_Upgrade",
|
||||
"Spectator_T1_EL_Enhanced_Reactors_L1_Upgrade",
|
||||
"Spectator_T1_EL_Upgraded_Cooling_Systems_L1_Upgrade"
|
||||
}
|
||||
|
||||
team_2_upgrades_list =
|
||||
{
|
||||
"Spectator_T2_EL_Light_Reflective_Armor_L1_Upgrade",
|
||||
"Spectator_T2_EL_Light_Reflective_Armor_L2_Upgrade",
|
||||
"Spectator_T2_EL_Enhanced_Reactors_L1_Upgrade",
|
||||
"Spectator_T2_EL_Upgraded_Cooling_Systems_L1_Upgrade"
|
||||
}
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
spectator_player = Find_First_Object("Spectator_Reveal_Marker_Land")
|
||||
|
||||
if not spectator_player then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Get_Team() == 0 then
|
||||
for i, upgrade_name in pairs(team_1_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
else
|
||||
if Object.Get_Owner().Get_Team() == 1 then
|
||||
for i, upgrade_name in pairs(team_2_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,76 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/Despawn_Spectator_Upgrades_E_MiningFacility.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- Note: Script will check for multiple structures and abort if it finds any
|
||||
|
||||
require("PGStateMachine")
|
||||
require("PGBase")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
Define_State("State_Init", State_Init);
|
||||
ServiceRate = 1.0
|
||||
|
||||
spectator_player = nil
|
||||
|
||||
team_1_upgrades_list =
|
||||
{
|
||||
"Spectator_T1_EL_Increased_Production_L1_Upgrade",
|
||||
"Spectator_T1_EL_Increased_Production_L2_Upgrade",
|
||||
"Spectator_T1_EL_Increased_Production_L3_Upgrade"
|
||||
}
|
||||
|
||||
team_2_upgrades_list =
|
||||
{
|
||||
"Spectator_T2_EL_Increased_Production_L1_Upgrade",
|
||||
"Spectator_T2_EL_Increased_Production_L2_Upgrade",
|
||||
"Spectator_T2_EL_Increased_Production_L3_Upgrade"
|
||||
}
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
Sleep(0.5) --Required to properly find facilities
|
||||
facility_list = Find_All_Objects_Of_Type("Empire_Ground_Mining_Facility")
|
||||
player_team = Object.Get_Owner().Get_Team()
|
||||
|
||||
for i, facility in pairs(facility_list) do
|
||||
if TestValid(facility) then
|
||||
facility_team = facility.Get_Owner().Get_Team()
|
||||
if player_team == facility_team then
|
||||
Object.Despawn()
|
||||
ScriptExit()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
spectator_player = Find_First_Object("Spectator_Reveal_Marker_Land")
|
||||
|
||||
if not spectator_player then
|
||||
Object.Despawn()
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Get_Team() == 0 then
|
||||
for i, upgrade_name in pairs(team_1_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
else
|
||||
if Object.Get_Owner().Get_Team() == 1 then
|
||||
for i, upgrade_name in pairs(team_2_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Object.Despawn()
|
||||
ScriptExit()
|
||||
end
|
||||
@@ -0,0 +1,64 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/Despawn_Spectator_Upgrades_E_ResearchFacility.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- Note: Script assumes only 1 structure is ever present
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
Define_State("State_Init", State_Init);
|
||||
ServiceRate = 1.0
|
||||
|
||||
spectator_player = nil
|
||||
|
||||
team_1_upgrades_list =
|
||||
{
|
||||
"Spectator_T1_EL_Magnetically_Sealed_Structure_Upgrade",
|
||||
"Spectator_T1_EL_Enhanced_Turret_Firepower_L1_Upgrade",
|
||||
"Spectator_T1_EL_Enhanced_Turret_Firepower_L2_Upgrade",
|
||||
"Spectator_T1_EL_Enhanced_Turret_Firepower_L3_Upgrade",
|
||||
"Spectator_T1_EL_Repair_Nanites_L1_Upgrade",
|
||||
"Spectator_T1_EL_Repair_Nanites_L2_Upgrade"
|
||||
}
|
||||
|
||||
team_2_upgrades_list =
|
||||
{
|
||||
"Spectator_T2_EL_Magnetically_Sealed_Structure_Upgrade",
|
||||
"Spectator_T2_EL_Enhanced_Turret_Firepower_L1_Upgrade",
|
||||
"Spectator_T2_EL_Enhanced_Turret_Firepower_L2_Upgrade",
|
||||
"Spectator_T2_EL_Enhanced_Turret_Firepower_L3_Upgrade",
|
||||
"Spectator_T2_EL_Repair_Nanites_L1_Upgrade",
|
||||
"Spectator_T2_EL_Repair_Nanites_L2_Upgrade"
|
||||
}
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
spectator_player = Find_First_Object("Spectator_Reveal_Marker_Land")
|
||||
|
||||
if not spectator_player then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Get_Team() == 0 then
|
||||
for i, upgrade_name in pairs(team_1_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
else
|
||||
if Object.Get_Owner().Get_Team() == 1 then
|
||||
for i, upgrade_name in pairs(team_2_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,85 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/Despawn_Spectator_Upgrades_E_ShieldGen.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- Note: Script will check for multiple structures and abort if it finds any
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
Define_State("State_Init", State_Init);
|
||||
ServiceRate = 1.0
|
||||
|
||||
spectator_player = nil
|
||||
|
||||
team_1_upgrades_list =
|
||||
{
|
||||
"Spectator_T1_EL_Enhanced_Base_Shield_Upgrade"
|
||||
}
|
||||
|
||||
team_2_upgrades_list =
|
||||
{
|
||||
"Spectator_T2_EL_Enhanced_Base_Shield_Upgrade"
|
||||
}
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
spectator_player = Find_First_Object("Spectator_Reveal_Marker_Land")
|
||||
|
||||
if not spectator_player then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
shield_list_1 = Find_All_Objects_Of_Type("E_Ground_Base_Shield_740")
|
||||
for i, building in pairs(shield_list_1) do
|
||||
if TestValid(building) and building.Get_Owner().Get_Team() == Object.Get_Owner().Get_Team() then
|
||||
Object.Despawn()
|
||||
ScriptExit()
|
||||
end
|
||||
end
|
||||
shield_list_2 = Find_All_Objects_Of_Type("E_Ground_Base_Shield_370")
|
||||
for i, building in pairs(shield_list_2) do
|
||||
if TestValid(building) and building.Get_Owner().Get_Team() == Object.Get_Owner().Get_Team() then
|
||||
Object.Despawn()
|
||||
ScriptExit()
|
||||
end
|
||||
end
|
||||
shield_list_3 = Find_All_Objects_Of_Type("E_Ground_Base_Shield_740_Pad")
|
||||
for i, building in pairs(shield_list_3) do
|
||||
if TestValid(building) and building.Get_Owner().Get_Team() == Object.Get_Owner().Get_Team() then
|
||||
Object.Despawn()
|
||||
ScriptExit()
|
||||
end
|
||||
end
|
||||
shield_list_4 = Find_All_Objects_Of_Type("E_Ground_Base_Shield_370_Pad")
|
||||
for i, building in pairs(shield_list_4) do
|
||||
if TestValid(building) and building.Get_Owner().Get_Team() == Object.Get_Owner().Get_Team() then
|
||||
Object.Despawn()
|
||||
ScriptExit()
|
||||
end
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Get_Team() == 0 then
|
||||
for i, upgrade_name in pairs(team_1_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
else
|
||||
if Object.Get_Owner().Get_Team() == 1 then
|
||||
for i, upgrade_name in pairs(team_2_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Object.Despawn()
|
||||
ScriptExit()
|
||||
end
|
||||
@@ -0,0 +1,66 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/Despawn_Spectator_Upgrades_H_Barracks.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- Note: Script assumes only 1 structure is ever present
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
Define_State("State_Init", State_Init);
|
||||
ServiceRate = 1.0
|
||||
|
||||
spectator_player = nil
|
||||
|
||||
team_1_upgrades_list =
|
||||
{
|
||||
"Spectator_T1_HL_Combat_Training_L1_Upgrade",
|
||||
"Spectator_T1_HL_Combat_Training_L2_Upgrade",
|
||||
"Spectator_T1_HL_Combat_Training_L3_Upgrade",
|
||||
"Spectator_T1_HL_Heavy_Rockets_L1_Upgrade",
|
||||
"Spectator_T1_HL_Heavy_Rockets_L2_Upgrade",
|
||||
"Spectator_T1_HL_Improved_Combat_Armor_L1_Upgrade",
|
||||
"Spectator_T1_HL_Improved_Combat_Armor_L2_Upgrade"
|
||||
}
|
||||
|
||||
team_2_upgrades_list =
|
||||
{
|
||||
"Spectator_T2_HL_Combat_Training_L1_Upgrade",
|
||||
"Spectator_T2_HL_Combat_Training_L2_Upgrade",
|
||||
"Spectator_T2_HL_Combat_Training_L3_Upgrade",
|
||||
"Spectator_T2_HL_Heavy_Rockets_L1_Upgrade",
|
||||
"Spectator_T2_HL_Heavy_Rockets_L2_Upgrade",
|
||||
"Spectator_T2_HL_Improved_Combat_Armor_L1_Upgrade",
|
||||
"Spectator_T2_HL_Improved_Combat_Armor_L2_Upgrade"
|
||||
}
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
spectator_player = Find_First_Object("Spectator_Reveal_Marker_Land")
|
||||
|
||||
if not spectator_player then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Get_Team() == 0 then
|
||||
for i, upgrade_name in pairs(team_1_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
else
|
||||
if Object.Get_Owner().Get_Team() == 1 then
|
||||
for i, upgrade_name in pairs(team_2_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,60 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/Despawn_Spectator_Upgrades_H_CommandCenter.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- Note: Script assumes only 1 structure is ever present
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
Define_State("State_Init", State_Init);
|
||||
ServiceRate = 1.0
|
||||
|
||||
spectator_player = nil
|
||||
|
||||
team_1_upgrades_list =
|
||||
{
|
||||
"Spectator_T1_HC_Level_Two_Tech_Upgrade",
|
||||
"Spectator_T1_HC_Level_Three_Tech_Upgrade",
|
||||
"Spectator_T1_HC_Level_Four_Tech_Upgrade",
|
||||
"Spectator_T1_HC_Level_Five_Tech_Upgrade"
|
||||
}
|
||||
|
||||
team_2_upgrades_list =
|
||||
{
|
||||
"Spectator_T2_HC_Level_Two_Tech_Upgrade",
|
||||
"Spectator_T2_HC_Level_Three_Tech_Upgrade",
|
||||
"Spectator_T2_HC_Level_Four_Tech_Upgrade",
|
||||
"Spectator_T2_HC_Level_Five_Tech_Upgrade"
|
||||
}
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
spectator_player = Find_First_Object("Spectator_Reveal_Marker_Land")
|
||||
|
||||
if not spectator_player then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Get_Team() == 0 then
|
||||
for i, upgrade_name in pairs(team_1_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
else
|
||||
if Object.Get_Owner().Get_Team() == 1 then
|
||||
for i, upgrade_name in pairs(team_2_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,70 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/Despawn_Spectator_Upgrades_H_Factory.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- Note: Script assumes only 1 structure is ever present
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
Define_State("State_Init", State_Init);
|
||||
ServiceRate = 1.0
|
||||
|
||||
spectator_player = nil
|
||||
|
||||
team_1_upgrades_list =
|
||||
{
|
||||
"Spectator_T1_HL_Armor_Plating_L1_Upgrade",
|
||||
"Spectator_T1_HL_Armor_Plating_L2_Upgrade",
|
||||
"Spectator_T1_HL_Armor_Plating_L3_Upgrade",
|
||||
"Spectator_T1_HL_Supercharged_Beams_L1_Upgrade",
|
||||
"Spectator_T1_HL_Supercharged_Beams_L2_Upgrade",
|
||||
"Spectator_T1_HL_Heavy_Armor_L1_Upgrade",
|
||||
"Spectator_T1_HL_Heavy_Armor_L2_Upgrade",
|
||||
"Spectator_T1_HL_Sailbarge_Repair_Crews_Upgrade",
|
||||
"Spectator_T1_HL_Advanced_Gunship_Upgrade"
|
||||
}
|
||||
|
||||
team_2_upgrades_list =
|
||||
{
|
||||
"Spectator_T2_HL_Armor_Plating_L1_Upgrade",
|
||||
"Spectator_T2_HL_Armor_Plating_L2_Upgrade",
|
||||
"Spectator_T2_HL_Armor_Plating_L3_Upgrade",
|
||||
"Spectator_T2_HL_Supercharged_Beams_L1_Upgrade",
|
||||
"Spectator_T2_HL_Supercharged_Beams_L2_Upgrade",
|
||||
"Spectator_T2_HL_Heavy_Armor_L1_Upgrade",
|
||||
"Spectator_T2_HL_Heavy_Armor_L2_Upgrade",
|
||||
"Spectator_T2_HL_Sailbarge_Repair_Crews_Upgrade",
|
||||
"Spectator_T2_HL_Advanced_Gunship_Upgrade"
|
||||
}
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
spectator_player = Find_First_Object("Spectator_Reveal_Marker_Land")
|
||||
|
||||
if not spectator_player then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Get_Team() == 0 then
|
||||
for i, upgrade_name in pairs(team_1_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
else
|
||||
if Object.Get_Owner().Get_Team() == 1 then
|
||||
for i, upgrade_name in pairs(team_2_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,76 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/Despawn_Spectator_Upgrades_H_MiningFacility.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- Note: Script will check for multiple structures and abort if it finds any
|
||||
|
||||
require("PGStateMachine")
|
||||
require("PGBase")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
Define_State("State_Init", State_Init);
|
||||
ServiceRate = 1.0
|
||||
|
||||
spectator_player = nil
|
||||
|
||||
team_1_upgrades_list =
|
||||
{
|
||||
"Spectator_T1_HL_Increased_Production_L1_Upgrade",
|
||||
"Spectator_T1_HL_Increased_Production_L2_Upgrade",
|
||||
"Spectator_T1_HL_Increased_Production_L3_Upgrade"
|
||||
}
|
||||
|
||||
team_2_upgrades_list =
|
||||
{
|
||||
"Spectator_T2_HL_Increased_Production_L1_Upgrade",
|
||||
"Spectator_T2_HL_Increased_Production_L2_Upgrade",
|
||||
"Spectator_T2_HL_Increased_Production_L3_Upgrade"
|
||||
}
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
Sleep(0.5) --Required to properly find facilities
|
||||
facility_list = Find_All_Objects_Of_Type("Hutts_Ground_Mining_Facility")
|
||||
player_team = Object.Get_Owner().Get_Team()
|
||||
|
||||
for i, facility in pairs(facility_list) do
|
||||
if TestValid(facility) then
|
||||
facility_team = facility.Get_Owner().Get_Team()
|
||||
if player_team == facility_team then
|
||||
Object.Despawn()
|
||||
ScriptExit()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
spectator_player = Find_First_Object("Spectator_Reveal_Marker_Land")
|
||||
|
||||
if not spectator_player then
|
||||
Object.Despawn()
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Get_Team() == 0 then
|
||||
for i, upgrade_name in pairs(team_1_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
else
|
||||
if Object.Get_Owner().Get_Team() == 1 then
|
||||
for i, upgrade_name in pairs(team_2_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Object.Despawn()
|
||||
ScriptExit()
|
||||
end
|
||||
@@ -0,0 +1,70 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/Despawn_Spectator_Upgrades_H_ResearchFacility.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- Note: Script assumes only 1 structure is ever present
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
Define_State("State_Init", State_Init);
|
||||
ServiceRate = 1.0
|
||||
|
||||
spectator_player = nil
|
||||
|
||||
team_1_upgrades_list =
|
||||
{
|
||||
"Spectator_T1_HL_Shielded_Deployment_L1_Upgrade",
|
||||
"Spectator_T1_HL_Secure_Area_Upgrade",
|
||||
"Spectator_T1_HL_Kavadonian_Nanites_Upgrade",
|
||||
"Spectator_T1_HL_Reinforced_Structures_L1_Upgrade",
|
||||
"Spectator_T1_HL_Reinforced_Structures_L2_Upgrade",
|
||||
"Spectator_T1_HL_Reinforced_Structures_L3_Upgrade",
|
||||
"Spectator_T1_HL_Enhanced_Turret_Firepower_L1_Upgrade",
|
||||
"Spectator_T1_HL_Enhanced_Turret_Firepower_L2_Upgrade",
|
||||
"Spectator_T1_HL_Enhanced_Turret_Firepower_L3_Upgrade"
|
||||
}
|
||||
|
||||
team_2_upgrades_list =
|
||||
{
|
||||
"Spectator_T2_HL_Shielded_Deployment_L1_Upgrade",
|
||||
"Spectator_T2_HL_Secure_Area_Upgrade",
|
||||
"Spectator_T2_HL_Kavadonian_Nanites_Upgrade",
|
||||
"Spectator_T2_HL_Reinforced_Structures_L1_Upgrade",
|
||||
"Spectator_T2_HL_Reinforced_Structures_L2_Upgrade",
|
||||
"Spectator_T2_HL_Reinforced_Structures_L3_Upgrade",
|
||||
"Spectator_T2_HL_Enhanced_Turret_Firepower_L1_Upgrade",
|
||||
"Spectator_T2_HL_Enhanced_Turret_Firepower_L2_Upgrade",
|
||||
"Spectator_T2_HL_Enhanced_Turret_Firepower_L3_Upgrade"
|
||||
}
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
spectator_player = Find_First_Object("Spectator_Reveal_Marker_Land")
|
||||
|
||||
if not spectator_player then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Get_Team() == 0 then
|
||||
for i, upgrade_name in pairs(team_1_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
else
|
||||
if Object.Get_Owner().Get_Team() == 1 then
|
||||
for i, upgrade_name in pairs(team_2_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,85 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/Despawn_Spectator_Upgrades_H_ShieldGen.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- Note: Script will check for multiple structures and abort if it finds any
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
Define_State("State_Init", State_Init);
|
||||
ServiceRate = 1.0
|
||||
|
||||
spectator_player = nil
|
||||
|
||||
team_1_upgrades_list =
|
||||
{
|
||||
"Spectator_T1_HL_Enhanced_Base_Shield_Upgrade"
|
||||
}
|
||||
|
||||
team_2_upgrades_list =
|
||||
{
|
||||
"Spectator_T2_HL_Enhanced_Base_Shield_Upgrade"
|
||||
}
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
spectator_player = Find_First_Object("Spectator_Reveal_Marker_Land")
|
||||
|
||||
if not spectator_player then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
shield_list_1 = Find_All_Objects_Of_Type("H_Ground_Base_Shield_740")
|
||||
for i, building in pairs(shield_list_1) do
|
||||
if TestValid(building) and building.Get_Owner().Get_Team() == Object.Get_Owner().Get_Team() then
|
||||
Object.Despawn()
|
||||
ScriptExit()
|
||||
end
|
||||
end
|
||||
shield_list_2 = Find_All_Objects_Of_Type("H_Ground_Base_Shield_370")
|
||||
for i, building in pairs(shield_list_2) do
|
||||
if TestValid(building) and building.Get_Owner().Get_Team() == Object.Get_Owner().Get_Team() then
|
||||
Object.Despawn()
|
||||
ScriptExit()
|
||||
end
|
||||
end
|
||||
shield_list_3 = Find_All_Objects_Of_Type("H_Ground_Base_Shield_740_Pad")
|
||||
for i, building in pairs(shield_list_3) do
|
||||
if TestValid(building) and building.Get_Owner().Get_Team() == Object.Get_Owner().Get_Team() then
|
||||
Object.Despawn()
|
||||
ScriptExit()
|
||||
end
|
||||
end
|
||||
shield_list_4 = Find_All_Objects_Of_Type("H_Ground_Base_Shield_370_Pad")
|
||||
for i, building in pairs(shield_list_4) do
|
||||
if TestValid(building) and building.Get_Owner().Get_Team() == Object.Get_Owner().Get_Team() then
|
||||
Object.Despawn()
|
||||
ScriptExit()
|
||||
end
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Get_Team() == 0 then
|
||||
for i, upgrade_name in pairs(team_1_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
else
|
||||
if Object.Get_Owner().Get_Team() == 1 then
|
||||
for i, upgrade_name in pairs(team_2_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Object.Despawn()
|
||||
ScriptExit()
|
||||
end
|
||||
@@ -0,0 +1,62 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/Despawn_Spectator_Upgrades_R_Barracks.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- Note: Script assumes only 1 structure is ever present
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
Define_State("State_Init", State_Init);
|
||||
ServiceRate = 1.0
|
||||
|
||||
spectator_player = nil
|
||||
|
||||
team_1_upgrades_list =
|
||||
{
|
||||
"Spectator_T1_RL_Combat_Armor_L1_Upgrade",
|
||||
"Spectator_T1_RL_Combat_Armor_L2_Upgrade",
|
||||
"Spectator_T1_RL_Combat_Armor_L3_Upgrade",
|
||||
"Spectator_T1_RL_Upgraded_Scopes_L1_Upgrade",
|
||||
"Spectator_T1_RL_Weatherproof_Upgrade"
|
||||
}
|
||||
|
||||
team_2_upgrades_list =
|
||||
{
|
||||
"Spectator_T2_RL_Combat_Armor_L1_Upgrade",
|
||||
"Spectator_T2_RL_Combat_Armor_L2_Upgrade",
|
||||
"Spectator_T2_RL_Combat_Armor_L3_Upgrade",
|
||||
"Spectator_T2_RL_Upgraded_Scopes_L1_Upgrade",
|
||||
"Spectator_T2_RL_Weatherproof_Upgrade"
|
||||
}
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
spectator_player = Find_First_Object("Spectator_Reveal_Marker_Land")
|
||||
|
||||
if not spectator_player then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Get_Team() == 0 then
|
||||
for i, upgrade_name in pairs(team_1_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
else
|
||||
if Object.Get_Owner().Get_Team() == 1 then
|
||||
for i, upgrade_name in pairs(team_2_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,64 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/Despawn_Spectator_Upgrades_R_CommandCenter.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- Note: Script assumes only 1 structure is ever present
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
Define_State("State_Init", State_Init);
|
||||
ServiceRate = 1.0
|
||||
|
||||
spectator_player = nil
|
||||
|
||||
team_1_upgrades_list =
|
||||
{
|
||||
"Spectator_T1_RC_Level_Two_Tech_Upgrade",
|
||||
"Spectator_T1_RC_Level_Three_Tech_Upgrade",
|
||||
"Spectator_T1_RC_Level_Four_Tech_Upgrade",
|
||||
"Spectator_T1_RC_Level_Five_Tech_Upgrade",
|
||||
"Spectator_T1_RL_Commerce_L1_Upgrade",
|
||||
"Spectator_T1_RL_Commerce_L2_Upgrade"
|
||||
}
|
||||
|
||||
team_2_upgrades_list =
|
||||
{
|
||||
"Spectator_T2_RC_Level_Two_Tech_Upgrade",
|
||||
"Spectator_T2_RC_Level_Three_Tech_Upgrade",
|
||||
"Spectator_T2_RC_Level_Four_Tech_Upgrade",
|
||||
"Spectator_T2_RC_Level_Five_Tech_Upgrade",
|
||||
"Spectator_T2_RL_Commerce_L1_Upgrade",
|
||||
"Spectator_T2_RL_Commerce_L2_Upgrade"
|
||||
}
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
spectator_player = Find_First_Object("Spectator_Reveal_Marker_Land")
|
||||
|
||||
if not spectator_player then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Get_Team() == 0 then
|
||||
for i, upgrade_name in pairs(team_1_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
else
|
||||
if Object.Get_Owner().Get_Team() == 1 then
|
||||
for i, upgrade_name in pairs(team_2_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,68 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/Despawn_Spectator_Upgrades_R_HeavyFactory.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- Note: Script assumes only 1 structure is ever present
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
Define_State("State_Init", State_Init);
|
||||
ServiceRate = 1.0
|
||||
|
||||
spectator_player = nil
|
||||
|
||||
team_1_upgrades_list =
|
||||
{
|
||||
"Spectator_T1_RL_Heavy_Armor_L1_Upgrade",
|
||||
"Spectator_T1_RL_Heavy_Armor_L2_Upgrade",
|
||||
"Spectator_T1_RL_Heavy_Armor_L3_Upgrade",
|
||||
"Spectator_T1_RL_Improved_Treads_L1_Upgrade",
|
||||
"Spectator_T1_RL_Improved_Treads_L2_Upgrade",
|
||||
"Spectator_T1_RL_Improved_Tank_Damage_L1_Upgrade",
|
||||
"Spectator_T1_RL_Experimental_Shielding_L1_Upgrade",
|
||||
"Spectator_T1_RL_Upgraded_Scopes_L2_Upgrade"
|
||||
}
|
||||
|
||||
team_2_upgrades_list =
|
||||
{
|
||||
"Spectator_T2_RL_Heavy_Armor_L1_Upgrade",
|
||||
"Spectator_T2_RL_Heavy_Armor_L2_Upgrade",
|
||||
"Spectator_T2_RL_Heavy_Armor_L3_Upgrade",
|
||||
"Spectator_T2_RL_Improved_Treads_L1_Upgrade",
|
||||
"Spectator_T2_RL_Improved_Treads_L2_Upgrade",
|
||||
"Spectator_T2_RL_Improved_Tank_Damage_L1_Upgrade",
|
||||
"Spectator_T2_RL_Experimental_Shielding_L1_Upgrade",
|
||||
"Spectator_T2_RL_Upgraded_Scopes_L2_Upgrade"
|
||||
}
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
spectator_player = Find_First_Object("Spectator_Reveal_Marker_Land")
|
||||
|
||||
if not spectator_player then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Get_Team() == 0 then
|
||||
for i, upgrade_name in pairs(team_1_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
else
|
||||
if Object.Get_Owner().Get_Team() == 1 then
|
||||
for i, upgrade_name in pairs(team_2_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,66 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/Despawn_Spectator_Upgrades_R_LightFactory.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- Note: Script assumes only 1 structure is ever present
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
Define_State("State_Init", State_Init);
|
||||
ServiceRate = 1.0
|
||||
|
||||
spectator_player = nil
|
||||
|
||||
team_1_upgrades_list =
|
||||
{
|
||||
"Spectator_T1_RL_Light_Shield_Regenerators_L1_Upgrade",
|
||||
"Spectator_T1_RL_Light_Shield_Regenerators_L2_Upgrade",
|
||||
"Spectator_T1_RL_Light_Aircraft_Armor_L1_Upgrade",
|
||||
"Spectator_T1_RL_Light_Aircraft_Armor_L2_Upgrade",
|
||||
"Spectator_T1_RL_Light_Aircraft_Armor_L3_Upgrade",
|
||||
"Spectator_T1_RL_Enhanced_Repulsors_L1_Upgrade",
|
||||
"Spectator_T1_RL_Enhanced_Repulsors_L2_Upgrade"
|
||||
}
|
||||
|
||||
team_2_upgrades_list =
|
||||
{
|
||||
"Spectator_T2_RL_Light_Shield_Regenerators_L1_Upgrade",
|
||||
"Spectator_T2_RL_Light_Shield_Regenerators_L2_Upgrade",
|
||||
"Spectator_T2_RL_Light_Aircraft_Armor_L1_Upgrade",
|
||||
"Spectator_T2_RL_Light_Aircraft_Armor_L2_Upgrade",
|
||||
"Spectator_T2_RL_Light_Aircraft_Armor_L3_Upgrade",
|
||||
"Spectator_T2_RL_Enhanced_Repulsors_L1_Upgrade",
|
||||
"Spectator_T2_RL_Enhanced_Repulsors_L2_Upgrade"
|
||||
}
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
spectator_player = Find_First_Object("Spectator_Reveal_Marker_Land")
|
||||
|
||||
if not spectator_player then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Get_Team() == 0 then
|
||||
for i, upgrade_name in pairs(team_1_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
else
|
||||
if Object.Get_Owner().Get_Team() == 1 then
|
||||
for i, upgrade_name in pairs(team_2_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,76 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/Despawn_Spectator_Upgrades_R_MiningFacility.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- Note: Script will check for multiple structures and abort if it finds any
|
||||
|
||||
require("PGStateMachine")
|
||||
require("PGBase")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
Define_State("State_Init", State_Init);
|
||||
ServiceRate = 1.0
|
||||
|
||||
spectator_player = nil
|
||||
|
||||
team_1_upgrades_list =
|
||||
{
|
||||
"Spectator_T1_RL_Increased_Production_L1_Upgrade",
|
||||
"Spectator_T1_RL_Increased_Production_L2_Upgrade",
|
||||
"Spectator_T1_RL_Increased_Production_L3_Upgrade"
|
||||
}
|
||||
|
||||
team_2_upgrades_list =
|
||||
{
|
||||
"Spectator_T2_RL_Increased_Production_L1_Upgrade",
|
||||
"Spectator_T2_RL_Increased_Production_L2_Upgrade",
|
||||
"Spectator_T2_RL_Increased_Production_L3_Upgrade"
|
||||
}
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
Sleep(0.5) --Required to properly find facilities
|
||||
facility_list = Find_All_Objects_Of_Type("Rebel_Ground_Mining_Facility")
|
||||
player_team = Object.Get_Owner().Get_Team()
|
||||
|
||||
for i, facility in pairs(facility_list) do
|
||||
if TestValid(facility) then
|
||||
facility_team = facility.Get_Owner().Get_Team()
|
||||
if player_team == facility_team then
|
||||
Object.Despawn()
|
||||
ScriptExit()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
spectator_player = Find_First_Object("Spectator_Reveal_Marker_Land")
|
||||
|
||||
if not spectator_player then
|
||||
Object.Despawn()
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Get_Team() == 0 then
|
||||
for i, upgrade_name in pairs(team_1_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
else
|
||||
if Object.Get_Owner().Get_Team() == 1 then
|
||||
for i, upgrade_name in pairs(team_2_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Object.Despawn()
|
||||
ScriptExit()
|
||||
end
|
||||
@@ -0,0 +1,66 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/Despawn_Spectator_Upgrades_R_ResearchFacility.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- Note: Script assumes only 1 structure is ever present
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
Define_State("State_Init", State_Init);
|
||||
ServiceRate = 1.0
|
||||
|
||||
spectator_player = nil
|
||||
|
||||
team_1_upgrades_list =
|
||||
{
|
||||
"Spectator_T1_RL_Reinforced_Structures_Upgrade",
|
||||
"Spectator_T1_RL_Enhanced_Turret_Defense_L1_Upgrade",
|
||||
"Spectator_T1_RL_Enhanced_Turret_Defense_L2_Upgrade",
|
||||
"Spectator_T1_RL_Enhanced_Turret_Defense_L3_Upgrade",
|
||||
"Spectator_T1_RL_More_Garrisons_L1_Upgrade",
|
||||
"Spectator_T1_RL_More_Garrisons_L2_Upgrade",
|
||||
"Spectator_T1_RL_More_Garrisons_L3_Upgrade"
|
||||
}
|
||||
|
||||
team_2_upgrades_list =
|
||||
{
|
||||
"Spectator_T2_RL_Reinforced_Structures_Upgrade",
|
||||
"Spectator_T2_RL_Enhanced_Turret_Defense_L1_Upgrade",
|
||||
"Spectator_T2_RL_Enhanced_Turret_Defense_L2_Upgrade",
|
||||
"Spectator_T2_RL_Enhanced_Turret_Defense_L3_Upgrade",
|
||||
"Spectator_T2_RL_More_Garrisons_L1_Upgrade",
|
||||
"Spectator_T2_RL_More_Garrisons_L2_Upgrade",
|
||||
"Spectator_T2_RL_More_Garrisons_L3_Upgrade"
|
||||
}
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
spectator_player = Find_First_Object("Spectator_Reveal_Marker_Land")
|
||||
|
||||
if not spectator_player then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Get_Team() == 0 then
|
||||
for i, upgrade_name in pairs(team_1_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
else
|
||||
if Object.Get_Owner().Get_Team() == 1 then
|
||||
for i, upgrade_name in pairs(team_2_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,85 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/Despawn_Spectator_Upgrades_R_ShieldGen.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- Note: Script will check for multiple structures and abort if it finds any
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
Define_State("State_Init", State_Init);
|
||||
ServiceRate = 1.0
|
||||
|
||||
spectator_player = nil
|
||||
|
||||
team_1_upgrades_list =
|
||||
{
|
||||
"Spectator_T1_RL_Enhanced_Base_Shield_Upgrade"
|
||||
}
|
||||
|
||||
team_2_upgrades_list =
|
||||
{
|
||||
"Spectator_T2_RL_Enhanced_Base_Shield_Upgrade"
|
||||
}
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
spectator_player = Find_First_Object("Spectator_Reveal_Marker_Land")
|
||||
|
||||
if not spectator_player then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
shield_list_1 = Find_All_Objects_Of_Type("R_Ground_Base_Shield_740")
|
||||
for i, building in pairs(shield_list_1) do
|
||||
if TestValid(building) and building.Get_Owner().Get_Team() == Object.Get_Owner().Get_Team() then
|
||||
Object.Despawn()
|
||||
ScriptExit()
|
||||
end
|
||||
end
|
||||
shield_list_2 = Find_All_Objects_Of_Type("R_Ground_Base_Shield_370")
|
||||
for i, building in pairs(shield_list_2) do
|
||||
if TestValid(building) and building.Get_Owner().Get_Team() == Object.Get_Owner().Get_Team() then
|
||||
Object.Despawn()
|
||||
ScriptExit()
|
||||
end
|
||||
end
|
||||
shield_list_3 = Find_All_Objects_Of_Type("R_Ground_Base_Shield_740_Pad")
|
||||
for i, building in pairs(shield_list_3) do
|
||||
if TestValid(building) and building.Get_Owner().Get_Team() == Object.Get_Owner().Get_Team() then
|
||||
Object.Despawn()
|
||||
ScriptExit()
|
||||
end
|
||||
end
|
||||
shield_list_4 = Find_All_Objects_Of_Type("R_Ground_Base_Shield_370_Pad")
|
||||
for i, building in pairs(shield_list_4) do
|
||||
if TestValid(building) and building.Get_Owner().Get_Team() == Object.Get_Owner().Get_Team() then
|
||||
Object.Despawn()
|
||||
ScriptExit()
|
||||
end
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Get_Team() == 0 then
|
||||
for i, upgrade_name in pairs(team_1_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
else
|
||||
if Object.Get_Owner().Get_Team() == 1 then
|
||||
for i, upgrade_name in pairs(team_2_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Object.Despawn()
|
||||
ScriptExit()
|
||||
end
|
||||
@@ -0,0 +1,64 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/Despawn_Spectator_Upgrades_U_Barracks.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- Note: Script assumes only 1 structure is ever present
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
Define_State("State_Init", State_Init);
|
||||
ServiceRate = 1.0
|
||||
|
||||
spectator_player = nil
|
||||
|
||||
team_1_upgrades_list =
|
||||
{
|
||||
"Spectator_T1_UL_Rancor_Stimulant_L1_Upgrade",
|
||||
"Spectator_T1_UL_Rancor_Stimulant_L2_Upgrade",
|
||||
"Spectator_T1_UL_Ability_Recharge_L1_Upgrade",
|
||||
"Spectator_T1_UL_Ability_Recharge_L2_Upgrade",
|
||||
"Spectator_T1_UL_Selective_Breeding_L1_Upgrade",
|
||||
"Spectator_T1_UL_Selective_Breeding_L2_Upgrade"
|
||||
}
|
||||
|
||||
team_2_upgrades_list =
|
||||
{
|
||||
"Spectator_T2_UL_Rancor_Stimulant_L1_Upgrade",
|
||||
"Spectator_T2_UL_Rancor_Stimulant_L2_Upgrade",
|
||||
"Spectator_T2_UL_Ability_Recharge_L1_Upgrade",
|
||||
"Spectator_T2_UL_Ability_Recharge_L2_Upgrade",
|
||||
"Spectator_T2_UL_Selective_Breeding_L1_Upgrade",
|
||||
"Spectator_T2_UL_Selective_Breeding_L2_Upgrade"
|
||||
}
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
spectator_player = Find_First_Object("Spectator_Reveal_Marker_Land")
|
||||
|
||||
if not spectator_player then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Get_Team() == 0 then
|
||||
for i, upgrade_name in pairs(team_1_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
else
|
||||
if Object.Get_Owner().Get_Team() == 1 then
|
||||
for i, upgrade_name in pairs(team_2_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,70 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/Despawn_Spectator_Upgrades_U_CommandCenter.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- Note: Script assumes only 1 structure is ever present
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
Define_State("State_Init", State_Init);
|
||||
ServiceRate = 1.0
|
||||
|
||||
spectator_player = nil
|
||||
|
||||
team_1_upgrades_list =
|
||||
{
|
||||
"Spectator_T1_UC_Level_Two_Tech_Upgrade",
|
||||
"Spectator_T1_UC_Level_Three_Tech_Upgrade",
|
||||
"Spectator_T1_UC_Level_Four_Tech_Upgrade",
|
||||
"Spectator_T1_UC_Level_Five_Tech_Upgrade",
|
||||
"Spectator_T1_UL_Black_Market_Shielding_L1_Upgrade",
|
||||
"Spectator_T1_UL_Black_Market_Shielding_L2_Upgrade",
|
||||
"Spectator_T1_UL_Enhanced_Deployment_L1_Upgrade",
|
||||
"Spectator_T1_UL_Enhanced_Deployment_L2_Upgrade",
|
||||
"Spectator_T1_UL_Bounty_Upgrade"
|
||||
}
|
||||
|
||||
team_2_upgrades_list =
|
||||
{
|
||||
"Spectator_T2_UC_Level_Two_Tech_Upgrade",
|
||||
"Spectator_T2_UC_Level_Three_Tech_Upgrade",
|
||||
"Spectator_T2_UC_Level_Four_Tech_Upgrade",
|
||||
"Spectator_T2_UC_Level_Five_Tech_Upgrade",
|
||||
"Spectator_T2_UL_Black_Market_Shielding_L1_Upgrade",
|
||||
"Spectator_T2_UL_Black_Market_Shielding_L2_Upgrade",
|
||||
"Spectator_T2_UL_Enhanced_Deployment_L1_Upgrade",
|
||||
"Spectator_T2_UL_Enhanced_Deployment_L2_Upgrade",
|
||||
"Spectator_T2_UL_Bounty_Upgrade"
|
||||
}
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
spectator_player = Find_First_Object("Spectator_Reveal_Marker_Land")
|
||||
|
||||
if not spectator_player then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Get_Team() == 0 then
|
||||
for i, upgrade_name in pairs(team_1_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
else
|
||||
if Object.Get_Owner().Get_Team() == 1 then
|
||||
for i, upgrade_name in pairs(team_2_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,68 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/Despawn_Spectator_Upgrades_U_DroidWorks.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- Note: Script assumes only 1 structure is ever present
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
Define_State("State_Init", State_Init);
|
||||
ServiceRate = 1.0
|
||||
|
||||
spectator_player = nil
|
||||
|
||||
team_1_upgrades_list =
|
||||
{
|
||||
"Spectator_T1_UL_Smuggled_Droid_Systems_L1_Upgrade",
|
||||
"Spectator_T1_UL_Smuggled_Droid_Systems_L2_Upgrade",
|
||||
"Spectator_T1_UL_Improved_Chipsets_L1_Upgrade",
|
||||
"Spectator_T1_UL_Improved_Chipsets_L2_Upgrade",
|
||||
"Spectator_T1_UL_Improved_Hydraulics_L1_Upgrade",
|
||||
"Spectator_T1_UL_Improved_Hydraulics_L2_Upgrade",
|
||||
"Spectator_T1_UL_FCU_Reactors_L1_Upgrade",
|
||||
"Spectator_T1_UL_FCU_Armor_Plating_L1_Upgrade"
|
||||
}
|
||||
|
||||
team_2_upgrades_list =
|
||||
{
|
||||
"Spectator_T2_UL_Smuggled_Droid_Systems_L1_Upgrade",
|
||||
"Spectator_T2_UL_Smuggled_Droid_Systems_L2_Upgrade",
|
||||
"Spectator_T2_UL_Improved_Chipsets_L1_Upgrade",
|
||||
"Spectator_T2_UL_Improved_Chipsets_L2_Upgrade",
|
||||
"Spectator_T2_UL_Improved_Hydraulics_L1_Upgrade",
|
||||
"Spectator_T2_UL_Improved_Hydraulics_L2_Upgrade",
|
||||
"Spectator_T2_UL_FCU_Reactors_L1_Upgrade",
|
||||
"Spectator_T2_UL_FCU_Armor_Plating_L1_Upgrade"
|
||||
}
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
spectator_player = Find_First_Object("Spectator_Reveal_Marker_Land")
|
||||
|
||||
if not spectator_player then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Get_Team() == 0 then
|
||||
for i, upgrade_name in pairs(team_1_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
else
|
||||
if Object.Get_Owner().Get_Team() == 1 then
|
||||
for i, upgrade_name in pairs(team_2_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,64 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/Despawn_Spectator_Upgrades_U_Factory.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- Note: Script assumes only 1 structure is ever present
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
Define_State("State_Init", State_Init);
|
||||
ServiceRate = 1.0
|
||||
|
||||
spectator_player = nil
|
||||
|
||||
team_1_upgrades_list =
|
||||
{
|
||||
"Spectator_T1_UL_Weapon_Boost_L1_Upgrade",
|
||||
"Spectator_T1_UL_Weapon_Boost_L2_Upgrade",
|
||||
"Spectator_T1_UL_Heavy_Shielding_L1_Upgrade",
|
||||
"Spectator_T1_UL_Heavy_Shielding_L2_Upgrade",
|
||||
"Spectator_T1_UL_Cloaking_Generator_L1_Upgrade",
|
||||
"Spectator_T1_UL_Cloaking_Generator_L2_Upgrade"
|
||||
}
|
||||
|
||||
team_2_upgrades_list =
|
||||
{
|
||||
"Spectator_T2_UL_Weapon_Boost_L1_Upgrade",
|
||||
"Spectator_T2_UL_Weapon_Boost_L2_Upgrade",
|
||||
"Spectator_T2_UL_Heavy_Shielding_L1_Upgrade",
|
||||
"Spectator_T2_UL_Heavy_Shielding_L2_Upgrade",
|
||||
"Spectator_T2_UL_Cloaking_Generator_L1_Upgrade",
|
||||
"Spectator_T2_UL_Cloaking_Generator_L2_Upgrade"
|
||||
}
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
spectator_player = Find_First_Object("Spectator_Reveal_Marker_Land")
|
||||
|
||||
if not spectator_player then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Get_Team() == 0 then
|
||||
for i, upgrade_name in pairs(team_1_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
else
|
||||
if Object.Get_Owner().Get_Team() == 1 then
|
||||
for i, upgrade_name in pairs(team_2_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,76 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/Despawn_Spectator_Upgrades_U_MiningFacility.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- Note: Script will check for multiple structures and abort if it finds any
|
||||
|
||||
require("PGStateMachine")
|
||||
require("PGBase")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
Define_State("State_Init", State_Init);
|
||||
ServiceRate = 1.0
|
||||
|
||||
spectator_player = nil
|
||||
|
||||
team_1_upgrades_list =
|
||||
{
|
||||
"Spectator_T1_UL_Extort_Cash_L1_Upgrade",
|
||||
"Spectator_T1_UL_Extort_Cash_L2_Upgrade",
|
||||
"Spectator_T1_UL_Extort_Cash_L3_Upgrade"
|
||||
}
|
||||
|
||||
team_2_upgrades_list =
|
||||
{
|
||||
"Spectator_T2_UL_Extort_Cash_L1_Upgrade",
|
||||
"Spectator_T2_UL_Extort_Cash_L2_Upgrade",
|
||||
"Spectator_T2_UL_Extort_Cash_L3_Upgrade"
|
||||
}
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
Sleep(0.5) --Required to properly find facilities
|
||||
facility_list = Find_All_Objects_Of_Type("Underworld_Ground_Mining_Facility")
|
||||
player_team = Object.Get_Owner().Get_Team()
|
||||
|
||||
for i, facility in pairs(facility_list) do
|
||||
if TestValid(facility) then
|
||||
facility_team = facility.Get_Owner().Get_Team()
|
||||
if player_team == facility_team then
|
||||
Object.Despawn()
|
||||
ScriptExit()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
spectator_player = Find_First_Object("Spectator_Reveal_Marker_Land")
|
||||
|
||||
if not spectator_player then
|
||||
Object.Despawn()
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Get_Team() == 0 then
|
||||
for i, upgrade_name in pairs(team_1_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
else
|
||||
if Object.Get_Owner().Get_Team() == 1 then
|
||||
for i, upgrade_name in pairs(team_2_upgrades_list) do
|
||||
local upgrade = Find_First_Object(upgrade_name)
|
||||
if TestValid(upgrade) then
|
||||
upgrade.Despawn()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Object.Despawn()
|
||||
ScriptExit()
|
||||
end
|
||||
168
DATA/SCRIPTS/GAMEOBJECT/DISPLAY_SPECTATORCREDITS.LUA
Normal file
168
DATA/SCRIPTS/GAMEOBJECT/DISPLAY_SPECTATORCREDITS.LUA
Normal file
@@ -0,0 +1,168 @@
|
||||
-- This script is attached to the reveal marker present for team 3 of [Tournament] maps
|
||||
-- Created by Lany#9464 and Galyana#3315 on Discord
|
||||
|
||||
require("PGStateMachine")
|
||||
require("PGBase")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
ServiceRate = 1.0
|
||||
Define_State("State_Init", State_Init);
|
||||
|
||||
human_spectator_players = {}
|
||||
spectator_is_present = false
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
Object.Suspend_Locomotor(true)
|
||||
Sleep(2) -- generous sleep to allow for spawning of starting units
|
||||
|
||||
primary_spectator_player = Object.Get_Owner()
|
||||
if TestValid(primary_spectator_player) then
|
||||
if primary_spectator_player.Is_Human() then
|
||||
spectator_is_present = true
|
||||
addToSet(human_spectator_players, primary_spectator_player)
|
||||
-- TODO for a later stage: Figure out how to find multiple spectator players
|
||||
else
|
||||
DebugMessage("-- Info: Marker Owner Spectator Player is not human, exiting.")
|
||||
ScriptExit()
|
||||
end
|
||||
else
|
||||
DebugMessage("-- ERROR: Marker Owner Spectator Player is not valid! Exiting.")
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
team_one_players = Get_All_Players_Of_Team(0)
|
||||
team_two_players = Get_All_Players_Of_Team(1)
|
||||
DebugMessage("-- INFO: team_one_players contains %s entries", tostring(setSize(team_one_players)))
|
||||
DebugMessage("-- INFO: team_two_players contains %s entries", tostring(setSize(team_two_players)))
|
||||
end
|
||||
|
||||
if message == OnUpdate then
|
||||
Update_Credits_Display() -- Sync version
|
||||
end
|
||||
end
|
||||
|
||||
-- Gets all player objects of 'faction' via cycling the Space starting units of it and collecting the owners
|
||||
-- returns a set (!) of player objects or nil if the faction is unknown
|
||||
function Get_All_Players(faction)
|
||||
DebugMessage("%s -- Entering Get_All_Players", tostring(Script))
|
||||
local players = {}
|
||||
local space_starting_unit_name = nil
|
||||
|
||||
if faction == "Rebel" then
|
||||
space_starting_unit_name = "Rebel_X-Wing_Squadron" -- Squadron works if no specified container
|
||||
elseif faction == "Empire" then
|
||||
space_starting_unit_name = "TIE_Interceptor_Squadron_Container"
|
||||
elseif faction == "Underworld" then
|
||||
space_starting_unit_name = "StarViper_Team"
|
||||
elseif faction == "Hutts" then
|
||||
space_starting_unit_name = "V_Wing_Squadron_Container"
|
||||
elseif faction == "Pirates" then
|
||||
space_starting_unit_name = "Pirate_Fighter_Squadron"
|
||||
end
|
||||
|
||||
if space_starting_unit_name ~= nil then -- TODO this could be made more elegant with getting the match setting
|
||||
for i, unit in pairs(Find_All_Objects_Of_Type(space_starting_unit_name)) do -- space starting unit
|
||||
addToSet(players, unit.Get_Owner())
|
||||
end
|
||||
else
|
||||
DebugMessage("-- WARNING: Called Get_All_Players with an unknown faction parameter: %s", tostring(faction))
|
||||
return nil
|
||||
end
|
||||
|
||||
return players
|
||||
end
|
||||
|
||||
-- Gets all players of a Team, by using Get_All_Players to find all players in the game and then filter for the queried team
|
||||
-- team_id is a number
|
||||
function Get_All_Players_Of_Team(team_id)
|
||||
DebugMessage("%s -- Entering Get_All_Players_Of_Team for team %s", tostring(Script), tostring(team_id))
|
||||
|
||||
found_players = {} -- set
|
||||
|
||||
factions = {"Rebel", "Empire", "Underworld", "Hutts", "Pirates"}
|
||||
faction_detected = false -- All players of a team will have the same faction, we can exit early
|
||||
|
||||
for key, faction in pairs(factions) do
|
||||
-- early exit if the faction was already detected
|
||||
if faction_detected then
|
||||
return found_players
|
||||
end
|
||||
-- query the faction for it's starting units and then the owners for their team id
|
||||
players = Get_All_Players(faction)
|
||||
if players ~= nil then
|
||||
for player, val in players do
|
||||
if TestValid(player) then
|
||||
DebugMessage("-- Found player %s of team %s", tostring(player), tostring(player.Get_Team()))
|
||||
if player.Get_Team() == team_id then
|
||||
DebugMessage("-- Adding player to list for team %s", tostring(team_id))
|
||||
addToSet(found_players, player)
|
||||
end
|
||||
else
|
||||
DebugMessage("-- ERROR: player not valid")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return found_players
|
||||
end
|
||||
|
||||
-- Update the spectator player's credit display to show the rebel and empire player's respective funds
|
||||
-- TODO modify to work for all spectator players
|
||||
function Update_Credits_Display()
|
||||
if spectator_is_present then
|
||||
local team_1_credits = 0
|
||||
local team_2_credits = 0
|
||||
|
||||
for player,x in team_one_players do
|
||||
team_1_credits = team_1_credits + player.Get_Credits()
|
||||
end
|
||||
|
||||
for player,x in team_two_players do
|
||||
team_2_credits = team_2_credits + player.Get_Credits()
|
||||
end
|
||||
|
||||
-- format team 1 credits (cut Ones)
|
||||
local team_1_credits = tonumber(Dirty_Floor(team_1_credits / 10))
|
||||
local team_1_credits = Clamp(team_1_credits, 0, 999)
|
||||
|
||||
-- format team 2 credits (cut Ones)
|
||||
local team_2_credits = tonumber(Dirty_Floor(team_2_credits / 10))
|
||||
local team_2_credits = Clamp(team_2_credits, 0, 999)
|
||||
|
||||
-- update spectator credits display ([Team]111,[Team]222)
|
||||
local new_spectator_credits = team_1_credits * 1000
|
||||
local new_spectator_credits = new_spectator_credits + team_2_credits
|
||||
|
||||
for player,x in human_spectator_players do
|
||||
local old_credits = player.Get_Credits()
|
||||
player.Give_Money(-old_credits) -- at 0 credits now
|
||||
player.Give_Money(new_spectator_credits)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Set data type utility functions
|
||||
-- a Set is a special use of a table where arbitrary keys always have the vale nil or true
|
||||
-- loop usage: for key,unused in set do
|
||||
function addToSet(set, key)
|
||||
set[key] = true
|
||||
end
|
||||
|
||||
function removeFromSet(set, key)
|
||||
set[key] = nil
|
||||
end
|
||||
|
||||
function setContains(set, key)
|
||||
return set[key] ~= nil
|
||||
end
|
||||
|
||||
function setSize(set)
|
||||
local i = 0
|
||||
for key, value in pairs(set) do
|
||||
i = i + 1
|
||||
end
|
||||
return i
|
||||
end
|
||||
168
DATA/SCRIPTS/GAMEOBJECT/DISPLAY_SPECTATORCREDITS_LAND.LUA
Normal file
168
DATA/SCRIPTS/GAMEOBJECT/DISPLAY_SPECTATORCREDITS_LAND.LUA
Normal file
@@ -0,0 +1,168 @@
|
||||
-- This script is attached to the reveal marker present for team 3 of [Tournament] maps
|
||||
-- Created by Lany#9464 and Galyana#3315 on Discord
|
||||
|
||||
require("PGStateMachine")
|
||||
require("PGBase")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
ServiceRate = 1.0
|
||||
Define_State("State_Init", State_Init);
|
||||
|
||||
human_spectator_players = {}
|
||||
spectator_is_present = false
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
Object.Suspend_Locomotor(true)
|
||||
Sleep(2) -- generous sleep to allow for spawning of starting units
|
||||
|
||||
primary_spectator_player = Object.Get_Owner()
|
||||
if TestValid(primary_spectator_player) then
|
||||
if primary_spectator_player.Is_Human() then
|
||||
spectator_is_present = true
|
||||
addToSet(human_spectator_players, primary_spectator_player)
|
||||
-- TODO for a later stage: Figure out how to find multiple spectator players
|
||||
else
|
||||
DebugMessage("-- Info: Marker Owner Spectator Player is not human, exiting.")
|
||||
ScriptExit()
|
||||
end
|
||||
else
|
||||
DebugMessage("-- ERROR: Marker Owner Spectator Player is not valid! Exiting.")
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
team_one_players = Get_All_Players_Of_Team(0)
|
||||
team_two_players = Get_All_Players_Of_Team(1)
|
||||
DebugMessage("-- INFO: team_one_players contains %s entries", tostring(setSize(team_one_players)))
|
||||
DebugMessage("-- INFO: team_two_players contains %s entries", tostring(setSize(team_two_players)))
|
||||
end
|
||||
|
||||
if message == OnUpdate then
|
||||
Update_Credits_Display() -- Sync version
|
||||
end
|
||||
end
|
||||
|
||||
-- Gets all player objects of 'faction' via cycling the Land starting units of it and collecting the owners
|
||||
-- returns a set (!) of player objects or nil if the faction is unknown
|
||||
function Get_All_Players(faction)
|
||||
DebugMessage("%s -- Entering Get_All_Players", tostring(Script))
|
||||
local players = {}
|
||||
local land_starting_unit_name = nil
|
||||
|
||||
if faction == "Rebel" then
|
||||
land_starting_unit_name = "Rebel_Trooper_Team"
|
||||
elseif faction == "Empire" then
|
||||
land_starting_unit_name = "Stormtrooper_Team"
|
||||
elseif faction == "Underworld" then
|
||||
land_starting_unit_name = "Underworld_Merc_Team"
|
||||
elseif faction == "Hutts" then
|
||||
land_starting_unit_name = "Hutt_Soldier_Team"
|
||||
elseif faction == "Pirates" then
|
||||
land_starting_unit_name = "Pirate_Trooper_Team"
|
||||
end
|
||||
|
||||
if land_starting_unit_name ~= nil then -- TODO this could be made more elegant with getting the match setting
|
||||
for i, unit in pairs(Find_All_Objects_Of_Type(land_starting_unit_name)) do -- land starting unit
|
||||
addToSet(players, unit.Get_Owner())
|
||||
end
|
||||
else
|
||||
DebugMessage("-- WARNING: Called Get_All_Players with an unknown faction parameter: %s", tostring(faction))
|
||||
return nil
|
||||
end
|
||||
|
||||
return players
|
||||
end
|
||||
|
||||
-- Gets all players of a Team, by using Get_All_Players to find all players in the game and then filter for the queried team
|
||||
-- team_id is a number
|
||||
function Get_All_Players_Of_Team(team_id)
|
||||
DebugMessage("%s -- Entering Get_All_Players_Of_Team for team %s", tostring(Script), tostring(team_id))
|
||||
|
||||
found_players = {} -- set
|
||||
|
||||
factions = {"Rebel", "Empire", "Underworld", "Hutts", "Pirates"}
|
||||
faction_detected = false -- All players of a team will have the same faction, we can exit early
|
||||
|
||||
for key, faction in pairs(factions) do
|
||||
-- early exit if the faction was already detected
|
||||
if faction_detected then
|
||||
return found_players
|
||||
end
|
||||
-- query the faction for it's starting units and then the owners for their team id
|
||||
players = Get_All_Players(faction)
|
||||
if players ~= nil then
|
||||
for player, val in players do
|
||||
if TestValid(player) then
|
||||
DebugMessage("-- Found player %s of team %s", tostring(player), tostring(player.Get_Team()))
|
||||
if player.Get_Team() == team_id then
|
||||
DebugMessage("-- Adding player to list for team %s", tostring(team_id))
|
||||
addToSet(found_players, player)
|
||||
end
|
||||
else
|
||||
DebugMessage("-- ERROR: player not valid")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return found_players
|
||||
end
|
||||
|
||||
-- Update the spectator player's credit display to show the rebel and empire player's respective funds
|
||||
-- TODO modify to work for all spectator players
|
||||
function Update_Credits_Display()
|
||||
if spectator_is_present then
|
||||
local team_1_credits = 0
|
||||
local team_2_credits = 0
|
||||
|
||||
for player,x in team_one_players do
|
||||
team_1_credits = team_1_credits + player.Get_Credits()
|
||||
end
|
||||
|
||||
for player,x in team_two_players do
|
||||
team_2_credits = team_2_credits + player.Get_Credits()
|
||||
end
|
||||
|
||||
-- format team 1 credits (cut Ones)
|
||||
local team_1_credits = tonumber(Dirty_Floor(team_1_credits / 10))
|
||||
local team_1_credits = Clamp(team_1_credits, 0, 999)
|
||||
|
||||
-- format team 2 credits (cut Ones)
|
||||
local team_2_credits = tonumber(Dirty_Floor(team_2_credits / 10))
|
||||
local team_2_credits = Clamp(team_2_credits, 0, 999)
|
||||
|
||||
-- update spectator credits display ([Team]111,[Team]222)
|
||||
local new_spectator_credits = team_1_credits * 1000
|
||||
local new_spectator_credits = new_spectator_credits + team_2_credits
|
||||
|
||||
for player,x in human_spectator_players do
|
||||
local old_credits = player.Get_Credits()
|
||||
player.Give_Money(-old_credits) -- at 0 credits now
|
||||
player.Give_Money(new_spectator_credits)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Set data type utility functions
|
||||
-- a Set is a special use of a table where arbitrary keys always have the vale nil or true
|
||||
-- loop usage: for key,unused in set do
|
||||
function addToSet(set, key)
|
||||
set[key] = true
|
||||
end
|
||||
|
||||
function removeFromSet(set, key)
|
||||
set[key] = nil
|
||||
end
|
||||
|
||||
function setContains(set, key)
|
||||
return set[key] ~= nil
|
||||
end
|
||||
|
||||
function setSize(set)
|
||||
local i = 0
|
||||
for key, value in pairs(set) do
|
||||
i = i + 1
|
||||
end
|
||||
return i
|
||||
end
|
||||
51
DATA/SCRIPTS/GAMEOBJECT/DISPLAY_SPECTATORUPGRADES.LUA
Normal file
51
DATA/SCRIPTS/GAMEOBJECT/DISPLAY_SPECTATORUPGRADES.LUA
Normal file
@@ -0,0 +1,51 @@
|
||||
-- Spectator upgrade display for SoaFE
|
||||
-- spawns the appropriate dummy upgrade for the Spectator Faction
|
||||
-- Is attached to a proper Upgrade, and will be activated when that Upgrade is activated (completes building)
|
||||
--
|
||||
-- Revision: 1.1 - Date: 2022/04/10
|
||||
--
|
||||
-- Authors: Nikomer (Nikomer#1313 on Discord) | Revision by Galyana
|
||||
--
|
||||
-- REQUIRES:
|
||||
-- - the following XML tag be added to all pertinent Upgrade Objects:
|
||||
-- <Lua_Script>Display_SpectatorUpgrades</Lua_Script>
|
||||
|
||||
require("PGStateMachine")
|
||||
require("PGBase")
|
||||
require("PGSpawnUnits")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
Define_State("State_Init", State_Init);
|
||||
ServiceRate = 1.0
|
||||
|
||||
spectator_player = nil
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
spectator_player = Find_First_Object("Spectator_Reveal_Marker") --.Get_Owner()
|
||||
|
||||
if not spectator_player then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if spectator_player then
|
||||
spectator_player = Find_First_Object("Spectator_Reveal_Marker").Get_Owner()
|
||||
end
|
||||
|
||||
-- if TestValid(spectator_player) then
|
||||
-- DebugMessage("-- Found primary spectator player %s.", tostring(spectator_player))
|
||||
-- else
|
||||
-- DebugMessage("-- ERROR: Did not find primary spectator player, exiting script.")
|
||||
-- ScriptExit()
|
||||
-- end
|
||||
|
||||
local owner_team = Object.Get_Owner().Get_Team() + 1
|
||||
local upgrade_name = "Spectator_T" .. owner_team .. "_" .. Object.Get_Type().Get_Name()
|
||||
|
||||
DebugMessage("-- Spawning Spectator dummy upgrade: %s", upgrade_name)
|
||||
Create_Generic_Object(upgrade_name, Object.Get_Position(), spectator_player)
|
||||
end
|
||||
ScriptExit()
|
||||
end
|
||||
51
DATA/SCRIPTS/GAMEOBJECT/DISPLAY_SPECTATORUPGRADES_LAND.LUA
Normal file
51
DATA/SCRIPTS/GAMEOBJECT/DISPLAY_SPECTATORUPGRADES_LAND.LUA
Normal file
@@ -0,0 +1,51 @@
|
||||
-- Spectator upgrade display for SoaFE
|
||||
-- spawns the appropriate dummy upgrade for the Spectator Faction
|
||||
-- Is attached to a proper Upgrade, and will be activated when that Upgrade is activated (completes building)
|
||||
--
|
||||
-- Revision: 1.1 - Date: 2022/04/10
|
||||
--
|
||||
-- Authors: Nikomer (Nikomer#1313 on Discord) | Revision by Galyana
|
||||
--
|
||||
-- REQUIRES:
|
||||
-- - the following XML tag be added to all pertinent Upgrade Objects:
|
||||
-- <Lua_Script>Display_SpectatorUpgrades</Lua_Script>
|
||||
|
||||
require("PGStateMachine")
|
||||
require("PGBase")
|
||||
require("PGSpawnUnits")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
Define_State("State_Init", State_Init);
|
||||
ServiceRate = 1.0
|
||||
|
||||
spectator_player = nil
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
spectator_player = Find_First_Object("Spectator_Reveal_Marker_Land") --.Get_Owner()
|
||||
|
||||
if not spectator_player then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if spectator_player then
|
||||
spectator_player = Find_First_Object("Spectator_Reveal_Marker_Land").Get_Owner()
|
||||
end
|
||||
|
||||
-- if TestValid(spectator_player) then
|
||||
-- DebugMessage("-- Found primary spectator player %s.", tostring(spectator_player))
|
||||
-- else
|
||||
-- DebugMessage("-- ERROR: Did not find primary spectator player, exiting script.")
|
||||
-- ScriptExit()
|
||||
-- end
|
||||
|
||||
local owner_team = Object.Get_Owner().Get_Team() + 1
|
||||
local upgrade_name = "Spectator_T" .. owner_team .. "_" .. Object.Get_Type().Get_Name()
|
||||
|
||||
DebugMessage("-- Spawning Spectator dummy upgrade: %s", upgrade_name)
|
||||
Create_Generic_Object(upgrade_name, Object.Get_Position(), spectator_player)
|
||||
end
|
||||
ScriptExit()
|
||||
end
|
||||
105
DATA/SCRIPTS/GAMEOBJECT/E3_FELUCIA_ZONE.LUA
Normal file
105
DATA/SCRIPTS/GAMEOBJECT/E3_FELUCIA_ZONE.LUA
Normal file
@@ -0,0 +1,105 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/E3_Felucia_Zone.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/E3_Felucia_Zone.lua $
|
||||
--
|
||||
-- Original Author: Jeff_Stewart
|
||||
--
|
||||
-- $Author: Brian_Hayes $
|
||||
--
|
||||
-- $Change: 637819 $
|
||||
--
|
||||
-- $DateTime: 2017/03/22 10:16:16 $
|
||||
--
|
||||
-- $Revision: #1 $
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
require("PGStateMachine")
|
||||
require("PGSpawnUnits")
|
||||
|
||||
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);
|
||||
end
|
||||
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
-- Register a prox event that looks for any nearby units
|
||||
empire_player = Find_Player("Empire")
|
||||
underworld_player = Find_Player("Underworld")
|
||||
reinforce_list = {
|
||||
"Imperial_Stormtrooper_Squad"
|
||||
}
|
||||
Register_Prox(Object, Reinforce_Point, 50, underworld_player)
|
||||
elseif message == OnUpdate then
|
||||
--Do Nothing
|
||||
elseif message == OnExit then
|
||||
end
|
||||
end
|
||||
|
||||
function Reinforce_Point()
|
||||
--This function tests whether tyber zann is close to the landing platform
|
||||
--if so, we drop off a few stormtroopers, if not set the timer a little shorter
|
||||
--so that we check again earlier
|
||||
Object.Play_SFX_Event("SFX_UMP_EmpireKesselAlarm")
|
||||
--function ReinforceList(type_list, entry_marker, player, allow_ai_usage, delete_after_scenario, ignore_reinforcement_rules, callback)
|
||||
--ReinforceList(reinforce_list, Object, empire_player, false, true, true, Find_And_Attack)
|
||||
|
||||
player_unit_list = Find_All_Objects_Of_Type(empire_player)
|
||||
closest_infantry = Find_Nearest(Object, underworld_player, true)
|
||||
area = closest_infantry.Get_Position()
|
||||
|
||||
for i, player_unit in pairs(player_unit_list) do
|
||||
if TestValid(player_unit) then
|
||||
--MessageBox("Player_Back_To_Vulnerable")
|
||||
player_unit.Attack_Move(area)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Find_And_Attack(attack_list)
|
||||
--This function is passed to every unloaded storm trooper squad
|
||||
--the squads look for tyber's location and attack move towards it
|
||||
closest_infantry = Find_Nearest(Object, underworld_player, true)
|
||||
--tyber_zann=Find_First_Object("TYBER_ZANN")
|
||||
area = closest_infantry.Get_Position()
|
||||
for k, unit in pairs(attack_list) do
|
||||
if TestValid(unit) then
|
||||
if TestValid(closest_infantry) then
|
||||
unit.Attack_Move(area)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
72
DATA/SCRIPTS/GAMEOBJECT/FIELDCOMMANDER.LUA
Normal file
72
DATA/SCRIPTS/GAMEOBJECT/FIELDCOMMANDER.LUA
Normal file
@@ -0,0 +1,72 @@
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
-- (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/GameObject/FieldCommander.LUA
|
||||
--
|
||||
-- Original Editor: Giovanni Galyana
|
||||
--
|
||||
-- Final Edit By: Giovanni Galyana
|
||||
--
|
||||
-- Date: 05 January, 2014
|
||||
--
|
||||
-- Revisions: 0
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
require("HeroPlanAttach")
|
||||
|
||||
-- Tell the script pooling system to pre-cache this number of scripts.
|
||||
ScriptPoolCount = 4
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
|
||||
-- only join plans that meet our expense requirements.
|
||||
MinPlanAttachCost = 2000
|
||||
MaxPlanAttachCost = 0
|
||||
|
||||
-- Commander hit list.
|
||||
Attack_Ability_Type_Names = {
|
||||
"Infantry", "Vehicle", "Air", -- Attack these types.
|
||||
"Bounty_Hunter_Team_E", "Bounty_Hunter_Team_R" -- Stay away from these types.
|
||||
}
|
||||
Attack_Ability_Weights = {
|
||||
1, 1, 1, -- attack type weights.
|
||||
BAD_WEIGHT, BAD_WEIGHT -- feared type weights.
|
||||
}
|
||||
Attack_Ability_Types = WeightedTypeList.Create()
|
||||
Attack_Ability_Types.Parse(Attack_Ability_Type_Names, Attack_Ability_Weights)
|
||||
|
||||
-- Prefer task forces with these units.
|
||||
Escort_Ability_Type_Names = { "Infantry", "Vehicle", "Air", "Field_Com_Rebel_Team", "Field_Com_Empire_Team", "Field_Com_Hutts_Team" }
|
||||
Escort_Ability_Weights = { 10, 10, 10, BAD_WEIGHT, BAD_WEIGHT, BAD_WEIGHT }
|
||||
Escort_Ability_Types = WeightedTypeList.Create()
|
||||
Escort_Ability_Types.Parse(Escort_Ability_Type_Names, Escort_Ability_Weights)
|
||||
end
|
||||
|
||||
function Evaluate_Attack_Ability(target, goal)
|
||||
return Get_Target_Weight(target, Attack_Ability_Types, Attack_Ability_Weights)
|
||||
end
|
||||
|
||||
function Get_Escort_Ability_Weights(goal)
|
||||
return Escort_Ability_Types
|
||||
end
|
||||
|
||||
function HeroService()
|
||||
|
||||
end
|
||||
83
DATA/SCRIPTS/GAMEOBJECT/FLEETCOMMANDER.LUA
Normal file
83
DATA/SCRIPTS/GAMEOBJECT/FLEETCOMMANDER.LUA
Normal file
@@ -0,0 +1,83 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/FleetCommander.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/FleetCommander.lua $
|
||||
--
|
||||
-- Original Author: Brian Hayes
|
||||
--
|
||||
-- $Author: Brian_Hayes $
|
||||
--
|
||||
-- $Change: 637819 $
|
||||
--
|
||||
-- $DateTime: 2017/03/22 10:16:16 $
|
||||
--
|
||||
-- $Revision: #1 $
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
require("HeroPlanAttach")
|
||||
|
||||
-- Tell the script pooling system to pre-cache this number of scripts.
|
||||
ScriptPoolCount = 4
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
|
||||
-- only join plans that meet our expense requirements.
|
||||
MinPlanAttachCost = 4000
|
||||
MaxPlanAttachCost = 0
|
||||
|
||||
-- Commander hit list.
|
||||
Attack_Ability_Type_Names = {
|
||||
"Capital", "Corvette", "Frigate", "Fighter", -- Attack these types.
|
||||
"Bounty_Hunter_Team_E", "Bounty_Hunter_Team_R" -- Stay away from these types.
|
||||
}
|
||||
Attack_Ability_Weights = {
|
||||
1, 1, 1, 1, -- attack type weights.
|
||||
BAD_WEIGHT, BAD_WEIGHT -- feared type weights.
|
||||
}
|
||||
Attack_Ability_Types = WeightedTypeList.Create()
|
||||
Attack_Ability_Types.Parse(Attack_Ability_Type_Names, Attack_Ability_Weights)
|
||||
|
||||
-- Prefer task forces with these units.
|
||||
Escort_Ability_Type_Names = { "Capital", "Corvette", "Frigate", "Fleet_Com_Rebel_Team", "Fleet_Com_Empire_Team" }
|
||||
Escort_Ability_Weights = { 10, 10, 10, BAD_WEIGHT, BAD_WEIGHT }
|
||||
Escort_Ability_Types = WeightedTypeList.Create()
|
||||
Escort_Ability_Types.Parse(Escort_Ability_Type_Names, Escort_Ability_Weights)
|
||||
end
|
||||
|
||||
function Evaluate_Attack_Ability(target, goal)
|
||||
return Get_Target_Weight(target, Attack_Ability_Types, Attack_Ability_Weights)
|
||||
end
|
||||
|
||||
function Get_Escort_Ability_Weights(goal)
|
||||
return Escort_Ability_Types
|
||||
end
|
||||
|
||||
function HeroService()
|
||||
|
||||
end
|
||||
70
DATA/SCRIPTS/GAMEOBJECT/GENERICBOUNTYHUNTER.LUA
Normal file
70
DATA/SCRIPTS/GAMEOBJECT/GENERICBOUNTYHUNTER.LUA
Normal file
@@ -0,0 +1,70 @@
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
-- (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/GameObject/GenericBountyHunter.lua
|
||||
--
|
||||
-- Original Editor: Giovanni Galyana
|
||||
--
|
||||
-- Final Edit By: Giovanni Galyana
|
||||
--
|
||||
-- Date: 7 March, 2015
|
||||
--
|
||||
-- Revisions: 0
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
require("HeroPlanAttach")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
|
||||
-- only join plans that meet our expense requirements.
|
||||
MinPlanAttachCost = 45000
|
||||
MaxPlanAttachCost = 0
|
||||
|
||||
-- Commander hit list.
|
||||
Attack_Ability_Type_Names = {
|
||||
"Generic_Field_Commander_Rebel", "Generic_Field_Commander_Empire", "Generic_Field_Commander_Hutts", "Generic_Fleet_Commander_Rebel", "Generic_Fleet_Commander_Empire", "Generic_Smuggler_R", "Generic_Smuggler_E" -- Attack these types.
|
||||
}
|
||||
Attack_Ability_Weights = {
|
||||
1, 1, 1, 1, 1, 1 -- attack type weights.
|
||||
}
|
||||
Attack_Ability_Types = WeightedTypeList.Create()
|
||||
Attack_Ability_Types.Parse(Attack_Ability_Type_Names, Attack_Ability_Weights)
|
||||
|
||||
-- Prefer task forces with these units.
|
||||
Escort_Ability_Type_Names = { "Capital", "Corvette", "Frigate", "Fleet_Com_Rebel_Team", "Fleet_Com_Empire_Team" }
|
||||
Escort_Ability_Weights = { 10, 10, 10, BAD_WEIGHT, BAD_WEIGHT }
|
||||
Escort_Ability_Types = WeightedTypeList.Create()
|
||||
Escort_Ability_Types.Parse(Escort_Ability_Type_Names, Escort_Ability_Weights)
|
||||
end
|
||||
|
||||
function Evaluate_Attack_Ability(target, goal)
|
||||
return Get_Target_Weight(target, Attack_Ability_Types, Attack_Ability_Weights)
|
||||
end
|
||||
|
||||
function Get_Escort_Ability_Weights(goal)
|
||||
return Escort_Ability_Types
|
||||
end
|
||||
|
||||
function HeroService()
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
152
DATA/SCRIPTS/GAMEOBJECT/HANSOLO.LUA
Normal file
152
DATA/SCRIPTS/GAMEOBJECT/HANSOLO.LUA
Normal file
@@ -0,0 +1,152 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/HanSolo.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/HanSolo.lua $
|
||||
--
|
||||
-- Original Author: Steve_Copeland
|
||||
--
|
||||
-- $Author: Brian_Hayes $
|
||||
--
|
||||
-- $Change: 637819 $
|
||||
--
|
||||
-- $DateTime: 2017/03/22 10:16:16 $
|
||||
--
|
||||
-- $Revision: #1 $
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
-- This plan is for the individual Han Solo, contrast the HanSoloPlan which is used for the Han/Chewie team.
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
|
||||
Define_State("State_Init", State_Init);
|
||||
Define_State("State_AI_Autofire", State_AI_Autofire)
|
||||
Define_State("State_Human_No_Autofire", State_Human_No_Autofire)
|
||||
Define_State("State_Human_Autofire", State_Human_Autofire)
|
||||
|
||||
unit_trigger_number = 3
|
||||
divert_range = 300
|
||||
threat_trigger_number = 200
|
||||
ability_range = 150
|
||||
ability_name = "AREA_EFFECT_STUN"
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() ~= "Land" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
nearby_unit_count = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
Register_Prox(Object, Unit_Prox, ability_range)
|
||||
else
|
||||
Set_Next_State("State_AI_Autofire")
|
||||
Register_Prox(Object, Unit_Prox, divert_range)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_AI_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if (nearby_unit_count >= unit_trigger_number) then
|
||||
ConsiderDivertAndAOE(Object, ability_name, ability_range, recent_enemy_units, threat_trigger_number)
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_unit_count = 0
|
||||
recent_enemy_units = {}
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_No_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
Set_Next_State("State_Human_Autofire")
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_unit_count = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
if nearby_unit_count >= unit_trigger_number then
|
||||
Object.Activate_Ability(ability_name, true)
|
||||
end
|
||||
else
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_unit_count = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function Unit_Prox(self_obj, trigger_obj)
|
||||
|
||||
-- Reject non-vehicles
|
||||
if not trigger_obj.Is_Category("Vehicle") then
|
||||
return
|
||||
end
|
||||
|
||||
-- Reject heroes, which we can't affect
|
||||
if trigger_obj.Is_Category("LandHero") then
|
||||
return
|
||||
end
|
||||
|
||||
if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
return
|
||||
end
|
||||
|
||||
if trigger_obj.Is_In_Garrison() then
|
||||
return
|
||||
end
|
||||
|
||||
-- If we haven't seen this unit recently, track him
|
||||
if recent_enemy_units[trigger_obj] == nil then
|
||||
nearby_unit_count = nearby_unit_count + 1
|
||||
recent_enemy_units[trigger_obj] = trigger_obj
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
86
DATA/SCRIPTS/GAMEOBJECT/HANSOLOPLAN.LUA
Normal file
86
DATA/SCRIPTS/GAMEOBJECT/HANSOLOPLAN.LUA
Normal file
@@ -0,0 +1,86 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/HanSoloPlan.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/HanSoloPlan.lua $
|
||||
--
|
||||
-- Original Author: Steve_Copeland
|
||||
--
|
||||
-- $Author: Brian_Hayes $
|
||||
--
|
||||
-- $Change: 637819 $
|
||||
--
|
||||
-- $DateTime: 2017/03/22 10:16:16 $
|
||||
--
|
||||
-- $Revision: #1 $
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
-- This is actually for the HanSolo and Chewie team object that exists in galactic mode.
|
||||
|
||||
require("HeroPlanAttach")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
|
||||
-- only join plans that meet our expense requirements.
|
||||
MinPlanAttachCost = 45000
|
||||
MaxPlanAttachCost = 0
|
||||
|
||||
-- Commander hit list.
|
||||
Attack_Ability_Type_Names = {
|
||||
"Death_Star", -- Attack these types.
|
||||
"Darth_Team" ,"Boba_Fett_Team" -- Stay away from these types.
|
||||
}
|
||||
Attack_Ability_Weights = {
|
||||
10, -- attack type weights.
|
||||
BAD_WEIGHT, BAD_WEIGHT -- feared type weights.
|
||||
}
|
||||
Attack_Ability_Types = WeightedTypeList.Create()
|
||||
Attack_Ability_Types.Parse(Attack_Ability_Type_Names, Attack_Ability_Weights)
|
||||
|
||||
-- Prefer task forces with these units.
|
||||
Escort_Ability_Type_Names = { "Capital", "Corvette", "Frigate", "Fleet_Com_Rebel_Team", "Fleet_Com_Empire_Team" }
|
||||
Escort_Ability_Weights = { 10, 10, 10, BAD_WEIGHT, BAD_WEIGHT }
|
||||
Escort_Ability_Types = WeightedTypeList.Create()
|
||||
Escort_Ability_Types.Parse(Escort_Ability_Type_Names, Escort_Ability_Weights)
|
||||
end
|
||||
|
||||
function Evaluate_Attack_Ability(target, goal)
|
||||
return Get_Target_Weight(target, Attack_Ability_Types, Attack_Ability_Weights)
|
||||
end
|
||||
|
||||
function Get_Escort_Ability_Weights(goal)
|
||||
return Escort_Ability_Types
|
||||
end
|
||||
|
||||
function HeroService()
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
98
DATA/SCRIPTS/GAMEOBJECT/HEROPLANATTACH.LUA
Normal file
98
DATA/SCRIPTS/GAMEOBJECT/HEROPLANATTACH.LUA
Normal file
@@ -0,0 +1,98 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/HeroPlanAttach.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/HeroPlanAttach.lua $
|
||||
--
|
||||
-- Original Author: Brian Hayes
|
||||
--
|
||||
-- $Author: Brian_Hayes $
|
||||
--
|
||||
-- $Change: 637819 $
|
||||
--
|
||||
-- $DateTime: 2017/03/22 10:16:16 $
|
||||
--
|
||||
-- $Revision: #1 $
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
require("pgcommands")
|
||||
|
||||
function Base_Definitions()
|
||||
DebugMessage("%s -- In Base_Definitions", tostring(Script))
|
||||
|
||||
Common_Base_Definitions()
|
||||
|
||||
ServiceRate = 10
|
||||
|
||||
if Definitions then
|
||||
Definitions()
|
||||
end
|
||||
end
|
||||
|
||||
function main()
|
||||
|
||||
DebugMessage("%s -- In main for %s", tostring(Script), tostring(Object))
|
||||
|
||||
if HeroService then
|
||||
while 1 do
|
||||
HeroService()
|
||||
PumpEvents()
|
||||
end
|
||||
end
|
||||
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
function inc_found_type_count(ival, type_found_val)
|
||||
if type_found_val == true then
|
||||
FoundTypeCount = FoundTypeCount + 1
|
||||
FoundTypeWeight = FoundTypeWeight + CurrentTypeWeights[ival]
|
||||
end
|
||||
end
|
||||
|
||||
function Get_Target_Weight(target, type_list, type_weights)
|
||||
|
||||
FoundTypeCount = 0
|
||||
FoundTypeWeight = 0
|
||||
|
||||
CurrentTypeWeights = type_weights
|
||||
|
||||
FoundTypes = EvaluateTypeList(PlayerObject, target, type_list)
|
||||
|
||||
if not FoundTypes then
|
||||
return 0
|
||||
end
|
||||
|
||||
table.foreachi(FoundTypes, inc_found_type_count)
|
||||
|
||||
if FoundTypeCount == 0 then
|
||||
return 0
|
||||
end
|
||||
|
||||
return FoundTypeWeight / FoundTypeCount
|
||||
end
|
||||
|
||||
144
DATA/SCRIPTS/GAMEOBJECT/INTERDICTOR.LUA
Normal file
144
DATA/SCRIPTS/GAMEOBJECT/INTERDICTOR.LUA
Normal file
@@ -0,0 +1,144 @@
|
||||
-- $Id: //depot/Projects/StarWars_Expansion/Run/Data/Scripts/GameObject/ObjectScript_MissileShield.lua#2 $
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
--
|
||||
-- (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_Expansion/Run/Data/Scripts/GameObject/ObjectScript_MissileShield.lua $
|
||||
--
|
||||
-- Original Author: James Yarrow
|
||||
--
|
||||
-- $Author: James_Yarrow $
|
||||
--
|
||||
-- $Change: 51104 $
|
||||
--
|
||||
-- $DateTime: 2006/08/10 18:18:02 $
|
||||
--
|
||||
-- $Revision: #2 $
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init);
|
||||
Define_State("State_AI_Autofire", State_AI_Autofire)
|
||||
Define_State("State_Human_No_Autofire", State_Human_No_Autofire)
|
||||
Define_State("State_Human_Autofire", State_Human_Autofire)
|
||||
|
||||
ability_name = "MISSILE_SHIELD"
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() ~= "Space" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
else
|
||||
interdicting = false
|
||||
Set_Next_State("State_AI_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_AI_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Is_Ability_Ready(ability_name) then
|
||||
enemy = FindDeadlyEnemy(Object)
|
||||
if TestValid(enemy) then
|
||||
projectile_types = enemy.Get_All_Projectile_Types()
|
||||
for _, projectile in pairs(projectile_types) do
|
||||
if projectile.Is_Affected_By_Missile_Shield() or projectile.Is_Affected_By_Laser_Defense() then
|
||||
Object.Activate_Ability(ability_name, true)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Land units can change hands
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
end
|
||||
|
||||
--Interdictor stuff goes here
|
||||
repeat
|
||||
-- The AI may not yet be initialized
|
||||
Sleep(1)
|
||||
enemy_is_retreating = EvaluatePerception("Enemy_Retreating", Object.Get_Owner())
|
||||
until (enemy_is_retreating ~= nil)
|
||||
|
||||
-- Prevent the enemy from retreating, if they're trying to
|
||||
if (enemy_is_retreating ~= 0) and (not interdicting) then
|
||||
interdicting = true
|
||||
Sleep(GameRandom(3,8))
|
||||
--MessageBox("trying to interdict")
|
||||
Object.Activate_Ability("INTERDICT", true)
|
||||
Register_Timer(Cancel_Interdiction, 20)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Cancel_Interdiction()
|
||||
Object.Activate_Ability("INTERDICT", false)
|
||||
interdicting = false
|
||||
end
|
||||
|
||||
function State_Human_No_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
Set_Next_State("State_Human_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
if Object.Is_Ability_Ready(ability_name) then
|
||||
enemy = FindDeadlyEnemy(Object)
|
||||
if TestValid(enemy) then
|
||||
projectile_types = enemy.Get_All_Projectile_Types()
|
||||
if projectile_types then
|
||||
for _, projectile in pairs(projectile_types) do
|
||||
if projectile.Is_Affected_By_Missile_Shield() or projectile.Is_Affected_By_Laser_Defense() then
|
||||
Object.Activate_Ability(ability_name, true)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
78
DATA/SCRIPTS/GAMEOBJECT/IONCANNON.LUA
Normal file
78
DATA/SCRIPTS/GAMEOBJECT/IONCANNON.LUA
Normal file
@@ -0,0 +1,78 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/IonCannon.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/IonCannon.lua $
|
||||
--
|
||||
-- Original Author: James Yarrow
|
||||
--
|
||||
-- $Author: Brian_Hayes $
|
||||
--
|
||||
-- $Change: 637819 $
|
||||
--
|
||||
-- $DateTime: 2017/03/22 10:16:16 $
|
||||
--
|
||||
-- $Revision: #1 $
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
require("HeroPlanAttach")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
|
||||
-- only join plans that meet our expense requirements.
|
||||
MinPlanAttachCost = 0
|
||||
MaxPlanAttachCost = 0
|
||||
|
||||
-- Commander hit list.
|
||||
Attack_Ability_Type_Names = {
|
||||
"Capital", "Frigate", -- Attack these types.
|
||||
}
|
||||
Attack_Ability_Weights = {
|
||||
5, 1, -- attack type weights.
|
||||
}
|
||||
Attack_Ability_Types = WeightedTypeList.Create()
|
||||
Attack_Ability_Types.Parse(Attack_Ability_Type_Names, Attack_Ability_Weights)
|
||||
|
||||
-- Prefer task forces with these units.
|
||||
Escort_Ability_Type_Names = { "Fighter", "Capital", "Corvette", "Frigate", "Bomber" }
|
||||
Escort_Ability_Weights = { 7, 10, 8, 9, 11 }
|
||||
Escort_Ability_Types = WeightedTypeList.Create()
|
||||
Escort_Ability_Types.Parse(Escort_Ability_Type_Names, Escort_Ability_Weights)
|
||||
end
|
||||
|
||||
function Evaluate_Attack_Ability(target, goal)
|
||||
return Get_Target_Weight(target, Attack_Ability_Types, Attack_Ability_Weights)
|
||||
end
|
||||
|
||||
function Get_Escort_Ability_Weights(goal)
|
||||
return Escort_Ability_Types
|
||||
end
|
||||
|
||||
function HeroService()
|
||||
|
||||
end
|
||||
134
DATA/SCRIPTS/GAMEOBJECT/JGS_FUNCTIONLIB.LUA
Normal file
134
DATA/SCRIPTS/GAMEOBJECT/JGS_FUNCTIONLIB.LUA
Normal file
@@ -0,0 +1,134 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/JGS_FunctionLib.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/JGS_FunctionLib.lua $
|
||||
--
|
||||
-- Original Author: Jeff_Stewart
|
||||
--
|
||||
-- $Author: Brian_Hayes $
|
||||
--
|
||||
-- $Change: 637819 $
|
||||
--
|
||||
-- $DateTime: 2017/03/22 10:16:16 $
|
||||
--
|
||||
-- $Revision: #1 $
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
-- this function is used to send units on a neverending hunt for underworld units
|
||||
-- Usage: Create_Thread("Hunt_Underworld",attack_list)
|
||||
-- where attack_list is a list of units to send on the hunt. for a single unit, use:
|
||||
-- Usage: Create_Thread("Hunt_Underworld",{single_unit})
|
||||
function Hunt_Underworld(attack_list)
|
||||
local enemy_player = Find_Player("Underworld")
|
||||
while true do
|
||||
if not VictoryStarted and not DefeatStarted then
|
||||
for k, unit in pairs(attack_list) do
|
||||
if TestValid(unit) then
|
||||
if not unit.Get_Owner().Is_Human() then
|
||||
local closest_enemy = Find_Nearest(unit, enemy_player, true)
|
||||
if TestValid(closest_enemy) then
|
||||
unit.Attack_Move(closest_enemy)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Sleep(4)
|
||||
end
|
||||
end
|
||||
|
||||
function Set_Hint_At_Object(locobj)
|
||||
--locobj.Play_SFX_Event("SFX_UMP_EmpireKesselAlarm")
|
||||
locobj.Highlight(true)
|
||||
Add_Radar_Blip(locobj, "somename")
|
||||
end
|
||||
|
||||
function Remove_Hint_At_Object(objloc)
|
||||
objloc.Highlight(false)
|
||||
Remove_Radar_Blip("somename")
|
||||
end
|
||||
|
||||
-- The following function is a waypoint patrol should be used like so:
|
||||
-- Create_Thread("Rebel_Patrol_Points", hint)
|
||||
-- hint is the name shared by the objects that follow the patrol path, as well as the patrol paths themselves
|
||||
-- all patrol points (ex JGS_PATHPOINT_1) must be present and named properly for the script to work
|
||||
-- it is extremely limited to only nine waypoints, but does allow for multiple patrols to be going on at once
|
||||
function Rebels_Patrol_Points(hint)
|
||||
underworld_player = Find_Player("Underworld")
|
||||
rebel_player = Find_Player("Rebel")
|
||||
local pursuing_target = false
|
||||
local unitlist = Find_All_Objects_With_Hint(tostring(hint))
|
||||
one = Find_Hint("JGS_PATHPOINT_1", tostring(hint))
|
||||
two = Find_Hint("JGS_PATHPOINT_2", tostring(hint))
|
||||
three = Find_Hint("JGS_PATHPOINT_3", tostring(hint))
|
||||
four = Find_Hint("JGS_PATHPOINT_4", tostring(hint))
|
||||
five = Find_Hint("JGS_PATHPOINT_5", tostring(hint))
|
||||
six = Find_Hint("JGS_PATHPOINT_6", tostring(hint))
|
||||
seven = Find_Hint("JGS_PATHPOINT_7", tostring(hint))
|
||||
eight = Find_Hint("JGS_PATHPOINT_8", tostring(hint))
|
||||
nine = Find_Hint("JGS_PATHPOINT_9", tostring(hint))
|
||||
local pathlist = { one, two, three, four, five, six, seven, eight, nine }
|
||||
local pathtarget = 1
|
||||
local incremented = false
|
||||
while not pursuing_target do
|
||||
if not VictoryStarted and not DefeatStarted then
|
||||
pathpoint = nil
|
||||
while not TestValid(pathpoint) do
|
||||
if pathtarget > 9 then
|
||||
pathtarget = 1
|
||||
end
|
||||
pathpoint = pathlist[pathtarget]
|
||||
if not TestValid(pathpoint) then
|
||||
pathtarget = pathtarget + 1
|
||||
end
|
||||
end
|
||||
incremented = false
|
||||
for k, unit in pairs(unitlist) do
|
||||
if TestValid(unit) and unit.Get_Owner() == rebel_player then
|
||||
unit.Attack_Move(pathpoint.Get_Position())
|
||||
--MessageBox("%s", tostring(pathpoint.Get_Type().Get_Name()))
|
||||
--MessageBox("%s testing...", tostring(unit.Get_Type().Get_Name()))
|
||||
if unitlist[k].Get_Distance(pathpoint) < 150 then
|
||||
if not incremented then
|
||||
pathtarget = pathtarget + 1
|
||||
incremented = true
|
||||
--MessageBox("%s new point", tostring(hint))
|
||||
end
|
||||
end
|
||||
closest_enemy = Find_Nearest(unitlist[k], underworld_player, true)
|
||||
if unitlist[k].Get_Distance(closest_enemy) < 100 then
|
||||
--pursuing_target = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Sleep(2)
|
||||
end
|
||||
--Create_Thread("Hunt_Underworld",unitlist)
|
||||
end
|
||||
83
DATA/SCRIPTS/GAMEOBJECT/LUKEPLAN.LUA
Normal file
83
DATA/SCRIPTS/GAMEOBJECT/LUKEPLAN.LUA
Normal file
@@ -0,0 +1,83 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/LukePlan.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/LukePlan.lua $
|
||||
--
|
||||
-- Original Author: Steve_Copeland
|
||||
--
|
||||
-- $Author: Brian_Hayes $
|
||||
--
|
||||
-- $Change: 637819 $
|
||||
--
|
||||
-- $DateTime: 2017/03/22 10:16:16 $
|
||||
--
|
||||
-- $Revision: #1 $
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
require("HeroPlanAttach")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
|
||||
-- only join plans that meet our expense requirements.
|
||||
MinPlanAttachCost = 45000
|
||||
MaxPlanAttachCost = 0
|
||||
|
||||
-- Commander hit list.
|
||||
Attack_Ability_Type_Names = {
|
||||
"Death_Star", -- Attack these types.
|
||||
"Darth_Team" ,"Boba_Fett_Team" -- Stay away from these types.
|
||||
}
|
||||
Attack_Ability_Weights = {
|
||||
10, -- attack type weights.
|
||||
BAD_WEIGHT, BAD_WEIGHT -- feared type weights.
|
||||
}
|
||||
Attack_Ability_Types = WeightedTypeList.Create()
|
||||
Attack_Ability_Types.Parse(Attack_Ability_Type_Names, Attack_Ability_Weights)
|
||||
|
||||
-- Prefer task forces with these units.
|
||||
Escort_Ability_Type_Names = { "Capital", "Corvette", "Frigate", "Fleet_Com_Rebel_Team", "Fleet_Com_Empire_Team" }
|
||||
Escort_Ability_Weights = { 10, 10, 10, BAD_WEIGHT, BAD_WEIGHT }
|
||||
Escort_Ability_Types = WeightedTypeList.Create()
|
||||
Escort_Ability_Types.Parse(Escort_Ability_Type_Names, Escort_Ability_Weights)
|
||||
end
|
||||
|
||||
function Evaluate_Attack_Ability(target, goal)
|
||||
return Get_Target_Weight(target, Attack_Ability_Types, Attack_Ability_Weights)
|
||||
end
|
||||
|
||||
function Get_Escort_Ability_Weights(goal)
|
||||
return Escort_Ability_Types
|
||||
end
|
||||
|
||||
function HeroService()
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
152
DATA/SCRIPTS/GAMEOBJECT/MARKERTRIGGER.LUA
Normal file
152
DATA/SCRIPTS/GAMEOBJECT/MARKERTRIGGER.LUA
Normal file
@@ -0,0 +1,152 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/MarkerTrigger.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/MarkerTrigger.lua $
|
||||
--
|
||||
-- Original Author: Brian Hayes
|
||||
--
|
||||
-- $Author: Brian_Hayes $
|
||||
--
|
||||
-- $Change: 637819 $
|
||||
--
|
||||
-- $DateTime: 2017/03/22 10:16:16 $
|
||||
--
|
||||
-- $Revision: #1 $
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
--
|
||||
-- This is a pretty simple trigger script.
|
||||
-- It just listens for any object entering a box of 100 meters centered on the marker
|
||||
--
|
||||
-- 4/29/2005 10:50:24 AM -- BMH
|
||||
--
|
||||
|
||||
|
||||
--
|
||||
-- Definitions -- This function is called once when the script is first created.
|
||||
--
|
||||
-- @since 4/29/2005 10:51:40 AM -- BMH
|
||||
--
|
||||
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
|
||||
|
||||
-- half-width of the box around our object.
|
||||
object_trap_size = 50
|
||||
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
|
||||
Define_State("State_Init", State_Init);
|
||||
Define_State("State_Object_In_Range", State_Object_In_Range);
|
||||
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- State_Object_In_Range -- We've caught an object.
|
||||
--
|
||||
-- @param message The message describing our progression through this state. OnEnter, OnUpdate, OnExit.
|
||||
-- @since 4/29/2005 10:51:40 AM -- BMH
|
||||
--
|
||||
function State_Object_In_Range(message)
|
||||
if message == OnEnter then
|
||||
DebugMessage("%s -- State_Object_In_Range(OnEnter), Caught %s", tostring(Script), tostring(caught_object))
|
||||
|
||||
-- Bring down the re-inforcements.
|
||||
BlockOnCommand(Reinforce_Unit(reinforce_type, Object.Get_Position(), caught_object.Get_Owner()))
|
||||
-- Spawn_Unit(reinforce_type, Object.Get_Position(), caught_object.Get_Owner())
|
||||
|
||||
-- Sleep for 60 seconds then reset the trap.
|
||||
Sleep(60)
|
||||
|
||||
-- Go back to State_Init to reset the trap.
|
||||
Set_Next_State("State_Init")
|
||||
|
||||
elseif message == OnUpdate then
|
||||
-- DebugMessage("%s -- State_Object_In_Range(OnUpdate)", tostring(Script))
|
||||
elseif message == OnExit then
|
||||
-- DebugMessage("%s -- State_Object_In_Range(OnExit)", tostring(Script))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- State_Init -- The Init state. Set our trap to catch an object.
|
||||
--
|
||||
-- @param message The message describing our progression through this state. OnEnter, OnUpdate, OnExit.
|
||||
-- @since 4/29/2005 10:51:40 AM -- BMH
|
||||
--
|
||||
function State_Init(message)
|
||||
|
||||
if message == OnEnter then
|
||||
-- When an object enters within 50 meters call our event.
|
||||
DebugMessage("%s -- State_Init(OnEnter)", tostring(Script))
|
||||
Object.Event_Object_In_Range(object_in_range_handler, 50)
|
||||
|
||||
reinforce_type = Find_Object_Type("Rebel_Tank_Buster_Squad")
|
||||
plex_type = Find_Object_Type("Plex_Soldier")
|
||||
|
||||
elseif message == OnUpdate then
|
||||
-- DebugMessage("%s -- State_Init(OnUpdate)", tostring(Script))
|
||||
-- Do nothing
|
||||
elseif message == OnExit then
|
||||
-- DebugMessage("%s -- State_Init(OnExit)", tostring(Script))
|
||||
-- Do nothing
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- object_in_range_handler -- Our object in range callback handler. Passed into the
|
||||
-- Object.Event_Object_In_Range function during State_Init.
|
||||
--
|
||||
-- @param object GameObject of the object that entered our box
|
||||
-- @since 4/29/2005 10:51:40 AM -- BMH
|
||||
--
|
||||
function object_in_range_handler(prox_obj, object)
|
||||
|
||||
if object.Get_Type() ~= plex_type then
|
||||
return
|
||||
end
|
||||
-- DebugMessage("%s -- Object %s in range.", tostring(Script), tostring(object))
|
||||
|
||||
-- Cancel the object in range event from signaling anymore.
|
||||
Object.Cancel_Event_Object_In_Range(object_in_range_handler)
|
||||
|
||||
-- gotcha!
|
||||
caught_object = object;
|
||||
|
||||
-- Advance our state to Object_In_Range
|
||||
Set_Next_State("State_Object_In_Range")
|
||||
end
|
||||
|
||||
243
DATA/SCRIPTS/GAMEOBJECT/OBIWANPLAN.LUA
Normal file
243
DATA/SCRIPTS/GAMEOBJECT/OBIWANPLAN.LUA
Normal file
@@ -0,0 +1,243 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/ObiWanPlan.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/ObiWanPlan.lua $
|
||||
--
|
||||
-- Original Author: Steve_Copeland
|
||||
--
|
||||
-- $Author: Brian_Hayes $
|
||||
--
|
||||
-- $Change: 637819 $
|
||||
--
|
||||
-- $DateTime: 2017/03/22 10:16:16 $
|
||||
--
|
||||
-- $Revision: #1 $
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
-- This include order is important. We need the state service defined in main to override the one in heroplanattach.
|
||||
require("HeroPlanAttach")
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
|
||||
-- only join plans that meet our expense requirements.
|
||||
MinPlanAttachCost = 5000
|
||||
MaxPlanAttachCost = 0
|
||||
|
||||
-- Commander hit list.
|
||||
Attack_Ability_Type_Names = {
|
||||
"Infantry", -- Attack these types.
|
||||
"Darth_Team", "Boba_Fett_Team" -- Stay away from these types.
|
||||
}
|
||||
Attack_Ability_Weights = {
|
||||
10, -- attack type weights.
|
||||
BAD_WEIGHT, BAD_WEIGHT -- feared type weights.
|
||||
}
|
||||
Attack_Ability_Types = WeightedTypeList.Create()
|
||||
Attack_Ability_Types.Parse(Attack_Ability_Type_Names, Attack_Ability_Weights)
|
||||
|
||||
-- Prefer task forces with these units.
|
||||
Escort_Ability_Type_Names = { "Infantry", "Vehicle", "Air", "Fleet_Com_Rebel_Team", "Fleet_Com_Empire_Team" }
|
||||
Escort_Ability_Weights = { 3, 10, 3, BAD_WEIGHT, BAD_WEIGHT }
|
||||
Escort_Ability_Types = WeightedTypeList.Create()
|
||||
Escort_Ability_Types.Parse(Escort_Ability_Type_Names, Escort_Ability_Weights)
|
||||
|
||||
-- tactical behavior stuff
|
||||
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init);
|
||||
Define_State("State_AI_Autofire", State_AI_Autofire)
|
||||
Define_State("State_Human_No_Autofire", State_Human_No_Autofire)
|
||||
Define_State("State_Human_Autofire", State_Human_Autofire)
|
||||
|
||||
unit_trigger_number = 3
|
||||
divert_range = 400
|
||||
threat_trigger_number = 10
|
||||
ability_range = 100
|
||||
ability_name = "FORCE_CONFUSE"
|
||||
|
||||
invulnerability_ability_name = "TARGETED_INVULNERABILITY"
|
||||
min_threat_to_use_invulnerability = 100
|
||||
invulnerability_range = 400
|
||||
|
||||
stealth_reveal_range = 200
|
||||
stealth_ability = "STEALTH"
|
||||
end
|
||||
|
||||
function Evaluate_Attack_Ability(target, goal)
|
||||
return Get_Target_Weight(target, Attack_Ability_Types, Attack_Ability_Weights)
|
||||
end
|
||||
|
||||
function Get_Escort_Ability_Weights(goal)
|
||||
return Escort_Ability_Types
|
||||
end
|
||||
|
||||
function HeroService()
|
||||
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() ~= "Land" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
nearby_unit_count = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
Register_Prox(Object, Invuln_Prox, invulnerability_range)
|
||||
Register_Prox(Object, Unit_Reveal_Prox, stealth_reveal_range)
|
||||
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
Register_Prox(Object, Unit_Prox, ability_range)
|
||||
else
|
||||
Set_Next_State("State_AI_Autofire")
|
||||
Register_Prox(Object, Unit_Prox, divert_range)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_AI_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if (nearby_unit_count >= unit_trigger_number) and Object.Get_Hull() < 0.5 then
|
||||
ConsiderDivertAndAOE(Object, ability_name, ability_range, recent_enemy_units, threat_trigger_number)
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_unit_count = 0
|
||||
recent_enemy_units = {}
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_No_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
Set_Next_State("State_Human_Autofire")
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_unit_count = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
if nearby_unit_count >= unit_trigger_number then
|
||||
Object.Activate_Ability(ability_name, true)
|
||||
end
|
||||
else
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_unit_count = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function Unit_Prox(self_obj, trigger_obj)
|
||||
--Can only confuse non-hero infantry
|
||||
if not trigger_obj.Is_Category("Infantry") then
|
||||
return
|
||||
end
|
||||
|
||||
if trigger_obj.Is_Category("LandHero") then
|
||||
return
|
||||
end
|
||||
|
||||
if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
return
|
||||
end
|
||||
|
||||
--Promote to parent object (infantry squads) for unit counting purposes
|
||||
if trigger_obj.Get_Parent_Object() then
|
||||
trigger_obj = trigger_obj.Get_Parent_Object()
|
||||
end
|
||||
|
||||
if trigger_obj.Is_In_Garrison() then
|
||||
return
|
||||
end
|
||||
|
||||
-- If we haven't seen this unit recently, track him
|
||||
if recent_enemy_units[trigger_obj] == nil then
|
||||
nearby_unit_count = nearby_unit_count + 1
|
||||
recent_enemy_units[trigger_obj] = trigger_obj
|
||||
end
|
||||
end
|
||||
|
||||
function Invuln_Prox(self_obj, trigger_obj)
|
||||
if Object.Get_Owner().Is_Human() and not Object.Is_Ability_Autofire(invulnerability_ability_name) then
|
||||
return
|
||||
end
|
||||
|
||||
--Use invulnerability on friendly objects that are in need of help and worth preserving
|
||||
if not trigger_obj.Get_Owner().Is_Ally(Object.Get_Owner()) then
|
||||
return
|
||||
end
|
||||
|
||||
if not trigger_obj.Get_Type().Is_Hero() then
|
||||
if trigger_obj.Get_Type().Get_Combat_Rating() < min_threat_to_use_invulnerability then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
if not self_obj.Is_Ability_Ready(invulnerability_ability_name) then
|
||||
return
|
||||
end
|
||||
|
||||
if not TestValid(FindDeadlyEnemy(trigger_obj)) then
|
||||
return
|
||||
end
|
||||
|
||||
self_obj.Activate_Ability(invulnerability_ability_name, trigger_obj)
|
||||
end
|
||||
|
||||
-- If a stealthed enemy enters the prox, disable their stealth ability
|
||||
function Unit_Reveal_Prox(self_obj, trigger_obj)
|
||||
if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
return
|
||||
end
|
||||
|
||||
if trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
if trigger_obj.Is_Ability_Active(stealth_ability) then
|
||||
if Is_Campaign_Game() == true then
|
||||
trigger_obj.Cancel_Ability(stealth_ability)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,69 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/ObjectScript_AdaptiveForcefield_Chronoscepter.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 18 February, 2017
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init);
|
||||
Define_State("State_AI_Autofire", State_AI_Autofire)
|
||||
Define_State("State_Human_No_Autofire", State_Human_No_Autofire)
|
||||
Define_State("State_Human_Autofire", State_Human_Autofire)
|
||||
|
||||
ability_name = "DEFEND"
|
||||
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() ~= "Space" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
else
|
||||
Set_Next_State("State_AI_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_AI_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Get_Rate_Of_Damage_Taken() > 150.0 and Object.Get_Shield() < 0.7 then
|
||||
if Object.Is_Ability_Ready(ability_name) then
|
||||
Object.Activate_Ability(ability_name, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_No_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
Set_Next_State("State_Human_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
if Object.Get_Rate_Of_Damage_Taken() > 175.0 and Object.Get_Shield() < 0.7 then
|
||||
if Object.Is_Ability_Ready(ability_name) then
|
||||
Object.Activate_Ability(ability_name, true)
|
||||
end
|
||||
end
|
||||
else
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
14
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_BUZZDROIDS.LUA
Normal file
14
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_BUZZDROIDS.LUA
Normal file
@@ -0,0 +1,14 @@
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
ServiceRate = 1
|
||||
Define_State("State_Spawned_In_Nebula", State_Spawned_In_Nebula);
|
||||
end
|
||||
|
||||
function State_Spawned_In_Nebula(message)
|
||||
if message == OnEnter then
|
||||
if Object.Is_In_Nebula() or Object.Is_In_Ion_Storm() then
|
||||
Object.Take_Damage(20) --Tune to reduce object lifetime
|
||||
end
|
||||
end
|
||||
end
|
||||
62
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_CANDEROUS.LUA
Normal file
62
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_CANDEROUS.LUA
Normal file
@@ -0,0 +1,62 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/ObjectScript_Canderous.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 23 December, 2023
|
||||
|
||||
require("PGStateMachine")
|
||||
require("PGBase")
|
||||
|
||||
function Definitions()
|
||||
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init);
|
||||
Define_State("State_AI_Autofire", State_AI_Autofire)
|
||||
Define_State("State_Human_No_Autofire", State_Human_No_Autofire)
|
||||
|
||||
ability_name = "LURE"
|
||||
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() ~= "Land" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
else
|
||||
Set_Next_State("State_AI_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_AI_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Get_Rate_Of_Damage_Taken() > 8.0 and (Object.Get_Shield() < 0.65 or Object.Get_Health() < 0.75) then
|
||||
if Object.Is_Ability_Ready(ability_name) then
|
||||
Object.Activate_Ability(ability_name, true)
|
||||
end
|
||||
end
|
||||
|
||||
--Land units can change hands
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_No_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
|
||||
--Land units can change hands
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Sleep(1)
|
||||
else
|
||||
Set_Next_State("State_AI_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
31
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_CONSTRUCTOR.LUA
Normal file
31
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_CONSTRUCTOR.LUA
Normal file
@@ -0,0 +1,31 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/ObjectScript_Constructor.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
require("PGStateMachine")
|
||||
require("PGBase")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
Define_State("State_Init", State_Init);
|
||||
ServiceRate = 0.5
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Get_Build_Pad_Contents() ~= nil then
|
||||
Object.Stop()
|
||||
Object.Suspend_Locomotor(true)
|
||||
Object.Set_Selectable(false)
|
||||
Object.Prevent_All_Fire(true)
|
||||
Object.Prevent_Opportunity_Fire(true)
|
||||
-- Despawning the object allows another constructor unit to be built (exploit)
|
||||
-- Needs to be despawned to allow death clone to function
|
||||
-- We will now fake deathclone via death_survivors and another lua script
|
||||
-- Sleep(61)
|
||||
-- Object.Despawn()
|
||||
ScriptExit()
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,26 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/ObjectScript_Constructor_Satellite.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
require("PGStateMachine")
|
||||
require("PGBase")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
Define_State("State_Init", State_Init);
|
||||
ServiceRate = 0.5
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Get_Build_Pad_Contents() ~= nil then
|
||||
Object.Stop()
|
||||
Object.Suspend_Locomotor(true)
|
||||
Object.Set_Selectable(false)
|
||||
Object.Prevent_All_Fire(true)
|
||||
Object.Prevent_Opportunity_Fire(true)
|
||||
ScriptExit()
|
||||
end
|
||||
end
|
||||
end
|
||||
22
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_DESPAWNHEALER.LUA
Normal file
22
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_DESPAWNHEALER.LUA
Normal file
@@ -0,0 +1,22 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/ObjectScript_DespawnHealer.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- Used to despawn the repair satellite self repair object that is spawned via Objectscript_SpawnHealer.lua
|
||||
-- The object is classed as an asteroid for easy finding
|
||||
|
||||
require("PGStateMachine")
|
||||
require("PGSpawnUnits")
|
||||
|
||||
function Definitions()
|
||||
Define_State("State_Init", State_Init)
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
-- Find_Nearest_Space_Field(Object_Type, "Asteroid"/"Nebula"/"Ion_Storm")
|
||||
healer = Find_Nearest_Space_Field(Object, "Asteroid")
|
||||
healer.Despawn()
|
||||
end
|
||||
end
|
||||
21
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_DESPAWNIONNEBULA.LUA
Normal file
21
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_DESPAWNIONNEBULA.LUA
Normal file
@@ -0,0 +1,21 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/ObjectScript_DespawnIonNebula.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- Despawns the ion nebula spawned from the hutts emitter satellite via Objectscript_SpawnIonNebula.lua
|
||||
|
||||
require("PGStateMachine")
|
||||
require("PGSpawnUnits")
|
||||
|
||||
function Definitions()
|
||||
Define_State("State_Init", State_Init)
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
-- Find_Nearest_Space_Field(Object_Type, "Asteroid"/"Nebula"/"Ion_Storm")
|
||||
ion_storm = Find_Nearest_Space_Field(Object, "Nebula")
|
||||
ion_storm.Despawn()
|
||||
end
|
||||
end
|
||||
150
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_GARGANTUAN.LUA
Normal file
150
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_GARGANTUAN.LUA
Normal file
@@ -0,0 +1,150 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/ObjectScript_Gargantuan.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/ObjectScript_Gargantuan.lua $
|
||||
--
|
||||
-- Original Author: Steve_Copeland
|
||||
--
|
||||
-- $Author: Brian_Hayes $
|
||||
--
|
||||
-- $Change: 637819 $
|
||||
--
|
||||
-- $DateTime: 2017/03/22 10:16:16 $
|
||||
--
|
||||
-- $Revision: #1 $
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
|
||||
-- Object script stuff
|
||||
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init);
|
||||
Define_State("State_AI_Autofire", State_AI_Autofire)
|
||||
Define_State("State_Human_No_Autofire", State_Human_No_Autofire)
|
||||
Define_State("State_Human_Autofire", State_Human_Autofire)
|
||||
|
||||
unit_trigger_number = 3
|
||||
ability_range = 150
|
||||
ability_name = "SHIELD_FLARE"
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() ~= "Land" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
nearby_unit_count = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
Register_Prox(Object, Unit_Prox, ability_range)
|
||||
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
else
|
||||
Set_Next_State("State_AI_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_AI_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if (Object.Get_Shield() > 0.33) and (nearby_unit_count >= unit_trigger_number) then
|
||||
--This unit is too big and slow for diverting to be sensible
|
||||
Object.Activate_Ability(ability_name, true)
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_unit_count = 0
|
||||
recent_enemy_units = {}
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_No_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
Set_Next_State("State_Human_Autofire")
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_unit_count = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
if (Object.Get_Shield() > 0.33) and (nearby_unit_count >= unit_trigger_number) then
|
||||
Object.Activate_Ability(ability_name, true)
|
||||
end
|
||||
else
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_unit_count = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function Unit_Prox(self_obj, trigger_obj)
|
||||
|
||||
--Ignore structures. They're boring
|
||||
if trigger_obj.Is_Category("Structure") then
|
||||
return
|
||||
end
|
||||
|
||||
if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
return
|
||||
end
|
||||
|
||||
--Promote to parent object (infantry squads) for unit counting purposes
|
||||
if trigger_obj.Get_Parent_Object() then
|
||||
trigger_obj = trigger_obj.Get_Parent_Object()
|
||||
end
|
||||
|
||||
if trigger_obj.Is_In_Garrison() then
|
||||
return
|
||||
end
|
||||
|
||||
-- If we haven't seen this unit recently, track him
|
||||
if recent_enemy_units[trigger_obj] == nil then
|
||||
nearby_unit_count = nearby_unit_count + 1
|
||||
recent_enemy_units[trigger_obj] = trigger_obj
|
||||
end
|
||||
end
|
||||
69
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_GAUNTLET.LUA
Normal file
69
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_GAUNTLET.LUA
Normal file
@@ -0,0 +1,69 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/ObjectScript_Gauntlet.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 23 December, 2023
|
||||
|
||||
require("PGStateMachine")
|
||||
require("PGBase")
|
||||
|
||||
function Definitions()
|
||||
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init);
|
||||
Define_State("State_AI_Autofire", State_AI_Autofire)
|
||||
Define_State("State_Human_No_Autofire", State_Human_No_Autofire)
|
||||
|
||||
ability_name = "SENSOR_JAMMING"
|
||||
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() ~= "Land" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
else
|
||||
Set_Next_State("State_AI_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_AI_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Is_Ability_Ready(ability_name) then
|
||||
enemy = FindDeadlyEnemy(Object)
|
||||
if TestValid(enemy) then
|
||||
projectile_types = enemy.Get_All_Projectile_Types()
|
||||
for _, projectile in pairs(projectile_types) do
|
||||
if projectile.Is_Affected_By_Laser_Defense() then
|
||||
Object.Activate_Ability(ability_name, true)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Land units can change hands
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_No_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
|
||||
--Land units can change hands
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Sleep(1)
|
||||
else
|
||||
Set_Next_State("State_AI_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,48 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/ObjectScript_GC_Stealth_Reveal_1000.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- LUA fix for generic stealth detecting units
|
||||
-- Will need to be removed once petro patches this bug
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In definitions", tostring(Script))
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init);
|
||||
|
||||
stealth_reveal_range = 1000
|
||||
stealth_ability = "STEALTH"
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
-- we only want this script to run during GC tactical battles
|
||||
if Is_Campaign_Game() ~= true then
|
||||
ScriptExit()
|
||||
end
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() == "Galactic" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
Register_Prox(Object, Unit_Prox, stealth_reveal_range)
|
||||
end
|
||||
end
|
||||
|
||||
-- If a stealthed enemy enters the prox, disable their stealth ability
|
||||
function Unit_Prox(self_obj, trigger_obj)
|
||||
if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
return
|
||||
end
|
||||
|
||||
if trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
if trigger_obj.Is_Ability_Active(stealth_ability) then
|
||||
trigger_obj.Cancel_Ability(stealth_ability)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,48 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/ObjectScript_GC_Stealth_Reveal_1500.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- LUA fix for generic stealth detecting units
|
||||
-- Will need to be removed once petro patches this bug
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In definitions", tostring(Script))
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init);
|
||||
|
||||
stealth_reveal_range = 1500
|
||||
stealth_ability = "STEALTH"
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
-- we only want this script to run during GC tactical battles
|
||||
if Is_Campaign_Game() ~= true then
|
||||
ScriptExit()
|
||||
end
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() == "Galactic" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
Register_Prox(Object, Unit_Prox, stealth_reveal_range)
|
||||
end
|
||||
end
|
||||
|
||||
-- If a stealthed enemy enters the prox, disable their stealth ability
|
||||
function Unit_Prox(self_obj, trigger_obj)
|
||||
if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
return
|
||||
end
|
||||
|
||||
if trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
if trigger_obj.Is_Ability_Active(stealth_ability) then
|
||||
trigger_obj.Cancel_Ability(stealth_ability)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,48 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/ObjectScript_GC_Stealth_Reveal_200.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- LUA fix for generic stealth detecting units
|
||||
-- Will need to be removed once petro patches this bug
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In definitions", tostring(Script))
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init);
|
||||
|
||||
stealth_reveal_range = 200
|
||||
stealth_ability = "STEALTH"
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
-- we only want this script to run during GC tactical battles
|
||||
if Is_Campaign_Game() ~= true then
|
||||
ScriptExit()
|
||||
end
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() == "Galactic" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
Register_Prox(Object, Unit_Prox, stealth_reveal_range)
|
||||
end
|
||||
end
|
||||
|
||||
-- If a stealthed enemy enters the prox, disable their stealth ability
|
||||
function Unit_Prox(self_obj, trigger_obj)
|
||||
if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
return
|
||||
end
|
||||
|
||||
if trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
if trigger_obj.Is_Ability_Active(stealth_ability) then
|
||||
trigger_obj.Cancel_Ability(stealth_ability)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,48 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/ObjectScript_GC_Stealth_Reveal_300.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- LUA fix for generic stealth detecting units
|
||||
-- Will need to be removed once petro patches this bug
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In definitions", tostring(Script))
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init);
|
||||
|
||||
stealth_reveal_range = 300
|
||||
stealth_ability = "STEALTH"
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
-- we only want this script to run during GC tactical battles
|
||||
if Is_Campaign_Game() ~= true then
|
||||
ScriptExit()
|
||||
end
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() == "Galactic" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
Register_Prox(Object, Unit_Prox, stealth_reveal_range)
|
||||
end
|
||||
end
|
||||
|
||||
-- If a stealthed enemy enters the prox, disable their stealth ability
|
||||
function Unit_Prox(self_obj, trigger_obj)
|
||||
if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
return
|
||||
end
|
||||
|
||||
if trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
if trigger_obj.Is_Ability_Active(stealth_ability) then
|
||||
trigger_obj.Cancel_Ability(stealth_ability)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,48 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/ObjectScript_GC_Stealth_Reveal_500.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- LUA fix for generic stealth detecting units
|
||||
-- Will need to be removed once petro patches this bug
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In definitions", tostring(Script))
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init);
|
||||
|
||||
stealth_reveal_range = 500
|
||||
stealth_ability = "STEALTH"
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
-- we only want this script to run during GC tactical battles
|
||||
if Is_Campaign_Game() ~= true then
|
||||
ScriptExit()
|
||||
end
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() == "Galactic" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
Register_Prox(Object, Unit_Prox, stealth_reveal_range)
|
||||
end
|
||||
end
|
||||
|
||||
-- If a stealthed enemy enters the prox, disable their stealth ability
|
||||
function Unit_Prox(self_obj, trigger_obj)
|
||||
if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
return
|
||||
end
|
||||
|
||||
if trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
if trigger_obj.Is_Ability_Active(stealth_ability) then
|
||||
trigger_obj.Cancel_Ability(stealth_ability)
|
||||
end
|
||||
end
|
||||
end
|
||||
138
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_IG2000.LUA
Normal file
138
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_IG2000.LUA
Normal file
@@ -0,0 +1,138 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/ObjectScript_IG2000.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/ObjectScript_IG2000.lua $
|
||||
--
|
||||
-- Original Author: Steve_Copeland
|
||||
--
|
||||
-- $Author: Brian_Hayes $
|
||||
--
|
||||
-- $Change: 637819 $
|
||||
--
|
||||
-- $DateTime: 2017/03/22 10:16:16 $
|
||||
--
|
||||
-- $Revision: #1 $
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init)
|
||||
Define_State("State_Human_Idle", State_Human_Idle)
|
||||
|
||||
ability_name = "CORRUPT_SYSTEMS"
|
||||
ability_ae_range = 300
|
||||
ability_search_range = 700
|
||||
ability_threat_threshold = 1000
|
||||
|
||||
stealth_reveal_range = 1000
|
||||
stealth_ability = "STEALTH"
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Set_Next_State("State_Human_Idle")
|
||||
-- ScriptExit()
|
||||
end
|
||||
|
||||
if Get_Game_Mode() ~= "Space" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
nearby_units = {}
|
||||
|
||||
Register_Prox(Object, Corrupt_Systems_Prox, ability_search_range)
|
||||
Register_Prox(Object, Unit_Prox, stealth_reveal_range)
|
||||
|
||||
elseif message == OnUpdate then
|
||||
|
||||
if Object.Is_Ability_Ready("CORRUPT_SYSTEMS") then
|
||||
cast_position, threat = Find_Best_Local_Threat_Center(nearby_units, ability_ae_range)
|
||||
if threat ~= nil and threat > ability_threat_threshold then
|
||||
Object.Activate_Ability(ability_name, cast_position)
|
||||
end
|
||||
end
|
||||
|
||||
nearby_units = {}
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function Corrupt_Systems_Prox(self_obj, trigger_obj)
|
||||
|
||||
if nearby_units[trigger_obj] == nil then
|
||||
|
||||
if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
return
|
||||
end
|
||||
|
||||
--Don't waste corrupt systems on unshielded units unless we really don't like them
|
||||
if trigger_obj.Get_Shield() <= 0.0 then
|
||||
if trigger_obj ~= FindDeadlyEnemy(Object) then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
nearby_units[trigger_obj] = trigger_obj
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function State_Human_Idle(message)
|
||||
if message == OnEnter then
|
||||
-- we only want this script to run during GC tactical battles
|
||||
if Is_Campaign_Game() ~= true then
|
||||
ScriptExit()
|
||||
end
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() ~= "Space" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
Register_Prox(Object, Unit_Prox, stealth_reveal_range)
|
||||
end
|
||||
end
|
||||
|
||||
-- If a stealthed enemy enters the prox, disable their stealth ability
|
||||
function Unit_Prox(self_obj, trigger_obj)
|
||||
if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
return
|
||||
end
|
||||
|
||||
if trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
if trigger_obj.Is_Ability_Active(stealth_ability) then
|
||||
if Is_Campaign_Game() == true then
|
||||
trigger_obj.Cancel_Ability(stealth_ability)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
185
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_IG88.LUA
Normal file
185
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_IG88.LUA
Normal file
@@ -0,0 +1,185 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/ObjectScript_IG88.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/ObjectScript_IG88.lua $
|
||||
--
|
||||
-- Original Author: Steve_Copeland
|
||||
--
|
||||
-- $Author: Brian_Hayes $
|
||||
--
|
||||
-- $Change: 637819 $
|
||||
--
|
||||
-- $DateTime: 2017/03/22 10:16:16 $
|
||||
--
|
||||
-- $Revision: #1 $
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
-- This include order is important. We need the state service defined in main to override the one in heroplanattach.
|
||||
require("HeroPlanAttach")
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
|
||||
|
||||
-- Hero plan self attachment stuff
|
||||
|
||||
-- only join plans that meet our expense requirements.
|
||||
MinPlanAttachCost = 5000
|
||||
MaxPlanAttachCost = 0
|
||||
|
||||
-- Commander hit list.
|
||||
Attack_Ability_Type_Names = {"Infantry", "Fighter", "Corvette" }
|
||||
Attack_Ability_Weights = { 1, 1, BAD_WEIGHT }
|
||||
Attack_Ability_Types = WeightedTypeList.Create()
|
||||
Attack_Ability_Types.Parse(Attack_Ability_Type_Names, Attack_Ability_Weights)
|
||||
|
||||
-- Prefer task forces with these units.
|
||||
Escort_Ability_Type_Names = { "All" }
|
||||
Escort_Ability_Weights = { 1.0 }
|
||||
Escort_Ability_Types = WeightedTypeList.Create()
|
||||
Escort_Ability_Types.Parse(Escort_Ability_Type_Names, Escort_Ability_Weights)
|
||||
|
||||
|
||||
-- Object script stuff
|
||||
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init)
|
||||
Define_State("State_Human_Idle", State_Human_Idle)
|
||||
|
||||
unit_trigger_number = 3
|
||||
|
||||
contaminate_range = 150
|
||||
min_threat_to_use_contaminate = 150
|
||||
contaminate_area_of_effect = 75
|
||||
contaminate_ability_name = "RADIOACTIVE_CONTAMINATE"
|
||||
|
||||
stealth_reveal_range = 250
|
||||
stealth_ability = "STEALTH"
|
||||
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
-- Bail out if this is a human player
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Set_Next_State("State_Human_Idle")
|
||||
-- ScriptExit()
|
||||
end
|
||||
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() ~= "Land" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
nearby_contaminate_count = 0
|
||||
recent_contaminate_units = {}
|
||||
|
||||
Register_Prox(Object, IG88_Contaminate_Prox, contaminate_range)
|
||||
Register_Prox(Object, Unit_Prox, stealth_reveal_range)
|
||||
|
||||
elseif message == OnUpdate then
|
||||
|
||||
if nearby_contaminate_count >= unit_trigger_number then
|
||||
target, threat = Find_Best_Local_Threat_Center(recent_contaminate_units, contaminate_area_of_effect)
|
||||
if threat and threat >= min_threat_to_use_contaminate then
|
||||
Try_Ability(Object, contaminate_ability_name, target)
|
||||
end
|
||||
end
|
||||
|
||||
nearby_contaminate_count = 0
|
||||
recent_contaminate_units = {}
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function IG88_Contaminate_Prox(self_obj, trigger_obj)
|
||||
|
||||
if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
return
|
||||
end
|
||||
|
||||
if trigger_obj.Is_Category("Infantry") then
|
||||
trigger_parent = trigger_obj.Get_Parent_Object()
|
||||
if TestValid(trigger_parent) then
|
||||
trigger_obj = trigger_parent
|
||||
end
|
||||
elseif (not trigger_obj.Is_Category("Vehicle")) or (trigger_obj.Get_Hull() > 0.25) then
|
||||
return
|
||||
end
|
||||
|
||||
if trigger_obj.Is_In_Garrison() then
|
||||
return
|
||||
end
|
||||
|
||||
-- If we haven't seen this unit recently, track him
|
||||
if recent_contaminate_units[trigger_obj] == nil then
|
||||
recent_contaminate_units[trigger_obj] = trigger_obj
|
||||
nearby_contaminate_count = nearby_contaminate_count + 1
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_Idle(message)
|
||||
if message == OnEnter then
|
||||
-- we only want this script to run during GC tactical battles
|
||||
if Is_Campaign_Game() ~= true then
|
||||
ScriptExit()
|
||||
end
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() ~= "Land" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
Register_Prox(Object, Unit_Prox, stealth_reveal_range)
|
||||
end
|
||||
end
|
||||
|
||||
-- If a stealthed enemy enters the prox, disable their stealth ability
|
||||
function Unit_Prox(self_obj, trigger_obj)
|
||||
if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
return
|
||||
end
|
||||
|
||||
if trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
if trigger_obj.Is_Ability_Active(stealth_ability) then
|
||||
if Is_Campaign_Game() == true then
|
||||
trigger_obj.Cancel_Ability(stealth_ability)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Evaluate_Attack_Ability(target, goal)
|
||||
return Get_Target_Weight(target, Attack_Ability_Types, Attack_Ability_Weights)
|
||||
end
|
||||
|
||||
function Get_Escort_Ability_Weights(goal)
|
||||
return Escort_Ability_Types
|
||||
end
|
||||
20
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_KILLONSPAWN.LUA
Normal file
20
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_KILLONSPAWN.LUA
Normal file
@@ -0,0 +1,20 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/ObjectScript_KillOnSpawn.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- Kill the object immediately as it spawns in
|
||||
-- Used to fake a deathclone object for skirmish defense stations
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
ServiceRate = 1
|
||||
Define_State("State_Init", State_Init);
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
Object.Take_Damage(10000) --Kill object
|
||||
end
|
||||
end
|
||||
152
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_KRAYT.LUA
Normal file
152
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_KRAYT.LUA
Normal file
@@ -0,0 +1,152 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/ObjectScript_Krayt.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/ObjectScript_Krayt.lua $
|
||||
--
|
||||
-- Original Author: James Yarrow
|
||||
--
|
||||
-- $Author: Brian_Hayes $
|
||||
--
|
||||
-- $Change: 637819 $
|
||||
--
|
||||
-- $DateTime: 2017/03/22 10:16:16 $
|
||||
--
|
||||
-- $Revision: #1 $
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init);
|
||||
Define_State("State_AI_Autofire", State_AI_Autofire)
|
||||
Define_State("State_Human_No_Autofire", State_Human_No_Autofire)
|
||||
Define_State("State_Human_Autofire", State_Human_Autofire)
|
||||
|
||||
nearby_unit_count = 0
|
||||
unit_trigger_number = 2
|
||||
threat_trigger_number = 1500
|
||||
ability_range = 400
|
||||
ability_name = "SELF_DESTRUCT"
|
||||
|
||||
recent_enemy_units = {}
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() ~= "Space" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
nearby_unit_count = 0
|
||||
nearby_unit_threat = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
Register_Prox(Object, Unit_Prox, ability_range)
|
||||
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
else
|
||||
Set_Next_State("State_AI_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_AI_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Get_Hull() < 0.5 then
|
||||
threat_fraction = 1.0 - (0.5 - Object.Get_Hull()) / 0.5
|
||||
if nearby_unit_threat >= threat_fraction * threat_trigger_number then
|
||||
Try_Ability(Object, ability_name)
|
||||
end
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_unit_count = 0
|
||||
nearby_unit_threat = 0
|
||||
recent_enemy_units = {}
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_No_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
Set_Next_State("State_Human_Autofire")
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_unit_count = 0
|
||||
nearby_unit_threat = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
if Object.Get_Hull() <= 0.2 and nearby_unit_count > 2 then
|
||||
Object.Activate_Ability(ability_name, true)
|
||||
end
|
||||
else
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_unit_count = 0
|
||||
nearby_unit_threat = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- If an enemy enters the prox, han may want to chase them down for stun
|
||||
function Unit_Prox(self_obj, trigger_obj)
|
||||
|
||||
if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
return
|
||||
end
|
||||
|
||||
--Promote to parent object (fighter squadron) for unit counting purposes
|
||||
if trigger_obj.Get_Parent_Object() then
|
||||
trigger_obj = trigger_obj.Get_Parent_Object()
|
||||
end
|
||||
|
||||
-- If we haven't seen this unit recently, track him
|
||||
if recent_enemy_units[trigger_obj] == nil then
|
||||
nearby_unit_count = nearby_unit_count + 1
|
||||
recent_enemy_units[trigger_obj] = trigger_obj
|
||||
nearby_unit_threat = nearby_unit_threat + trigger_obj.Get_Type().Get_Combat_Rating()
|
||||
end
|
||||
end
|
||||
156
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_MARAJADE.LUA
Normal file
156
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_MARAJADE.LUA
Normal file
@@ -0,0 +1,156 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/ObjectScript_MaraJade.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/ObjectScript_MaraJade.lua $
|
||||
--
|
||||
-- Original Author: James Yarrow
|
||||
--
|
||||
-- $Author: Brian_Hayes $
|
||||
--
|
||||
-- $Change: 637819 $
|
||||
--
|
||||
-- $DateTime: 2017/03/22 10:16:16 $
|
||||
--
|
||||
-- $Revision: #1 $
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
|
||||
-- Object script stuff
|
||||
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init);
|
||||
Define_State("State_AI_Autofire", State_AI_Autofire)
|
||||
Define_State("State_Human_No_Autofire", State_Human_No_Autofire)
|
||||
Define_State("State_Human_Autofire", State_Human_Autofire)
|
||||
|
||||
unit_trigger_number = 1
|
||||
divert_range = 300
|
||||
threat_trigger_number = 100
|
||||
ability_range = 100
|
||||
ability_name = "AREA_EFFECT_CONVERT"
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() ~= "Land" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
nearby_unit_count = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
Register_Prox(Object, Unit_Prox, ability_range)
|
||||
else
|
||||
Set_Next_State("State_AI_Autofire")
|
||||
Register_Prox(Object, Unit_Prox, divert_range)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_AI_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if (nearby_unit_count >= unit_trigger_number) then
|
||||
ConsiderDivertAndAOE(Object, ability_name, ability_range, recent_enemy_units, Object.Get_Hull() * threat_trigger_number)
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_unit_count = 0
|
||||
recent_enemy_units = {}
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_No_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
Set_Next_State("State_Human_Autofire")
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_unit_count = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
if nearby_unit_count >= unit_trigger_number then
|
||||
Object.Activate_Ability(ability_name, true)
|
||||
end
|
||||
else
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_unit_count = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function Unit_Prox(self_obj, trigger_obj)
|
||||
|
||||
-- Mara can only corrupt infantry
|
||||
if not trigger_obj.Is_Category("Infantry") then
|
||||
return
|
||||
end
|
||||
|
||||
-- Reject heroes, which we can't affect
|
||||
if trigger_obj.Is_Category("LandHero") then
|
||||
return
|
||||
end
|
||||
|
||||
if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
return
|
||||
end
|
||||
|
||||
--Promote to parent object (infantry squads) for unit counting purposes
|
||||
if trigger_obj.Get_Parent_Object() then
|
||||
trigger_obj = trigger_obj.Get_Parent_Object()
|
||||
end
|
||||
|
||||
if trigger_obj.Is_In_Garrison() then
|
||||
return
|
||||
end
|
||||
|
||||
-- If we haven't seen this unit recently, track him
|
||||
if recent_enemy_units[trigger_obj] == nil then
|
||||
nearby_unit_count = nearby_unit_count + 1
|
||||
recent_enemy_units[trigger_obj] = trigger_obj
|
||||
end
|
||||
end
|
||||
151
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_MC30.LUA
Normal file
151
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_MC30.LUA
Normal file
@@ -0,0 +1,151 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/ObjectScript_MC30.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/ObjectScript_MC30.lua $
|
||||
--
|
||||
-- Original Author: James Yarrow
|
||||
--
|
||||
-- $Author: Brian_Hayes $
|
||||
--
|
||||
-- $Change: 637819 $
|
||||
--
|
||||
-- $DateTime: 2017/03/22 10:16:16 $
|
||||
--
|
||||
-- $Revision: #1 $
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init);
|
||||
Define_State("State_AI_Autofire", State_AI_Autofire)
|
||||
Define_State("State_Human_No_Autofire", State_Human_No_Autofire)
|
||||
Define_State("State_Human_Autofire", State_Human_Autofire)
|
||||
|
||||
unit_trigger_number = 3
|
||||
threat_trigger_number = 1000
|
||||
cluster_bomb_range = 500
|
||||
ability_name = "CLUSTER_BOMB"
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() ~= "Space" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
nearby_unit_count = 0
|
||||
nearby_unit_threat = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
Register_Prox(Object, Unit_Prox, cluster_bomb_range)
|
||||
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
else
|
||||
Set_Next_State("State_AI_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_AI_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if nearby_unit_threat >= threat_trigger_number then
|
||||
Try_Ability(Object, ability_name)
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_unit_count = 0
|
||||
nearby_unit_threat = 0
|
||||
recent_enemy_units = {}
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_No_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
Set_Next_State("State_Human_Autofire")
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_unit_count = 0
|
||||
nearby_unit_threat = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
if nearby_unit_count > 2 then
|
||||
Object.Activate_Ability(ability_name, true)
|
||||
end
|
||||
else
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_unit_count = 0
|
||||
nearby_unit_threat = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- If an enemy enters the prox, han may want to chase them down for stun
|
||||
function Unit_Prox(self_obj, trigger_obj)
|
||||
|
||||
if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
return
|
||||
end
|
||||
|
||||
--Promote to parent object (fighter squadron) for unit counting purposes
|
||||
if trigger_obj.Get_Parent_Object() then
|
||||
trigger_obj = trigger_obj.Get_Parent_Object()
|
||||
end
|
||||
|
||||
--Ignore targets that are too close to be hit by the cluster bombs
|
||||
if self_obj.Get_Distance(trigger_obj) < 150.0 then
|
||||
return
|
||||
end
|
||||
|
||||
-- If we haven't seen this unit recently, track him
|
||||
if recent_enemy_units[trigger_obj] == nil then
|
||||
nearby_unit_count = nearby_unit_count + 1
|
||||
recent_enemy_units[trigger_obj] = trigger_obj
|
||||
nearby_unit_threat = nearby_unit_threat + trigger_obj.Get_Type().Get_Combat_Rating()
|
||||
end
|
||||
end
|
||||
110
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_MILLENNIUMFALCON.LUA
Normal file
110
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_MILLENNIUMFALCON.LUA
Normal file
@@ -0,0 +1,110 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/ObjectScript_MillenniumFalcon.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/ObjectScript_MillenniumFalcon.lua $
|
||||
--
|
||||
-- Original Author: James Yarrow
|
||||
--
|
||||
-- $Author: Brian_Hayes $
|
||||
--
|
||||
-- $Change: 637819 $
|
||||
--
|
||||
-- $DateTime: 2017/03/22 10:16:16 $
|
||||
--
|
||||
-- $Revision: #1 $
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
|
||||
function Definitions()
|
||||
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init);
|
||||
Define_State("State_AI_Autofire", State_AI_Autofire)
|
||||
Define_State("State_Human_No_Autofire", State_Human_No_Autofire)
|
||||
Define_State("State_Human_Autofire", State_Human_Autofire)
|
||||
|
||||
ability_name = "INVULNERABILITY"
|
||||
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() ~= "Space" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
nearby_unit_count = 0
|
||||
nearby_unit_threat = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
else
|
||||
Set_Next_State("State_AI_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_AI_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if TestValid(FindDeadlyEnemy(Object)) and Object.Get_Shield() < 0.2 then
|
||||
if Object.Is_Ability_Ready(ability_name) then
|
||||
Object.Activate_Ability(ability_name, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_No_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
Set_Next_State("State_Human_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
if TestValid(FindDeadlyEnemy(Object)) and Object.Get_Shield() < 0.05 and Object.Get_Hull() < 0.5 then
|
||||
if Object.Is_Ability_Ready(ability_name) then
|
||||
Object.Activate_Ability(ability_name, true)
|
||||
end
|
||||
end
|
||||
else
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
84
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_MINEFIELD.LUA
Normal file
84
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_MINEFIELD.LUA
Normal file
@@ -0,0 +1,84 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/ObjectScript_Minefield.lua
|
||||
-- Authors: Galyana and Nikomer
|
||||
-- Updated: 29 October, 2023
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In definitions", tostring(Script))
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init);
|
||||
Define_State("State_Idle", State_Idle);
|
||||
|
||||
ability_range = 300
|
||||
destruct_ability = "SELF_DESTRUCT"
|
||||
stealth_ability = "STEALTH"
|
||||
timer = 0
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() ~= "Space" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Register_Prox(Object, Unit_Prox, ability_range)
|
||||
Set_Next_State("State_Idle")
|
||||
else
|
||||
Register_Prox(Object, AI_Unit_Prox, ability_range)
|
||||
Set_Next_State("State_Idle")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_Idle(message)
|
||||
if message == OnUpdate then
|
||||
if timer == 0 then
|
||||
timer = 7000
|
||||
DebugMessage("%s -- Re-stealth", tostring(Script))
|
||||
Object.Reset_Ability_Counter()
|
||||
else
|
||||
timer = timer - 1
|
||||
end
|
||||
if Object.Has_Ability(stealth_ability) then
|
||||
if not Object.Is_Ability_Active(stealth_ability) then
|
||||
DebugMessage("%s -- Forcing stealth", tostring(Script))
|
||||
Object.Reset_Ability_Counter()
|
||||
Object.Activate_Ability(stealth_ability, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- If an enemy enters the prox, self destruct
|
||||
function Unit_Prox(self_obj, trigger_obj)
|
||||
if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
return
|
||||
end
|
||||
|
||||
-- do not trigger unless autofire is enabled
|
||||
if Object.Is_Ability_Autofire(destruct_ability) then
|
||||
if not Object.Is_Ability_Active(destruct_ability) then
|
||||
DebugMessage("%s -- BOOM!", tostring(Script))
|
||||
Object.Activate_Ability(destruct_ability, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- If an enemy enters the prox, self destruct
|
||||
function AI_Unit_Prox(self_obj, trigger_obj)
|
||||
if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
return
|
||||
end
|
||||
|
||||
-- AI does not use ability autofire
|
||||
if not Object.Is_Ability_Active(destruct_ability) then
|
||||
DebugMessage("%s -- BOOM!", tostring(Script))
|
||||
Object.Activate_Ability(destruct_ability, true)
|
||||
end
|
||||
end
|
||||
143
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_MINELAYER.LUA
Normal file
143
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_MINELAYER.LUA
Normal file
@@ -0,0 +1,143 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/ObjectScript_MineLayer.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 1 November, 2023
|
||||
|
||||
require("PGBase")
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init);
|
||||
Define_State("State_AI_Autofire", State_AI_Autofire)
|
||||
Define_State("State_Human_No_Autofire", State_Human_No_Autofire)
|
||||
Define_State("State_Human_Autofire", State_Human_Autofire)
|
||||
|
||||
ability_name = "DEPLOY_SQUAD"
|
||||
-- DEPLOY_SQUAD cannot be force activated via .Activate_Ability()
|
||||
-- Object.Activate_Ability(ability_name, true)
|
||||
|
||||
-- Prevent stacking minefields too close to each other
|
||||
unit_prox_range = 200
|
||||
unit_trigger_number = 1
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() ~= "Space" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
faction = Object.Get_Owner().Get_Faction_Name()
|
||||
|
||||
if faction == "REBEL" then
|
||||
ref_type = Find_Object_Type("Rebel_Minefield")
|
||||
elseif faction == "EMPIRE" then
|
||||
ref_type = Find_Object_Type("Empire_Minefield")
|
||||
elseif faction == "UNDERWORLD" then
|
||||
ref_type = Find_Object_Type("Underworld_Minefield")
|
||||
elseif faction == "HUTTS" then
|
||||
ref_type = Find_Object_Type("Hutt_Minefield")
|
||||
else
|
||||
-- Unknown faction, abort
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
Register_Prox(Object, Unit_Prox, unit_prox_range)
|
||||
nearby_minefield_count = 0
|
||||
recent_minefield_units = {}
|
||||
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
else
|
||||
-- AI does not use Deploy Squadron ability to spawn minefields
|
||||
-- Disable hangar minefields and only use scripted spawning for AI
|
||||
Object.Set_Garrison_Spawn(false)
|
||||
Set_Next_State("State_AI_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_AI_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if nearby_minefield_count >= unit_trigger_number then
|
||||
-- move to a new random location
|
||||
x,y,z = Object.Get_Position().Get_XYZ()
|
||||
pos = Create_Position((x + GameRandom(-500, 500)), (y + GameRandom(-500, 500)), z)
|
||||
Object.Move_To(pos)
|
||||
Sleep(10)
|
||||
elseif unit_trigger_number > nearby_minefield_count then
|
||||
if Object.Is_Ability_Ready(ability_name) then
|
||||
-- spawn a generic minefield without respect to hangar capacity
|
||||
position = Object.Get_Position()
|
||||
player = Object.Get_Owner()
|
||||
Create_Generic_Object(ref_type, position, player)
|
||||
Object.Force_Ability_Recharge(ability_name)
|
||||
|
||||
-- move to a new random location
|
||||
x,y,z = Object.Get_Position().Get_XYZ()
|
||||
pos = Create_Position((x + GameRandom(-500, 500)), (y + GameRandom(-500, 500)), z)
|
||||
Object.Move_To(pos)
|
||||
Sleep(20)
|
||||
end
|
||||
end
|
||||
|
||||
nearby_minefield_count = 0
|
||||
recent_minefield_units = {}
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_No_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
Set_Next_State("State_Human_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
if nearby_minefield_count >= unit_trigger_number then
|
||||
-- move to a new random location
|
||||
x,y,z = Object.Get_Position().Get_XYZ()
|
||||
pos = Create_Position((x + GameRandom(-500, 500)), (y + GameRandom(-500, 500)), z)
|
||||
Object.Move_To(pos)
|
||||
Sleep(10)
|
||||
elseif unit_trigger_number > nearby_minefield_count then
|
||||
if Object.Is_Ability_Ready(ability_name) then
|
||||
-- spawn a generic minefield without respect to hangar capacity
|
||||
position = Object.Get_Position()
|
||||
player = Object.Get_Owner()
|
||||
Create_Generic_Object(ref_type, position, player)
|
||||
Object.Force_Ability_Recharge(ability_name)
|
||||
|
||||
-- move to a new random location
|
||||
x,y,z = Object.Get_Position().Get_XYZ()
|
||||
pos = Create_Position((x + GameRandom(-500, 500)), (y + GameRandom(-500, 500)), z)
|
||||
Object.Move_To(pos)
|
||||
Sleep(20)
|
||||
end
|
||||
end
|
||||
else
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
end
|
||||
|
||||
nearby_minefield_count = 0
|
||||
recent_minefield_units = {}
|
||||
end
|
||||
end
|
||||
|
||||
function Unit_Prox(self_obj, trigger_obj)
|
||||
if not trigger_obj.Get_Type() == ref_type then
|
||||
return
|
||||
end
|
||||
|
||||
-- If we haven't seen this unit recently, track him
|
||||
if recent_minefield_units[trigger_obj] == nil and trigger_obj.Get_Type() == ref_type then
|
||||
nearby_minefield_count = nearby_minefield_count + 1
|
||||
recent_minefield_units[trigger_obj] = trigger_obj
|
||||
end
|
||||
end
|
||||
123
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_MISSILESHIELD.LUA
Normal file
123
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_MISSILESHIELD.LUA
Normal file
@@ -0,0 +1,123 @@
|
||||
-- $Id: //depot/Projects/StarWars_Expansion/Run/Data/Scripts/GameObject/ObjectScript_MissileShield.lua#2 $
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
--
|
||||
-- (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_Expansion/Run/Data/Scripts/GameObject/ObjectScript_MissileShield.lua $
|
||||
--
|
||||
-- Original Author: James Yarrow
|
||||
--
|
||||
-- $Author: James_Yarrow $
|
||||
--
|
||||
-- $Change: 51104 $
|
||||
--
|
||||
-- $DateTime: 2006/08/10 18:18:02 $
|
||||
--
|
||||
-- $Revision: #2 $
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init);
|
||||
Define_State("State_AI_Autofire", State_AI_Autofire)
|
||||
Define_State("State_Human_No_Autofire", State_Human_No_Autofire)
|
||||
Define_State("State_Human_Autofire", State_Human_Autofire)
|
||||
|
||||
ability_name = "MISSILE_SHIELD"
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() == "Galactic" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
else
|
||||
Set_Next_State("State_AI_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_AI_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Is_Ability_Ready(ability_name) then
|
||||
enemy = FindDeadlyEnemy(Object)
|
||||
if TestValid(enemy) then
|
||||
projectile_types = enemy.Get_All_Projectile_Types()
|
||||
for _, projectile in pairs(projectile_types) do
|
||||
if projectile.Is_Affected_By_Missile_Shield() or projectile.Is_Affected_By_Laser_Defense() then
|
||||
Object.Activate_Ability(ability_name, true)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Land units can change hands
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_No_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
Set_Next_State("State_Human_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
if Object.Is_Ability_Ready(ability_name) then
|
||||
enemy = FindDeadlyEnemy(Object)
|
||||
if TestValid(enemy) then
|
||||
projectile_types = enemy.Get_All_Projectile_Types()
|
||||
if projectile_types then
|
||||
for _, projectile in pairs(projectile_types) do
|
||||
if projectile.Is_Affected_By_Missile_Shield() or projectile.Is_Affected_By_Laser_Defense() then
|
||||
Object.Activate_Ability(ability_name, true)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
119
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_NIGHTSISTER.LUA
Normal file
119
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_NIGHTSISTER.LUA
Normal file
@@ -0,0 +1,119 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/ObjectScript_NightSister.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/ObjectScript_NightSister.lua $
|
||||
--
|
||||
-- Original Author: James Yarrow
|
||||
--
|
||||
-- $Author: Brian_Hayes $
|
||||
--
|
||||
-- $Change: 637819 $
|
||||
--
|
||||
-- $DateTime: 2017/03/22 10:16:16 $
|
||||
--
|
||||
-- $Revision: #1 $
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init);
|
||||
|
||||
drain_ability_name = "DRAIN_LIFE"
|
||||
unit_trigger_number = 4
|
||||
unit_low_health_trigger_number = 2
|
||||
divert_range = 400
|
||||
min_threat_to_use_drain = 10
|
||||
drain_area_of_effect = 100
|
||||
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
-- Bail out if this is a human player
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() ~= "Land" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
nearby_unit_count = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
-- Register a proximity around the unit at a range we're willing to divert for force confuse
|
||||
Register_Prox(Object, Divert_Prox, divert_range)
|
||||
|
||||
elseif message == OnUpdate then
|
||||
|
||||
if (nearby_unit_count >= unit_trigger_number) then
|
||||
ConsiderDivertAndAOE(Object, drain_ability_name, drain_area_of_effect, recent_enemy_units, min_threat_to_use_drain)
|
||||
elseif Object.Get_Hull() < 0.5 and (nearby_unit_count >= unit_low_health_trigger_number) then
|
||||
ConsiderDivertAndAOE(Object, drain_ability_name, drain_area_of_effect, recent_enemy_units, min_threat_to_use_drain)
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_unit_count = 0
|
||||
recent_enemy_units = {}
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- If an ally enters the prox, the unit may want to chase them down to use the ability
|
||||
function Divert_Prox(self_obj, trigger_obj)
|
||||
|
||||
if trigger_obj.Is_Category("Structure") then
|
||||
return
|
||||
end
|
||||
|
||||
if trigger_obj.Is_Category("LandHero") then
|
||||
return
|
||||
end
|
||||
|
||||
if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
return
|
||||
end
|
||||
|
||||
if trigger_obj.Is_In_Garrison() then
|
||||
return
|
||||
end
|
||||
|
||||
-- If we haven't seen this unit recently, track him
|
||||
if recent_enemy_units[trigger_obj] == nil then
|
||||
recent_enemy_units[trigger_obj] = trigger_obj
|
||||
nearby_unit_count = nearby_unit_count + 1
|
||||
end
|
||||
|
||||
end
|
||||
45
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_NIGHTSISTER_INDIG.LUA
Normal file
45
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_NIGHTSISTER_INDIG.LUA
Normal file
@@ -0,0 +1,45 @@
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In definitions", tostring(Script))
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init);
|
||||
|
||||
ability_range = 100
|
||||
ability_name = "DRAIN_LIFE"
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
-- Bail out if this is a human player
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() ~= "Land" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
Register_Prox(Object, Unit_Prox, ability_range)
|
||||
end
|
||||
end
|
||||
|
||||
-- If an enemy enters the prox, zap them
|
||||
function Unit_Prox(self_obj, trigger_obj)
|
||||
if trigger_obj.Is_Category("Structure") then
|
||||
return
|
||||
end
|
||||
|
||||
if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
return
|
||||
end
|
||||
|
||||
if trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
if Object.Is_Ability_Ready(ability_name) then
|
||||
Object.Activate_Ability(ability_name, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
126
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_POINTDEFENSE.LUA
Normal file
126
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_POINTDEFENSE.LUA
Normal file
@@ -0,0 +1,126 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/ObjectScript_PointDefense.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/ObjectScript_PointDefense.lua $
|
||||
--
|
||||
-- Original Author: James Yarrow
|
||||
--
|
||||
-- $Author: Brian_Hayes $
|
||||
--
|
||||
-- $Change: 637819 $
|
||||
--
|
||||
-- $DateTime: 2017/03/22 10:16:16 $
|
||||
--
|
||||
-- $Revision: #1 $
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init);
|
||||
Define_State("State_AI_Autofire", State_AI_Autofire)
|
||||
Define_State("State_Human_No_Autofire", State_Human_No_Autofire)
|
||||
Define_State("State_Human_Autofire", State_Human_Autofire)
|
||||
|
||||
ability_name = "LASER_DEFENSE"
|
||||
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() == "Galactic" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
else
|
||||
Set_Next_State("State_AI_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_AI_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Is_Ability_Ready(ability_name) then
|
||||
enemy = FindDeadlyEnemy(Object)
|
||||
if TestValid(enemy) then
|
||||
projectile_types = enemy.Get_All_Projectile_Types()
|
||||
for _, projectile in pairs(projectile_types) do
|
||||
if projectile.Is_Affected_By_Laser_Defense() then
|
||||
Object.Activate_Ability(ability_name, true)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--Land units can change hands
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_No_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
Set_Next_State("State_Human_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
if Object.Is_Ability_Ready(ability_name) then
|
||||
enemy = FindDeadlyEnemy(Object)
|
||||
if TestValid(enemy) then
|
||||
projectile_types = enemy.Get_All_Projectile_Types()
|
||||
if projectile_types then
|
||||
for _, projectile in pairs(projectile_types) do
|
||||
if projectile.Is_Affected_By_Laser_Defense() then
|
||||
Object.Activate_Ability(ability_name, true)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
94
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_POWERTOSHIELDS.LUA
Normal file
94
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_POWERTOSHIELDS.LUA
Normal file
@@ -0,0 +1,94 @@
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
-- (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/GameObject/ObjectScript_PowerToShields.LUA
|
||||
--
|
||||
-- Original Editor: Giovanni Galyana
|
||||
--
|
||||
-- Final Edit By: Giovanni Galyana
|
||||
--
|
||||
-- Date: 18 February, 2017
|
||||
--
|
||||
-- Revisions: 2
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init);
|
||||
Define_State("State_AI_Autofire", State_AI_Autofire)
|
||||
Define_State("State_Human_No_Autofire", State_Human_No_Autofire)
|
||||
Define_State("State_Human_Autofire", State_Human_Autofire)
|
||||
|
||||
ability_name = "DEFEND"
|
||||
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() ~= "Space" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
else
|
||||
Set_Next_State("State_AI_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_AI_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Get_Rate_Of_Damage_Taken() > 25.0 and Object.Get_Shield() < 0.7 then
|
||||
if Object.Is_Ability_Ready(ability_name) then
|
||||
Object.Activate_Ability(ability_name, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_No_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
Set_Next_State("State_Human_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
if Object.Get_Rate_Of_Damage_Taken() > 25.0 and Object.Get_Shield() < 0.5 then
|
||||
if Object.Is_Ability_Ready(ability_name) then
|
||||
Object.Activate_Ability(ability_name, true)
|
||||
end
|
||||
end
|
||||
else
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
69
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_POWERTOSHIELDS_MC99.LUA
Normal file
69
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_POWERTOSHIELDS_MC99.LUA
Normal file
@@ -0,0 +1,69 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/ObjectScript_PowerToShields_MC99.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 18 February, 2017
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init);
|
||||
Define_State("State_AI_Autofire", State_AI_Autofire)
|
||||
Define_State("State_Human_No_Autofire", State_Human_No_Autofire)
|
||||
Define_State("State_Human_Autofire", State_Human_Autofire)
|
||||
|
||||
ability_name = "DEFEND"
|
||||
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() ~= "Space" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
else
|
||||
Set_Next_State("State_AI_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_AI_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Get_Rate_Of_Damage_Taken() > 60.0 and Object.Get_Shield() < 0.7 then
|
||||
if Object.Is_Ability_Ready(ability_name) then
|
||||
Object.Activate_Ability(ability_name, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_No_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
Set_Next_State("State_Human_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
if Object.Get_Rate_Of_Damage_Taken() > 60.0 and Object.Get_Shield() < 0.7 then
|
||||
if Object.Is_Ability_Ready(ability_name) then
|
||||
Object.Activate_Ability(ability_name, true)
|
||||
end
|
||||
end
|
||||
else
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
108
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_REMOTEBOMB.LUA
Normal file
108
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_REMOTEBOMB.LUA
Normal file
@@ -0,0 +1,108 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/ObjectScript_RemoteBomb.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/ObjectScript_RemoteBomb.lua $
|
||||
--
|
||||
-- Original Author: James Yarrow
|
||||
--
|
||||
-- $Author: Brian_Hayes $
|
||||
--
|
||||
-- $Change: 637819 $
|
||||
--
|
||||
-- $DateTime: 2017/03/22 10:16:16 $
|
||||
--
|
||||
-- $Revision: #1 $
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init);
|
||||
|
||||
nearby_threat = 0
|
||||
nearby_enemies = {}
|
||||
|
||||
threat_threshold = 200.0
|
||||
detonate_range = 150.0
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
-- Bail out if this is a human player
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() ~= "Land" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
nearby_threat = 0
|
||||
nearby_enemies = {}
|
||||
|
||||
-- Register a proximity around the unit at a range we're willing to divert for force confuse
|
||||
Register_Prox(Object, Detonate_Prox, detonate_range)
|
||||
|
||||
elseif message == OnUpdate then
|
||||
|
||||
nearby_threat = 0
|
||||
nearby_enemies = {}
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function Detonate_Prox(self_obj, trigger_obj)
|
||||
|
||||
if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
return
|
||||
end
|
||||
|
||||
if trigger_obj.Is_In_Garrison() then
|
||||
return
|
||||
end
|
||||
|
||||
if nearby_enemies[trigger_obj] == nil then
|
||||
nearby_enemies[trigger_obj] = trigger_obj
|
||||
nearby_threat = nearby_threat + trigger_obj.Get_Type().Get_Combat_Rating()
|
||||
|
||||
if nearby_threat >= threat_threshold then
|
||||
saboteur = Find_First_Object("Underworld_Saboteur", Find_Player("UNDERWORLD"))
|
||||
if TestValid(saboteur) then
|
||||
Try_Ability(saboteur, "DETONATE_REMOTE_BOMB")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
153
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_SELFDESTRUCTLAND.LUA
Normal file
153
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_SELFDESTRUCTLAND.LUA
Normal file
@@ -0,0 +1,153 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/ObjectScript_SelfDestructLand.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/ObjectScript_SelfDestructLand.lua $
|
||||
--
|
||||
-- Original Author: Steve_Copeland
|
||||
--
|
||||
-- $Author: Brian_Hayes $
|
||||
--
|
||||
-- $Change: 637819 $
|
||||
--
|
||||
-- $DateTime: 2017/03/22 10:16:16 $
|
||||
--
|
||||
-- $Revision: #1 $
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
|
||||
-- Object script stuff
|
||||
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init);
|
||||
Define_State("State_AI_Autofire", State_AI_Autofire)
|
||||
Define_State("State_Human_No_Autofire", State_Human_No_Autofire)
|
||||
Define_State("State_Human_Autofire", State_Human_Autofire)
|
||||
|
||||
unit_trigger_number = 2
|
||||
divert_range = 300
|
||||
threat_trigger_number = 300
|
||||
ability_range = 120
|
||||
ability_name = "SELF_DESTRUCT"
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() ~= "Land" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
nearby_unit_count = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
Register_Prox(Object, Unit_Prox, ability_range)
|
||||
else
|
||||
Set_Next_State("State_AI_Autofire")
|
||||
Register_Prox(Object, Unit_Prox, divert_range)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_AI_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if (nearby_unit_count >= unit_trigger_number) then
|
||||
ConsiderDivertAndAOE(Object, ability_name, ability_range, recent_enemy_units, Object.Get_Hull() * threat_trigger_number)
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_unit_count = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
--Land units can change hands
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
Object.Cancel_Event_Object_In_Range(Unit_Prox)
|
||||
Register_Prox(Object, Unit_Prox, ability_range)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_No_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
Set_Next_State("State_Human_Autofire")
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_unit_count = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
if Object.Get_Hull() <= 0.2 and nearby_unit_count >= unit_trigger_number then
|
||||
Object.Activate_Ability(ability_name, true)
|
||||
end
|
||||
else
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_unit_count = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function Unit_Prox(self_obj, trigger_obj)
|
||||
|
||||
if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
return
|
||||
end
|
||||
|
||||
--Promote to parent object (infantry squads) for unit counting purposes
|
||||
if trigger_obj.Get_Parent_Object() then
|
||||
trigger_obj = trigger_obj.Get_Parent_Object()
|
||||
end
|
||||
|
||||
if trigger_obj.Is_In_Garrison() then
|
||||
return
|
||||
end
|
||||
|
||||
-- If we haven't seen this unit recently, track him
|
||||
if recent_enemy_units[trigger_obj] == nil then
|
||||
nearby_unit_count = nearby_unit_count + 1
|
||||
recent_enemy_units[trigger_obj] = trigger_obj
|
||||
end
|
||||
end
|
||||
20
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_SENTRYTURRET.LUA
Normal file
20
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_SENTRYTURRET.LUA
Normal file
@@ -0,0 +1,20 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/ObjectScript_SentryTurret.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- Kills the orion dreadnaught's sentry turrets after X seconds
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
ServiceRate = 1
|
||||
Define_State("State_Init", State_Init);
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
Sleep(60)
|
||||
Object.Take_Damage(10000) --Kill object after X sec
|
||||
end
|
||||
end
|
||||
229
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_SILRI.LUA
Normal file
229
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_SILRI.LUA
Normal file
@@ -0,0 +1,229 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/ObjectScript_Silri.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/ObjectScript_Silri.lua $
|
||||
--
|
||||
-- Original Author: Steve_Copeland
|
||||
--
|
||||
-- $Author: Brian_Hayes $
|
||||
--
|
||||
-- $Change: 637819 $
|
||||
--
|
||||
-- $DateTime: 2017/03/22 10:16:16 $
|
||||
--
|
||||
-- $Revision: #1 $
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
-- This include order is important. We need the state service defined in main to override the one in heroplanattach.
|
||||
require("HeroPlanAttach")
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
DebugMessage("%s -- In Definitions", tostring(Script))
|
||||
|
||||
-- only join plans that meet our expense requirements.
|
||||
MinPlanAttachCost = 5000
|
||||
MaxPlanAttachCost = 0
|
||||
|
||||
-- Commander hit list.
|
||||
Attack_Ability_Type_Names = { "All" }
|
||||
Attack_Ability_Weights = { 1 }
|
||||
Attack_Ability_Types = WeightedTypeList.Create()
|
||||
Attack_Ability_Types.Parse(Attack_Ability_Type_Names, Attack_Ability_Weights)
|
||||
|
||||
-- Prefer task forces with these units.
|
||||
Escort_Ability_Type_Names = { "All" }
|
||||
Escort_Ability_Weights = { 1 }
|
||||
Escort_Ability_Types = WeightedTypeList.Create()
|
||||
Escort_Ability_Types.Parse(Escort_Ability_Type_Names, Escort_Ability_Weights)
|
||||
|
||||
-- tactical behavior stuff
|
||||
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init);
|
||||
Define_State("State_AI_Autofire", State_AI_Autofire)
|
||||
Define_State("State_Human_No_Autofire", State_Human_No_Autofire)
|
||||
Define_State("State_Human_Autofire", State_Human_Autofire)
|
||||
|
||||
summon_ability_name = "SUMMON"
|
||||
drain_ability_name = "DRAIN_LIFE"
|
||||
unit_trigger_number = 10
|
||||
divert_range = 400
|
||||
min_threat_to_use_drain = 10
|
||||
drain_area_of_effect = 100
|
||||
|
||||
stealth_reveal_range = 250
|
||||
stealth_ability = "STEALTH"
|
||||
|
||||
end
|
||||
|
||||
function Evaluate_Attack_Ability(target, goal)
|
||||
return Get_Target_Weight(target, Attack_Ability_Types, Attack_Ability_Weights)
|
||||
end
|
||||
|
||||
function Get_Escort_Ability_Weights(goal)
|
||||
return Escort_Ability_Types
|
||||
end
|
||||
|
||||
function HeroService()
|
||||
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() ~= "Land" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
nearby_unit_count = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
Register_Prox(Object, Unit_Reveal_Prox, stealth_reveal_range)
|
||||
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Register_Prox(Object, Unit_Prox, drain_area_of_effect)
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
else
|
||||
Register_Prox(Object, Unit_Prox, divert_range)
|
||||
Set_Next_State("State_AI_Autofire")
|
||||
rancor_thread = Create_Thread("Must_Summon_More_Rancors")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_AI_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Get_Hull() < 1.0 and Object.Is_Ability_Ready(drain_ability_name) then
|
||||
ConsiderDivertAndAOE(Object, drain_ability_name, drain_area_of_effect, recent_enemy_units, min_threat_to_use_drain)
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_unit_count = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
--Need to be able to handle Silri changing hands even though she's a hero unit and so
|
||||
--normally immune to ownership changes: there's a case in the story campaign where this is an issue.
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Create_Thread.Kill(rancor_thread)
|
||||
Object.Cancel_Event_Object_In_Range(Unit_Prox)
|
||||
Register_Prox(Object, Unit_Prox, drain_area_of_effect)
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_No_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Is_Ability_Autofire(drain_ability_name) then
|
||||
Set_Next_State("State_Human_Autofire")
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_unit_count = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Is_Ability_Autofire(drain_ability_name) then
|
||||
if Object.Get_Hull() < 0.5 and nearby_unit_count > 2 then
|
||||
Object.Activate_Ability(drain_ability_name, true)
|
||||
end
|
||||
else
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_unit_count = 0
|
||||
recent_enemy_units = {}
|
||||
end
|
||||
end
|
||||
|
||||
-- If an ally enters the prox, the unit may want to chase them down to use the ability
|
||||
function Unit_Prox(self_obj, trigger_obj)
|
||||
|
||||
if trigger_obj.Is_Category("Structure") then
|
||||
return
|
||||
end
|
||||
|
||||
if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
return
|
||||
end
|
||||
|
||||
--Promote to parent object (infantry teams) for unit counting purposes
|
||||
if trigger_obj.Get_Parent_Object() then
|
||||
trigger_obj = trigger_obj.Get_Parent_Object()
|
||||
end
|
||||
|
||||
if trigger_obj.Is_In_Garrison() then
|
||||
return
|
||||
end
|
||||
|
||||
-- If we haven't seen this unit recently, track him
|
||||
if recent_enemy_units[trigger_obj] == nil then
|
||||
recent_enemy_units[trigger_obj] = trigger_obj
|
||||
nearby_unit_count = nearby_unit_count + 1
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function Must_Summon_More_Rancors()
|
||||
|
||||
while true do
|
||||
|
||||
Sleep(15)
|
||||
|
||||
if Object.Is_Ability_Ready(summon_ability_name) then
|
||||
|
||||
cast_target = Find_Nearest(Object, Object.Get_Owner(), false)
|
||||
if TestValid(cast_target) and cast_target.Get_Distance(Object) < 150.0 then
|
||||
Object.Activate_Ability(summon_ability_name, cast_target)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- If a stealthed enemy enters the prox, disable their stealth ability
|
||||
function Unit_Reveal_Prox(self_obj, trigger_obj)
|
||||
if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
return
|
||||
end
|
||||
|
||||
if trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
if trigger_obj.Is_Ability_Active(stealth_ability) then
|
||||
if Is_Campaign_Game() == true then
|
||||
trigger_obj.Cancel_Ability(stealth_ability)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
26
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_SPAWNHEALER.LUA
Normal file
26
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_SPAWNHEALER.LUA
Normal file
@@ -0,0 +1,26 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/ObjectScript_SpawnHealer.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- Spawns the repair satellite's self repair healer
|
||||
|
||||
require("PGStateMachine")
|
||||
require("PGSpawnUnits")
|
||||
|
||||
function Definitions()
|
||||
ServiceRate = 1
|
||||
Define_State("State_Init", State_Init);
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
ref_type = Find_Object_Type("Rebel_Defense_Satellite_Repair_Healer")
|
||||
position = Object.Get_Position()
|
||||
player = Object.Get_Owner()
|
||||
|
||||
if message == OnEnter then
|
||||
Create_Generic_Object(ref_type, position, player)
|
||||
end
|
||||
|
||||
ScriptExit()
|
||||
end
|
||||
24
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_SPAWNIONNEBULA.LUA
Normal file
24
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_SPAWNIONNEBULA.LUA
Normal file
@@ -0,0 +1,24 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/ObjectScript_SpawnIonNebula.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- Spawns the emitter satellite's ion storm nebula
|
||||
|
||||
require("PGStateMachine")
|
||||
require("PGSpawnUnits")
|
||||
|
||||
function Definitions()
|
||||
ServiceRate = 1
|
||||
Define_State("State_Init", State_Init);
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
ref_type = Find_Object_Type("Nebula_Ion_Storm_Emitter")
|
||||
position = Object.Get_Position()
|
||||
player = Object.Get_Owner()
|
||||
|
||||
if message == OnEnter then
|
||||
Spawn_Unit(ref_type, position, player)
|
||||
end
|
||||
end
|
||||
30
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_SPAWNLANDBASEHEALER.LUA
Normal file
30
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_SPAWNLANDBASEHEALER.LUA
Normal file
@@ -0,0 +1,30 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/ObjectScript_SpawnLandBaseHealer.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- Heals all structures at game start to fix an odd bug
|
||||
|
||||
require("PGStateMachine")
|
||||
require("PGSpawnUnits")
|
||||
|
||||
function Definitions()
|
||||
ServiceRate = 1
|
||||
Define_State("State_Init", State_Init);
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
ref_type = Find_Object_Type("Generic_Land_Base_Healing_Marker")
|
||||
position = Object.Get_Position()
|
||||
player = Object.Get_Owner()
|
||||
|
||||
if message == OnEnter then
|
||||
Sleep(3) -- Allow units to spawn
|
||||
|
||||
healer = Create_Generic_Object(ref_type, position, player)
|
||||
Sleep(1)
|
||||
healer.Despawn()
|
||||
end
|
||||
|
||||
ScriptExit()
|
||||
end
|
||||
39
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_SPAWNSTARBASEHEALER.LUA
Normal file
39
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_SPAWNSTARBASEHEALER.LUA
Normal file
@@ -0,0 +1,39 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/ObjectScript_SpawnStarBaseHealer.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- Heals all stations at game start to fix an odd bug
|
||||
-- Hardpoints will be full healed but stations will still show missing health on healthbar
|
||||
|
||||
require("PGStateMachine")
|
||||
require("PGSpawnUnits")
|
||||
|
||||
function Definitions()
|
||||
ServiceRate = 1
|
||||
Define_State("State_Init", State_Init);
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
ref_type = Find_Object_Type("Generic_Starbase_Healing_Marker")
|
||||
position = Object.Get_Position()
|
||||
player = Object.Get_Owner()
|
||||
|
||||
if message == OnEnter then
|
||||
Sleep(3)
|
||||
|
||||
-- We don't want additional healers spawning if a new level 1 base is constructed
|
||||
if GetCurrentTime() >= 30 then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
-- Only spawn the healer if our health is below 100%
|
||||
if Object.Get_Health() < 1.0 then
|
||||
healer = Create_Generic_Object(ref_type, position, player)
|
||||
Sleep(5)
|
||||
healer.Despawn()
|
||||
end
|
||||
end
|
||||
|
||||
ScriptExit()
|
||||
end
|
||||
@@ -0,0 +1,41 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/ObjectScript_Spawn_Hero_Red_Squadron_Space.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- We need to spawn them this way to restrict this hero to 1 per team
|
||||
|
||||
require("PGStateMachine")
|
||||
require("PGSpawnUnits")
|
||||
|
||||
function Definitions()
|
||||
ServiceRate = 1
|
||||
Define_State("State_Init", State_Init);
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
Sleep(5) --Hyperspace time
|
||||
Object.Suspend_Locomotor(true)
|
||||
Object.Hide(true)
|
||||
Object.Prevent_All_Fire(true)
|
||||
|
||||
ref_type = Find_Object_Type("Red_Squadron")
|
||||
position = Object.Get_Position()
|
||||
player = Object.Get_Owner()
|
||||
|
||||
herolist = Spawn_Unit(ref_type, position, player) -- Need Spawn_Unit() for Squadrons
|
||||
hero = herolist[1]
|
||||
|
||||
--hero.Enable_Behavior(24, false) -- Behavior 24 is REVEAL
|
||||
hero.Teleport_And_Face(Object)
|
||||
--hero.Cinematic_Hyperspace_In(1) -- Doesn't work for squadrons
|
||||
--Sleep(3)
|
||||
--hero.Enable_Behavior(24, true)
|
||||
|
||||
elseif message == OnUpdate then
|
||||
if hero.Is_Valid() == false then
|
||||
Object.Despawn()
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,39 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/ObjectScript_Spawn_Hero_Vader_Space.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
-- We need to spawn them this way to restrict this hero to 1 per team
|
||||
|
||||
require("PGStateMachine")
|
||||
require("PGSpawnUnits")
|
||||
|
||||
function Definitions()
|
||||
ServiceRate = 1
|
||||
Define_State("State_Init", State_Init);
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
--Sleep(5) --Hyperspace time
|
||||
--Object.Suspend_Locomotor(true)
|
||||
Object.Hide(true)
|
||||
Object.Prevent_All_Fire(true)
|
||||
|
||||
ref_type = Find_Object_Type("TIE_Prototype")
|
||||
position = Object.Get_Position()
|
||||
player = Object.Get_Owner()
|
||||
|
||||
hero = Create_Generic_Object(ref_type, position, player)
|
||||
hero.Enable_Behavior(24, false) -- Behavior 24 is REVEAL
|
||||
hero.Teleport_And_Face(Object)
|
||||
hero.Cinematic_Hyperspace_In(1)
|
||||
Sleep(3)
|
||||
hero.Enable_Behavior(24, true)
|
||||
|
||||
elseif message == OnUpdate then
|
||||
if hero.Is_Valid() == false then
|
||||
Object.Despawn()
|
||||
end
|
||||
end
|
||||
end
|
||||
111
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_SPECTRE.LUA
Normal file
111
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_SPECTRE.LUA
Normal file
@@ -0,0 +1,111 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/ObjectScript_Spectre.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 6 February, 2026
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init);
|
||||
Define_State("State_AI_Autofire", State_AI_Autofire)
|
||||
Define_State("State_Human_No_Autofire", State_Human_No_Autofire)
|
||||
Define_State("State_Human_Autofire", State_Human_Autofire)
|
||||
|
||||
unit_trigger_number = 3
|
||||
threat_trigger_number = 1200
|
||||
-- cluster bomb damage range is 600, make prox slightly smaller so units are more likely to get hit
|
||||
cluster_bomb_range = 550
|
||||
ability_name = "CLUSTER_BOMB"
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() ~= "Space" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
nearby_unit_count = 0
|
||||
nearby_unit_threat = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
Register_Prox(Object, Unit_Prox, cluster_bomb_range)
|
||||
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
else
|
||||
Set_Next_State("State_AI_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_AI_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if nearby_unit_threat >= threat_trigger_number then
|
||||
Try_Ability(Object, ability_name)
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_unit_count = 0
|
||||
nearby_unit_threat = 0
|
||||
recent_enemy_units = {}
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_No_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
Set_Next_State("State_Human_Autofire")
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_unit_count = 0
|
||||
nearby_unit_threat = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
if nearby_unit_count > 2 then
|
||||
Object.Activate_Ability(ability_name, true)
|
||||
end
|
||||
else
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_unit_count = 0
|
||||
nearby_unit_threat = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- If an enemy enters the prox, han may want to chase them down for stun
|
||||
function Unit_Prox(self_obj, trigger_obj)
|
||||
|
||||
if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
return
|
||||
end
|
||||
|
||||
--Promote to parent object (fighter squadron) for unit counting purposes
|
||||
if trigger_obj.Get_Parent_Object() then
|
||||
trigger_obj = trigger_obj.Get_Parent_Object()
|
||||
end
|
||||
|
||||
-- If we haven't seen this unit recently, track him
|
||||
if recent_enemy_units[trigger_obj] == nil then
|
||||
nearby_unit_count = nearby_unit_count + 1
|
||||
recent_enemy_units[trigger_obj] = trigger_obj
|
||||
nearby_unit_threat = nearby_unit_threat + trigger_obj.Get_Type().Get_Combat_Rating()
|
||||
end
|
||||
end
|
||||
94
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_T6A.LUA
Normal file
94
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_T6A.LUA
Normal file
@@ -0,0 +1,94 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/ObjectScript_T6A.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 2 January, 2024
|
||||
|
||||
require("PGStateMachine")
|
||||
require("PGBase")
|
||||
|
||||
function Definitions()
|
||||
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init);
|
||||
Define_State("State_AI_Autofire", State_AI_Autofire)
|
||||
Define_State("State_Human_No_Autofire", State_Human_No_Autofire)
|
||||
|
||||
ability_name = "POWER_TO_WEAPONS"
|
||||
unit_trigger_number = 1
|
||||
threat_trigger_number = 50
|
||||
targeting_range = 300
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() ~= "Land" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
-- Register a proximity around the unit
|
||||
Register_Prox(Object, Unit_Prox, targeting_range)
|
||||
|
||||
nearby_unit_count = 0
|
||||
nearby_unit_threat = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
else
|
||||
Set_Next_State("State_AI_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_AI_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if (nearby_unit_count >= unit_trigger_number and nearby_unit_threat >= threat_trigger_number) then
|
||||
Object.Activate_Ability(ability_name, true)
|
||||
else
|
||||
Object.Activate_Ability(ability_name, false)
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_unit_count = 0
|
||||
nearby_unit_threat = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
--Land units can change hands
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_No_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
|
||||
--Land units can change hands
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Sleep(1)
|
||||
else
|
||||
Set_Next_State("State_AI_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- If any enemy vehicle enters the prox, anchor to increase damage and shield regen
|
||||
function Unit_Prox(self_obj, trigger_obj)
|
||||
if not trigger_obj.Is_Category("Vehicle") then
|
||||
return
|
||||
end
|
||||
|
||||
if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
return
|
||||
end
|
||||
|
||||
-- If we haven't seen this unit recently, track him
|
||||
if recent_enemy_units[trigger_obj] == nil then
|
||||
recent_enemy_units[trigger_obj] = trigger_obj
|
||||
nearby_unit_count = nearby_unit_count + 1
|
||||
nearby_unit_threat = nearby_unit_threat + trigger_obj.Get_Type().Get_Combat_Rating()
|
||||
end
|
||||
end
|
||||
109
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_TRACTOR_SATELLITE.LUA
Normal file
109
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_TRACTOR_SATELLITE.LUA
Normal file
@@ -0,0 +1,109 @@
|
||||
-- Star Wars Empire at War: Secrets of a Fallen Empire
|
||||
-- Lua Script: //Scripts/GameObject/ObjectScript_Tractor_Satellite.lua
|
||||
-- Author: Galyana
|
||||
-- Updated: 29 January, 2026
|
||||
|
||||
--Allows the tractor beam satellite to function for ai players
|
||||
--Also allows autofire to work for human players
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init);
|
||||
Define_State("State_AI_Autofire", State_AI_Autofire)
|
||||
Define_State("State_Human_No_Autofire", State_Human_No_Autofire)
|
||||
Define_State("State_Human_Autofire", State_Human_Autofire)
|
||||
|
||||
ability_name = "TRACTOR_BEAM"
|
||||
-- Satellite tractor range is 2000, let the target get closer so they don't immediately fly away
|
||||
-- Satellite vision range is 1350, it can target units the player cannot see
|
||||
-- ability_range = 1500
|
||||
|
||||
stealth_ability = "STEALTH"
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() == "Galactic" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
else
|
||||
Set_Next_State("State_AI_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_AI_Autofire(message)
|
||||
if message == OnEnter then
|
||||
Register_Prox(Object, Unit_Prox, 1500) -- Give the AI player a longer range
|
||||
end
|
||||
|
||||
if message == OnUpdate then
|
||||
--This satellite can be captured by a Hutt player
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_No_Autofire(message)
|
||||
-- Turn off prox check if autofire is disabled
|
||||
if message == OnEnter then
|
||||
Object.Cancel_Event_Object_In_Range(Unit_Prox)
|
||||
end
|
||||
|
||||
if message == OnUpdate then
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
Set_Next_State("State_Human_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_Autofire(message)
|
||||
if message == OnEnter then
|
||||
Register_Prox(Object, Unit_Prox, 1000)
|
||||
end
|
||||
|
||||
if message == OnUpdate then
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
return
|
||||
else
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
-- Tractor beam first target that enters range
|
||||
function Unit_Prox(self_obj, trigger_obj)
|
||||
if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
return
|
||||
end
|
||||
|
||||
-- ignore stealthed enemies
|
||||
if trigger_obj.Is_Ability_Active(stealth_ability) then
|
||||
return
|
||||
end
|
||||
|
||||
-- prevent multiple tractor beams hitting one target
|
||||
if trigger_obj.Is_Under_Effects_Of_Ability(ability_name) then
|
||||
return
|
||||
end
|
||||
|
||||
-- hold enemy until it dies or escapes
|
||||
if Object.Is_Ability_Active(ability_name) then
|
||||
return
|
||||
end
|
||||
|
||||
if trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
if trigger_obj.Is_Category("Transport | Corvette | Frigate | SpaceHero") then
|
||||
Object.Activate_Ability(ability_name, trigger_obj)
|
||||
end
|
||||
end
|
||||
end
|
||||
186
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_URAI.LUA
Normal file
186
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_URAI.LUA
Normal file
@@ -0,0 +1,186 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/ObjectScript_Urai.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/ObjectScript_Urai.lua $
|
||||
--
|
||||
-- Original Author: Steve_Copeland
|
||||
--
|
||||
-- $Author: Brian_Hayes $
|
||||
--
|
||||
-- $Change: 637819 $
|
||||
--
|
||||
-- $DateTime: 2017/03/22 10:16:16 $
|
||||
--
|
||||
-- $Revision: #1 $
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
-- This include order is important. We need the state service defined in main to override the one in heroplanattach.
|
||||
require("HeroPlanAttach")
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
|
||||
|
||||
-- Hero plan self attachment stuff
|
||||
|
||||
-- only join plans that meet our expense requirements.
|
||||
MinPlanAttachCost = 5000
|
||||
MaxPlanAttachCost = 0
|
||||
|
||||
-- Commander hit list.
|
||||
Attack_Ability_Type_Names = {"Infantry", "Fighter", "Corvette" }
|
||||
Attack_Ability_Weights = { 1, 1, BAD_WEIGHT }
|
||||
Attack_Ability_Types = WeightedTypeList.Create()
|
||||
Attack_Ability_Types.Parse(Attack_Ability_Type_Names, Attack_Ability_Weights)
|
||||
|
||||
-- Prefer task forces with these units.
|
||||
Escort_Ability_Type_Names = { "All" }
|
||||
Escort_Ability_Weights = { 1.0 }
|
||||
Escort_Ability_Types = WeightedTypeList.Create()
|
||||
Escort_Ability_Types.Parse(Escort_Ability_Type_Names, Escort_Ability_Weights)
|
||||
|
||||
|
||||
-- Object script stuff
|
||||
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init)
|
||||
Define_State("State_AI_Autofire", State_AI_Autofire)
|
||||
Define_State("State_Human_No_Autofire", State_Human_No_Autofire)
|
||||
Define_State("State_Human_Autofire", State_Human_Autofire)
|
||||
|
||||
unit_trigger_number = 3
|
||||
divert_range = 300
|
||||
min_threat_to_use_stun = 50
|
||||
stun_area_of_effect = 75
|
||||
stun_ability_name = "STUN"
|
||||
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() ~= "Land" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
nearby_stun_count = 0
|
||||
recent_stun_units = {}
|
||||
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Register_Prox(Object, Urai_Stun_Prox, stun_area_of_effect)
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
else
|
||||
Register_Prox(Object, Urai_Stun_Prox, divert_range)
|
||||
Set_Next_State("State_AI_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_AI_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if (nearby_stun_count >= unit_trigger_number) then
|
||||
ConsiderDivertAndAOE(Object, stun_ability_name, stun_area_of_effect, recent_stun_units, Object.Get_Hull() * min_threat_to_use_stun)
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_stun_count = 0
|
||||
recent_stun_units = {}
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_No_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Is_Ability_Autofire(stun_ability_name) then
|
||||
Set_Next_State("State_Human_Autofire")
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_stun_count = 0
|
||||
recent_stun_units = {}
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
|
||||
if Object.Is_Ability_Autofire(stun_ability_name) then
|
||||
if nearby_stun_count > 2 then
|
||||
Object.Activate_Ability(stun_ability_name, true)
|
||||
end
|
||||
else
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_stun_count = 0
|
||||
recent_stun_units = {}
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function Urai_Stun_Prox(self_obj, trigger_obj)
|
||||
|
||||
if not trigger_obj.Is_Category("Infantry") then
|
||||
return
|
||||
end
|
||||
|
||||
trigger_parent = trigger_obj.Get_Parent_Object()
|
||||
if TestValid(trigger_parent) then
|
||||
trigger_obj = trigger_parent
|
||||
end
|
||||
|
||||
-- Reject heroes, which we can't affect
|
||||
if trigger_obj.Is_Category("LandHero") then
|
||||
return
|
||||
end
|
||||
|
||||
if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
return
|
||||
end
|
||||
|
||||
if trigger_obj.Is_In_Garrison() then
|
||||
return
|
||||
end
|
||||
|
||||
-- If we haven't seen this unit recently, track him
|
||||
if recent_stun_units[trigger_obj] == nil then
|
||||
recent_stun_units[trigger_obj] = trigger_obj
|
||||
nearby_stun_count = nearby_stun_count + 1
|
||||
end
|
||||
end
|
||||
|
||||
function Evaluate_Attack_Ability(target, goal)
|
||||
return Get_Target_Weight(target, Attack_Ability_Types, Attack_Ability_Weights)
|
||||
end
|
||||
|
||||
function Get_Escort_Ability_Weights(goal)
|
||||
return Escort_Ability_Types
|
||||
end
|
||||
105
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_VADERTIESQUADRON.LUA
Normal file
105
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_VADERTIESQUADRON.LUA
Normal file
@@ -0,0 +1,105 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/ObjectScript_VaderTIESquadron.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/ObjectScript_VaderTIESquadron.lua $
|
||||
--
|
||||
-- Original Author: James Yarrow
|
||||
--
|
||||
-- $Author: Brian_Hayes $
|
||||
--
|
||||
-- $Change: 637819 $
|
||||
--
|
||||
-- $DateTime: 2017/03/22 10:16:16 $
|
||||
--
|
||||
-- $Revision: #1 $
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init);
|
||||
Define_State("State_AI_Autofire", State_AI_Autofire)
|
||||
Define_State("State_Human_No_Autofire", State_Human_No_Autofire)
|
||||
Define_State("State_Human_Autofire", State_Human_Autofire)
|
||||
|
||||
ability_name = "REPLENISH_WINGMEN"
|
||||
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() ~= "Space" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
else
|
||||
Set_Next_State("State_AI_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_AI_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Get_Contained_Object_Count() < 2.0 then
|
||||
if Object.Is_Ability_Ready(ability_name) then
|
||||
Object.Activate_Ability(ability_name, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_No_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
Set_Next_State("State_Human_Autofire")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
if Object.Get_Contained_Object_Count() < 2.0 then
|
||||
if Object.Is_Ability_Ready(ability_name) then
|
||||
Object.Activate_Ability(ability_name, true)
|
||||
end
|
||||
end
|
||||
else
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
148
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_YODA.LUA
Normal file
148
DATA/SCRIPTS/GAMEOBJECT/OBJECTSCRIPT_YODA.LUA
Normal file
@@ -0,0 +1,148 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/ObjectScript_Yoda.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/ObjectScript_Yoda.lua $
|
||||
--
|
||||
-- Original Author: Steve_Copeland
|
||||
--
|
||||
-- $Author: Brian_Hayes $
|
||||
--
|
||||
-- $Change: 637819 $
|
||||
--
|
||||
-- $DateTime: 2017/03/22 10:16:16 $
|
||||
--
|
||||
-- $Revision: #1 $
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
-- This include order is important. We need the state service defined in main to override the one in heroplanattach.
|
||||
require("HeroPlanAttach")
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
|
||||
-- Hero plan self attachment stuff
|
||||
|
||||
-- only join plans that meet our expense requirements.
|
||||
MinPlanAttachCost = 5000
|
||||
MaxPlanAttachCost = 0
|
||||
|
||||
-- Commander hit list.
|
||||
Attack_Ability_Type_Names = {"Infantry" }
|
||||
Attack_Ability_Weights = { 1 }
|
||||
Attack_Ability_Types = WeightedTypeList.Create()
|
||||
Attack_Ability_Types.Parse(Attack_Ability_Type_Names, Attack_Ability_Weights)
|
||||
|
||||
-- Prefer task forces with these units.
|
||||
Escort_Ability_Type_Names = { "All" }
|
||||
Escort_Ability_Weights = { 1.0 }
|
||||
Escort_Ability_Types = WeightedTypeList.Create()
|
||||
Escort_Ability_Types.Parse(Escort_Ability_Type_Names, Escort_Ability_Weights)
|
||||
|
||||
-- Object script stuff
|
||||
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init)
|
||||
Define_State("State_Human_Idle", State_Human_Idle)
|
||||
|
||||
safe_for_ability = false
|
||||
|
||||
stealth_reveal_range = 200
|
||||
stealth_ability = "STEALTH"
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
-- Bail out if this is a human player
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Set_Next_State("State_Human_Idle")
|
||||
-- ScriptExit()
|
||||
end
|
||||
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() ~= "Land" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
Register_Prox(Object, Yoda_Safe_Prox, 500)
|
||||
Register_Prox(Object, Unit_Prox, 500)
|
||||
|
||||
elseif message == OnUpdate then
|
||||
|
||||
if not Object.Has_Active_Orders() then
|
||||
if safe_for_ability then
|
||||
Object.Activate_Ability("FORCE_SIGHT", true)
|
||||
elseif Object.Is_Ability_Active("FORCE_SIGHT") then
|
||||
Object.Activate_Ability("FORCE_SIGHT", false)
|
||||
end
|
||||
end
|
||||
|
||||
safe_for_ability = true
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function Yoda_Safe_Prox(self_obj, trigger_obj)
|
||||
trigger_player = trigger_obj.Get_Owner()
|
||||
if not TestValid(trigger_player) or trigger_player == Object.Get_Owner() or trigger_player.Is_Neutral() then
|
||||
return
|
||||
end
|
||||
|
||||
safe_for_ability = false
|
||||
end
|
||||
|
||||
function State_Human_Idle(message)
|
||||
if message == OnEnter then
|
||||
-- we only want this script to run during GC tactical battles
|
||||
if Is_Campaign_Game() ~= true then
|
||||
ScriptExit()
|
||||
end
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() ~= "Land" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
Register_Prox(Object, Unit_Prox, stealth_reveal_range)
|
||||
end
|
||||
end
|
||||
|
||||
-- If a stealthed enemy enters the prox, disable their stealth ability
|
||||
function Unit_Prox(self_obj, trigger_obj)
|
||||
if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
return
|
||||
end
|
||||
|
||||
if trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
if trigger_obj.Is_Ability_Active(stealth_ability) then
|
||||
if Is_Campaign_Game() == true then
|
||||
trigger_obj.Cancel_Ability(stealth_ability)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
207
DATA/SCRIPTS/GAMEOBJECT/PALPATINE.LUA
Normal file
207
DATA/SCRIPTS/GAMEOBJECT/PALPATINE.LUA
Normal file
@@ -0,0 +1,207 @@
|
||||
-- $Id: //depot/Projects/StarWars_Steam/FOC/Run/Data/Scripts/GameObject/Palpatine.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/Palpatine.lua $
|
||||
--
|
||||
-- Original Author: Steve_Copeland
|
||||
--
|
||||
-- $Author: Brian_Hayes $
|
||||
--
|
||||
-- $Change: 637819 $
|
||||
--
|
||||
-- $DateTime: 2017/03/22 10:16:16 $
|
||||
--
|
||||
-- $Revision: #1 $
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
-- This include order is important. We need the state service defined in main to override the one in heroplanattach.
|
||||
require("HeroPlanAttach")
|
||||
require("PGStateMachine")
|
||||
|
||||
function Definitions()
|
||||
|
||||
|
||||
-- Hero plan self attachment stuff
|
||||
|
||||
-- only join plans that meet our expense requirements.
|
||||
MinPlanAttachCost = 45000
|
||||
MaxPlanAttachCost = 0
|
||||
|
||||
-- Commander hit list.
|
||||
Attack_Ability_Type_Names = {"All"}
|
||||
Attack_Ability_Weights = { BAD_WEIGHT }
|
||||
Attack_Ability_Types = WeightedTypeList.Create()
|
||||
Attack_Ability_Types.Parse(Attack_Ability_Type_Names, Attack_Ability_Weights)
|
||||
|
||||
-- Prefer task forces with these units.
|
||||
Escort_Ability_Type_Names = { "All" }
|
||||
Escort_Ability_Weights = { BAD_WEIGHT }
|
||||
Escort_Ability_Types = WeightedTypeList.Create()
|
||||
Escort_Ability_Types.Parse(Escort_Ability_Type_Names, Escort_Ability_Weights)
|
||||
|
||||
|
||||
-- Object script stuff
|
||||
|
||||
ServiceRate = 1
|
||||
|
||||
Define_State("State_Init", State_Init);
|
||||
Define_State("State_AI_Autofire", State_AI_Autofire)
|
||||
Define_State("State_Human_No_Autofire", State_Human_No_Autofire)
|
||||
Define_State("State_Human_Autofire", State_Human_Autofire)
|
||||
|
||||
unit_trigger_number = 3
|
||||
divert_range = 300
|
||||
threat_trigger_number = 300
|
||||
ability_range = 200
|
||||
ability_name = "AREA_EFFECT_CONVERT"
|
||||
|
||||
stealth_reveal_range = 200
|
||||
stealth_ability = "STEALTH"
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
|
||||
-- prevent this from doing anything in galactic mode
|
||||
if Get_Game_Mode() ~= "Land" then
|
||||
ScriptExit()
|
||||
end
|
||||
|
||||
nearby_unit_count = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
Register_Prox(Object, Unit_Reveal_Prox, stealth_reveal_range)
|
||||
|
||||
if Object.Get_Owner().Is_Human() then
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
Register_Prox(Object, Unit_Prox, ability_range)
|
||||
else
|
||||
Set_Next_State("State_AI_Autofire")
|
||||
Register_Prox(Object, Unit_Prox, divert_range)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function State_AI_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if (nearby_unit_count >= unit_trigger_number) then
|
||||
ConsiderDivertAndAOE(Object, ability_name, ability_range, recent_enemy_units, Object.Get_Hull() * threat_trigger_number)
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_unit_count = 0
|
||||
recent_enemy_units = {}
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_No_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
Set_Next_State("State_Human_Autofire")
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_unit_count = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function State_Human_Autofire(message)
|
||||
if message == OnUpdate then
|
||||
|
||||
if Object.Is_Ability_Autofire(ability_name) then
|
||||
if nearby_unit_count >= unit_trigger_number then
|
||||
Object.Activate_Ability(ability_name, true)
|
||||
end
|
||||
else
|
||||
Set_Next_State("State_Human_No_Autofire")
|
||||
end
|
||||
|
||||
-- reset tracked units each service.
|
||||
nearby_unit_count = 0
|
||||
recent_enemy_units = {}
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function Unit_Prox(self_obj, trigger_obj)
|
||||
|
||||
-- Reject structures, which we can't corrupt
|
||||
if trigger_obj.Is_Category("Structure") then
|
||||
return
|
||||
end
|
||||
|
||||
-- Reject heroes, which we can't affect
|
||||
if trigger_obj.Is_Category("LandHero") then
|
||||
return
|
||||
end
|
||||
|
||||
if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
return
|
||||
end
|
||||
|
||||
--Promote to parent object (infantry squads) for unit counting purposes
|
||||
if trigger_obj.Get_Parent_Object() then
|
||||
trigger_obj = trigger_obj.Get_Parent_Object()
|
||||
end
|
||||
|
||||
if trigger_obj.Is_In_Garrison() then
|
||||
return
|
||||
end
|
||||
|
||||
-- If we haven't seen this unit recently, track him
|
||||
if recent_enemy_units[trigger_obj] == nil then
|
||||
nearby_unit_count = nearby_unit_count + 1
|
||||
recent_enemy_units[trigger_obj] = trigger_obj
|
||||
end
|
||||
end
|
||||
|
||||
-- If a stealthed enemy enters the prox, disable their stealth ability
|
||||
function Unit_Reveal_Prox(self_obj, trigger_obj)
|
||||
if not trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
return
|
||||
end
|
||||
|
||||
if trigger_obj.Get_Owner().Is_Enemy(Object.Get_Owner()) then
|
||||
if trigger_obj.Is_Ability_Active(stealth_ability) then
|
||||
if Is_Campaign_Game() == true then
|
||||
trigger_obj.Cancel_Ability(stealth_ability)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Evaluate_Attack_Ability(target, goal)
|
||||
return Get_Target_Weight(target, Attack_Ability_Types, Attack_Ability_Weights)
|
||||
end
|
||||
|
||||
function Get_Escort_Ability_Weights(goal)
|
||||
return Escort_Ability_Types
|
||||
end
|
||||
|
||||
63
DATA/SCRIPTS/GAMEOBJECT/PROXIMITYSPAWNTRIGGER.LUA
Normal file
63
DATA/SCRIPTS/GAMEOBJECT/PROXIMITYSPAWNTRIGGER.LUA
Normal file
@@ -0,0 +1,63 @@
|
||||
-- $Id: //depot/Projects/StarWars_Expansion/Run/Data/Scripts/GameObject/ProximitySpawnTrigger.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_Expansion/Run/Data/Scripts/GameObject/ProximitySpawnTrigger.lua $
|
||||
--
|
||||
-- Original Author: James Yarrow
|
||||
--
|
||||
-- $Author: Andre_Arsenault $
|
||||
--
|
||||
-- $Change: 37816 $
|
||||
--
|
||||
-- $DateTime: 2006/02/15 15:33:33 $
|
||||
--
|
||||
-- $Revision: #1 $
|
||||
--
|
||||
--/////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
require("PGStateMachine")
|
||||
|
||||
--When player units move near this object its spawn behavior becomes enabled
|
||||
|
||||
function Definitions()
|
||||
object_trap_size = 250
|
||||
Define_State("State_Init", State_Init)
|
||||
end
|
||||
|
||||
function State_Init(message)
|
||||
if message == OnEnter then
|
||||
Object.Set_Garrison_Spawn(false)
|
||||
Object.Event_Object_In_Range(Object_In_Range_Callback, object_trap_size)
|
||||
end
|
||||
end
|
||||
|
||||
function Object_In_Range_Callback(my_object, nearby_object)
|
||||
if nearby_object.Get_Owner().Is_Human() then
|
||||
my_object.Set_Garrison_Spawn(true)
|
||||
my_object.Cancel_Event_Object_In_Range(Object_In_Range_Callback)
|
||||
end
|
||||
end
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user