This thread was created six years ago. I was wondering if anybody has solved the problem or found a workaround as I am trying to create more tech levels to play with so that I don't have to create a new faction and clone everything. I am creating an Equal Footing GC but in the New Republic era with the Tech levels 5-9 instead of 1-5.
I ran into this problem as well. I'm searching for and hoping for an answer.
My fellow modder and I theorized that this could possibly be a hard-coded problem. We think it is possible that the game, at each tech level, is coded to check for fighters of that level to launch, and if not, to launch the next available tech level. We think they could have simply coded each tech level from 5 through 0 to check for fighters, but never coded 6. This is why some people have said something along the lines of Rebels being able to still launch at tech 6, since their actual level in the xml is only 5.
Last edited by Shard Obsidia; November 23rd, 2012 at 08:59 AM.
It's hardcoded. You can't do it with XMLs, since the spawning tag is limited to the tech levels "_0" to "_5".
You could get around it by attaching a LUA script to the capital ships that checks for the player's tech level (Object.Get_Owner().Get_Tech_Level() ) and spawn fighter squadrons accordingly.
Well, that only works if .Get_Tech_Level() returns something useful for tech levels over 5, I haven't tested that.
You could get around it by attaching a LUA script to the capital ships that checks for the player's tech level (Object.Get_Owner().Get_Tech_Level() ) and spawn fighter squadrons accordingly.
We have been trying to figure out LUA to try to code this.
1) What are the scripts to spawn fighters and how does one link the cap ships to them?
2) Additionally, how do you get it to call for the bit where it reads the xml file to see what ships are set to spawn?
We have been trying to figure out LUA to try to code this.
1) What are the scripts to spawn fighters and how does one link the cap ships to them?
2) Additionally, how do you get it to call for the bit where it reads the xml file to see what ships are set to spawn?
To 1)
Well, they aren't there yet, you'll have to write them
You can attach a script to any object by using the <Lua_Script>Lua_Name</Lua_Script> tag.
2) You don't, all that has to be set in the Lua script.
EDIT: There you go, it's untested, though.
You'll have to remove the spawn code from the xml to see if this works properly.
Code:
--///////////////////////////////////////////////////////////
-- Spawn Fighters depending on Tech Level
--///////////////////////////////////////////////////////////
require("PGStateMachine")
require("PGSpawnUnits")
-- Note: this script will spawn all fighters at once, no reserve forces will be spawned after the squadrons get destroyed
-- Why? I guess it could become quite laggy if a script for every ship constantly checks if the ship's squadrons are still alive
function Definitions()
DebugMessage("%s -- In Definitions", tostring(Script))
squadron_strings = {
{"tech1_fighter", "tech1_bomber"},
{"tech2_fighter", "tech2_bomber"},
{"tech3_fighter", "tech3_bomber"},
{"tech4_fighter", "tech4_bomber"},
{"tech5_fighter", "tech5_bomber"},
{"tech6_fighter", "tech6_bomber"}
}
Define_State("State_Init", State_Init);
end
function State_Init(message)
if message == OnEnter then
spawn_list = {}
spawn_loc = Object.Get_Bone_Position("SPAWN_00") -- spawning bone for your ships goes here!
-- you should choose one that every ship has, so you don't have to write a script for every ship
-- maybe even use ROOT
player_tech = Object.Get_Owner().Get_Tech_Level()
x = 2 -- amount of fighters
y = 2 -- amount of bombers
for i = 1, x, 1 do
table.insert(spawn_list, squadron_strings[player_tech][1])
end
for j = 1, y, 1 do
table.insert(spawn_list, squadron_strings[player_tech][2])
end
SpawnList(spawn_list, spawn_loc, Object.Get_Owner(), false, true)
ScriptExit()
end
end
Last edited by SmallPox; November 28th, 2012 at 09:49 AM.
We have been trying to get the script to work that you posted, but no luck yet. We are not using it at tech 6 yet, just tech 1-5 to make sure that it works at all. So far, we haven't figured out what it is that we're doing wrong or what part of the script doesn't work. Thanks for posting your idea though. It's given us something to work with for now. We'll let you know if we can figure it out.
Yeah, as Sidious said, "tech1_fighter" etc are only placeholders for the real squadron names like "Rebel_X-Wing_Squadron".
Also make sure the Lua is placed in Data\Scripts\GameObject\
The best serving of video game culture, since 2001. Whether you're looking for news, reviews, walkthroughs, or the biggest collection of PC gaming files on the planet, Game Front has you covered. We also make no illusions about gaming: it's supposed to be fun. Browse gaming galleries, humor lists, and honest, short-form reporting. Game on!