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

39 lines
1.0 KiB
Lua

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