Adding more Factions to Starwars EAW/FOC

Mehr
04 Aug 2015 02:28 - 08 Okt 2018 06:11 #74090 von Imperial
Dear fellow Modders!

There are many players out there who asked for more playable fractions for Starwars EAW/FOC.

It first appeared to be a very difficult task to achieve, however I am going to show you now how to add 14 playable factions or more to the game!


This tutorial requires you to have at least very basic knowledge how the .xml engine works, and please try to make NO synthax mistakes. You can have a quick look through my coding tutorials (clip 10 and above) and do some practise before you tackle the fractions task:
www.youtube.com/playlist?list=PLild8kZ8-...aGqLWuJdGFSSXlrv3B_9

First thing you will need is my Faction template.xml file, please download it:

www.mediafire.com/download/apj9u582d1eu7..._Guidialog_files.zip

Its actually a stock Expansion_Factions.xml from Forces of Corruption at the beginning, the only change I did to the Underworld faction is deactivating the annoying announcer.

Its made so you simply can replace the old Expansion_Factions.xml of your mod with it. If you are going to add factions to classic EAW simply insert <File>Expansion_Factions.xml</File> into FactionFiles.xml in order to innitiate it.

Usually this also works for files with any name to innitiate them in FactionFiles.xml, as long they have no playable faction. But, in my tests I experienced that the game crashes with my new Factions, unless they are inside of Expansion_Factions.xml. Might have something to do with the Underworld faction that was inserted afterwards, maybe other scripts run in the background that enable it for this file only, no idea.


You might want to read what the Xml tags in the faction file do:
www.petrolution.net/item-199


However, its the lower part of this xml we are going to focus now: Open the .xml you've just downloaded and search (Strg + F) for Primary_Fraction in the commented entry.

Warnung: Spoiler! [ Zum Anzeigen klicken ]


This is the Fraction I created. Its actually a simple copy of the stock Underword fraction, but I removed all unnecessary sound effect tags to save 70% of space in the file. Further I ordered all tags of interest to the top of this fraction.
This eases the editing for you and you see the important things at first sight.
Its pretty self explanatory.

First thing you need to do is please open your .\Star Wars Empire at War Forces of Corruption\Mods\Modname\Data\Text\MasterTextFile_???.dat using petroglyphs .dat editor tool:

www.petrolution.net/item-172

Or the String editor, which is more advanced and complicated.

Then please insert as many strings as fractions you are going to create.

I'll insert 3 for the beginning:

TEXT_FACTION_UNKNOWN = Unknown
TEXT_FACTION_FACTION_1 = Faction 1
TEXT_FACTION_FACTION_2 = Faction 2

We are going to need these Strings later.
CAUTION: String names must be CAPITAL, for content this doesent matter.
Then save this and lets edit our Expansion_Factions.xml.


- Now please insert the name of your fraction and overwrite "Insert_Name_1" in the <Faction Name=""> Tag.
- Please scroll now down to the ***** 2nd Fraction ****** and paste the name you just typed into the
<Variant_Of_Existing_Type>Insert_Name_1</Variant_Of_Existing_Type> tag

- Then scroll down to Faction 3 and paste it also in its <Variant_Of_Existing_Type> tag.

You need to have the name of this primary Fraction in each other additional fraction you create (simply copy fraction 2 as many times you like), because the primary fraction is the only full fraction with all detail tags that arnt really important..

