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