The other Fractions below are all <Variant_Of_Existing_Type>, which means the code of the primary one is simply applied to them and their tag content overwrites the code of the primary one (sonds complicated ? never mind just copy that and all'll be fine).



- Then please scroll all the way back up to the primary fraction.

- Paste the first of the text strings we just inserted into our .dat file into the <Text_ID>.(in my case its <Text_ID>TEXT_FACTION_UNKNOWN</Text_ID>)
Note: This is the point where most of unsuccessfull modders did it wrong in their tests, this string needs to be valid and UNIQUE in order to be shown in the dropdown menu of the game!

- Optional: Open any photo editing application (like photoshop, gimp) or similar program to pick a color for your fraction, so you get the RGB values, then insert then replace the first 3 values of the <Color> tag.


Now you can edit the other values for your fraction:

- Make sure that the name of the current fraction isnt listed in <Enemies> to be its own enemy ^^ and keep for each fraction the enemy list up to date.
If you forget to add a fraction to the Enemies tag its units will be ignored in the GCs, and they wont be visible at all except if you use a system spy unit to detect them.
Or, if you add Fraction_A as enemie to Fraction_B but forget to add the opponent Fraction_B as Enemy to Fraction_A, this will result in Fraction_B firing at Fraction_A but the Fraction_A units will refuse to defend themselfes because they ignore Fraction_B.

- Insert a Unit into <Faction_Leader>
- Insert a Hero Company Unit (thats NO normal unit!) into <Faction_Leader_Company>

- IMPORTANT insert the name of any valid fighter unit of your fraction into <Space_Skirmish_AI_Default_Forces>, or you wont have any starting fighters in skirmish!
Note: You will additionally need a Starbase or 5 starbases for each fraction in Starbases.xml otherwise there wont be a Starbase spawning in Skirmish mode.
- Same for <Land_Skirmish_AI_Default_Forces>


----> Primary Fraction is finished now!

- Now please scroll back down to fraction 2
- Give it any own <Faction Name=""> (replace "Insert_Name_2")
- Make sure <Variant_Of_Existing_Type> points to a valid primary fraction!
- Insert a valid text string into <Text_ID> (TEXT_FACTION_FACTION_1 in my case)

The rest from here you certainly can do by yourself, just repeat the steps for the primary unit. I kept the code sleek so there isnt much that draws your attraction away from the essential code. So adding a new fraction works quite fast now ^^
Letzte Änderung: 08 Okt 2018 06:11 von Imperial.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
04 Aug 2015 03:38 #74091 von Imperial
XML wise we're good to go now!

But there's one tiny thing left for us to modify, the .\Mods\Modname\Data\Resources\guidialog\Guidialog.rc
Thats the file that controls the buttons and scrollbars of the game UI.

The reason for our change is, the list for fractions isnt long enough, I was able to add a 4th fraction without changing that file, but every fraction under the 4th one wont be displayed in the game because there's simply no space left for them:

Have a look at the bar I marked in red.

Yeah I know, on this image its the design of Stargate TPC, but the layout of your mod will look similar to this.

In order to stretch that space we need to modify or overwrite that file, which finally will look like this:


Note: I am NOT the first one who solved this issue. All credits for the .rc file solution go towards wizardington from the Corperate_Addon mod.

You can whether use one of the (option 1) patched Guidelog.rc files for FOC you downloaded (might also work with classic EAW) and overwrite the old one or follow the rest of this tutorial below (option 2) and do everything manually:


Option 1: The easy way

After downloading the files above please choose the version with 10 or the one with 14 fractions (which expands the bottom margin in quite a ugly way)

Then please navigate to the directory of your game, and further into .\Mods\Modname\Data\Resources\guidialog

And please replace the Guidialog.rc file with the one in my folder, or simply drag and drop the Data directory over the Data directory of the Mod (could additionally overwrite the one of Starwars either if you wish) and allow it to overwrite the file.


Option 2, Do this if you have a modified Guidelog.rc file and wish to manually implement the longer selection boxes for additional Fractions:

Warnung: Spoiler! [ Zum Anzeigen klicken ]


Thats it, we're done. Actually, I think now we could even remove the vanilla fractions Rebel, Empire and Underworld. The Game would continue with the new fractions we've just created. But this is a bad idea and has of course sideeffects: broken links in some tags and the AI is tailored to these fractions, so it wont work at all. And you wouldnt be able to build any satellites or asteroid mines in skirmish without them.

Finally please start your mod and enjoy multiple fractions.


Note: To play these fractions finally ingame you additionally need to rename an exisiting Rebel, Empire or Underworld tag to the name of your new fraction, in these tags of Campaigns_Singleplayer.xml or any other Campaign file:

<Starting_Active_Player>
<Markup_Filename>
<Starting_Credits>
<Starting_Tech_Level>
<Max_Tech_Level>


<Starting_Forces> Fraction_Name, Planet_Name, Crusader_Gunship_No_Spawn </Starting_Forces>

Otherwise you could copy the campaign of a existing fraction and change these tags to fit for the new fraction or create a entirely new one.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
04 Aug 2015 18:16 #74100 von Imperial
Now the fractions are selectable, but every singleplayer fraction also requires to have atleast one Spacestation level 1 for skirmish.

Now I'm going to show you how to spawn the right station for the new fractions in multiplayer mode:
First of all you need to make a copy or a variant_of_existing_type of the lv1 starbase from any of the 3 vanilla fractions in Starbases.xml.
Then you have to change its <Affiliation> tag to the Ingame name of your new fraction, this is important because the 4 MultiplayerStructureMarker Objects in MultiplayerStructureMarkers.xml are searching all starbases in its <Marker_For_Specific_Object_Type> tag for their fraction then they spawn the correct starbase for the matching fraction.


Then please edit the <Tactical_Buildable_Objects_Multiplayer> tag of your station (or add one if there is no such tag), this is how the synthax of this tag works:

Empire,
Unit_1,
Unit_2,

Rebel,
Unit_3,
Unit_7,

New_Fraction,
Unit_1,
Unit_2,

In the <Tactical_Buildable_Objects_Multiplayer> tag you can write as many fractions as you like (so each fraction written there can use this station)
Then you can write more parameters under each fraction, they are parameters for buildable units of this station.
CAUTION: All inserted units here must have the new fraction you just added in their <Affiliation> tag or they wont be buildable!


As soon the starbase is done, you need to open MultiplayerStructureMarkers.xml, then please insert the name of your skirmish_station into the <Marker_For_Specific_Object_Type> tag of the following 4 MultiplayerStructureMarker instances: Space Station, Team_00_Space_Station, Team_01_Space_Station, Team_02_Space_Station


Finally when you start the game in skirmish mode our new starbase should spawn for our new fraction (to the position of the starbase marker). And you should be able to build the units you just inserted as parameters into <Tactical_Buildable_Objects_Multiplayer> of your starbase.

You can also insert upgrades in UpgradeObjects.xml to make them available for the Station. You need to insert UpgradeObjects the same way into your <Tactical_Buildable_Objects_Multiplayer> tag of each Starbase level and for each Faction. For Example above: Unit_1 is a Spaceship, but Unit_2 can also be a UpgradeObject.
If you have more Starbase Levels you need at least 1 Upgrade per Level.
Note: The Starbase displays these Units/Upgrades in the same order from the top to the bottom;
Button 1 top, Button 1 bottom , Button 2 top, Button 2 bottom and so on...


There are some additional things you need to concider for these Starbase Level Upgrades, here is my Example:

<UpgradeObject Name="Terran_Starbase_Upgrade_Level_2">
<Text_ID>TEXT_TAURI_SPACE_BUILDING_SK_STATION_TECH_2</Text_ID>
<Encyclopedia_Text>TEXT_DESCRIPTION_TAURI_SK_STATION_TECH_2</Encyclopedia_Text>
<Encyclopedia_Unit_Class>TEXT_ENCYCLOPEDIA_CLASS_TAURI_STATION_TECH_2</Encyclopedia_Unit_Class>
<Icon_Name>I_BUTTON_UB_STATION2.TGA</Icon_Name>
<Affiliation>Underworld</Affiliation>
<Behavior>DUMMY_UPGRADE</Behavior>
<CategoryMask>Upgrade</CategoryMask>

<Tactical_Build_Cost_Multiplayer> 1500 </Tactical_Build_Cost_Multiplayer>
<Tactical_Build_Cost_Campaign>400</Tactical_Build_Cost_Campaign>
<Tactical_Build_Time_Seconds> 80 </Tactical_Build_Time_Seconds>
<Tactical_Build_Prerequisites>Skirmish_Terran_Star_Base_1</Tactical_Build_Prerequisites>
<Tactical_Production_Queue>Tactical_Upgrades</Tactical_Production_Queue>
<!--Build_Limit_Current_Per_Player>1</Build_Limit_Current_Per_Player-->
<Show_In_Sidebar_While_Building>Yes</Show_In_Sidebar_While_Building>
<Show_In_Sidebar_When_Complete>No</Show_In_Sidebar_When_Complete>
<SFXEvent_Build_Started>UHD_REMOVED_Upgrade_Progress</SFXEvent_Build_Started>
<SFXEvent_Build_Cancelled>UHD_REMOVED_Upgrade_Canceled</SFXEvent_Build_Cancelled>
<SFXEvent_Build_Complete>UHD_REMOVED_Upgrade_Complete</SFXEvent_Build_Complete>
<Abilities SubObjectList="Yes">
<Starbase_Upgrade_Ability Name="RS_Level_Two_Starbase_Upgrade_Effect">
<Activation_Style>Skirmish_Automatic</Activation_Style>
</Starbase_Upgrade_Ability>
</Abilities>

</UpgradeObject>


I marked the important tags. In order to be able to upgrade your Starbase you need to insert one level of your Starbase before the upgrade leve into
<Tactical_Build_Prerequisites> and to have this ability in the Upgrade_Object. (Level 1 is prerequisite of Level 2 and so on).
I guess the Ability above is searching the Starbase Units for the 2 Tags <Prev_Level_Base> and <Next_Level_Base> and uses them to upgrade a Station. These need to be correct for each Starbase level or it wont work!



Additionally you could add the tag <Lua_Script> to a UpgradeObject and use something lilke

if Object.Get_Type() == Find_Object_Type("Upgrade_Object_1_Name") then
-- do something
end

In a lua Script inside of the ./Data/Scripts/GameObject directory to bind fancy starbase abilities to the Upgrades, this way you can use them as ability buttons. ^^


CAUTION:
You need to insert the instance name of these 4 Starbase Upgrades into .\Data\Scripts\AI\SpaceMode\AI_Plan_ExpansionGeneric_SkirmishUpgradeSpaceStation.lua

And
.\Data\Scripts\AI\SpaceMode\TacticalMultiplayerBuildSpaceUnitsGeneric.lua

In order to get the AI to upgrade the Starbases in Skirmish mode.

Additonally you need to add the names of all new Objects you create inside of Spacebuildablesskirmish.xml and Space_Buildings_Satellites.xml
into
.\Data\Scripts\AI\SpaceMode\BuildStructureSpace.lua
and the Resource mines into
.\Data\Scripts\AI\SpaceMode\BuildRefinerySpace.lua

so the AI starts to build Space Buildings and Satellites in Skirmish!




Some notes about coding your own Star Base:
- Dont make Level 2-5 a <Variant_of_existing_Type> of Level 1. I just did that to keep the code simple, and it worked in Galactic Conquest mode fine. But for Skirmish I need to make another version of each Level, and thus my Skirmish Version Starbase_C was a Variant of Starbase_B, which was a Variant of Starbase_A.
Usually this would work, but it caused complications for me:
If I load any Skirmish map with my Starbase on it, the game freezes in the Skirmish loading screen.

- Another dumb thing you could do is leaving the tags <Prev_Level_Base> and <Next_Level_Base> away from your Skirmish Starbase Variant.
Because the GC Starbase LV2 points at GC Starbase LV2, and the Skirmish Starbase LV2 got that tag because its its Variant child and pointed to GC Starbase LV1 instead of Skirmish Starbase LV1, which additionally forced my skirmish Loading screen to freeze.

- Dont try to use 2 sets of Starbases for 1 Faction, like for example Starbase_A 1-5 and Starbase_B 1-5, because:
The game Spawns always Starbase_A, never Starbase_B:
Warnung: Spoiler! [ Zum Anzeigen klicken ]

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
26 Dez 2015 20:49 #77086 von Aurora_of_war
Please help how do I add more ships to a faction thanks bye.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
26 Dez 2015 22:32 #77088 von Imperial
Well, in the same forum section only a few cm under this thread is everything you need to get more ships into the game. You mignt want to read through the anti bugs thread to prevent annoying mistakes:
www.stargate-eaw.de/index.php/de/forum/d...anti-bugs-thread?p=1

There are my tutorial clips:
www.youtube.com/playlist?list=PLild8kZ8-...aGqLWuJdGFSSXlrv3B_9

For the understanding of how ground Unit turrets are supposed to be rigged, we have nardels awesome tutorial:

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
26 Dez 2015 23:37 #77089 von Aurora_of_war
Yeah have changed the <Affiliation> for the ancient destroyer but its not showing in the tauri spacestation

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
27 Dez 2015 00:07 #77091 von nardel
you need to add them to the starbase_Tauri.xml too. And don't forget to add all of the level of the station.( if you added it to the lvl2 then you need to add the ship to lvl2 ... lvl5, to be avaliable in all tech level what you want

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
27 Dez 2015 00:26 #77093 von Aurora_of_war
Thanks mate I will do that thanks for the help i'm new to star wars FOC modding but all have to start somewhere anyway thanks mate.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
27 Dez 2015 13:57 #77095 von Aurora_of_war
Hello could some one help me please how do I tell my custom faction what spacestation to use thanks bye.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
27 Dez 2015 19:05 #77103 von Imperial
You havnt even read this thread right?
What you are asking for is already covered at the end part of my 3rd post here; inserting the name of your lv1 station into MultiplayerStructureMarkers.xml.

And please dont always write thanks bye, sounds abit weird.

Sidenote: This tutorial covers how to add a fraction for the player, but it wont have AI support, Im already working on a solution for the AI.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Ladezeit der Seite: 3.111 Sekunden