So I have been teaching myself how to mod GC IV, step by step, as I go. When I started about a month or so ago, I had almost no understanding of XML, but now I at least have a basic grasp of it, at least as far as how GC IV uses it. But now I want to try to add something into my mod that doesn't quite "fit" neatly into the game, so I wanted to see how others would go about putting my idea into my mod. Let me know what you think.
In Galactic Civ 3, the player could build legions to use to invade planets, but in GC IV we now make citizens specialize into soldiers, or use high Resolve citizens in transport ships to invade enemy planets. I have no issues with this new mechanic, but I would like to think that since there are Techs like "Stellar Marines" and "Killbots", that these units could be utilized to invade planets. So, what I was thinking was to make "Stellar Marines" and "Killbots" and other similarly veined units, available as a production option, similar to clones or Yor population (i.e., an improvement project). I have already added a similar project which allows the player to create a cybernetic genetically augmented clone as a planetary citizen, but I must be going about making "Stellar Marines" the wrong way. Since the purpose of the Stellar Marines would be to use them in planetary invasions, I have added a trait to my mod, intended only for them, and intended to produce relatively consistent unit stats, but I know that it is not working as I wanted it to.
Simply put, I want to be able to produce a citizen, with specific stats. And I also want to have an improvement project that creates a "citizen" unit of a different race (for example, if I am playing as Torians, I want the project to produce a unit of non-Torian, synthetic-lifeform robots, with high resolve and diligence). How would you suggest I go about implementing this?
<UnitTrait>
<InternalName>UnitTrait_StellarMarine</InternalName>
<DisplayName>UnitTrait_StellarMarine_Name</DisplayName>
<Description>UnitTrait_StellarMarine_Dec</Description>
<Icon>LeaderTrait_Veteran.png</Icon>
<ForPlanetaryCitizen>true</ForPlanetaryCitizen>
<Stats>
<EffectType>Resolve</EffectType>
<Scope>Local</Scope>
<Target>
<TargetType>Unit</TargetType>
</Target>
<BonusType>Flat</BonusType>
<RangeMin>20</RangeMin>
<RangeMax>25</RangeMax>
</Stats>
<EffectType>Intelligence</EffectType>
<RangeMin>6</RangeMin>
<RangeMax>9</RangeMax>
<EffectType>Social</EffectType>
<RangeMin>4</RangeMin>
<RangeMax>6</RangeMax>
<EffectType>Diligence</EffectType>
<RangeMin>5</RangeMin>
<RangeMax>10</RangeMax>
<ExcludeFromRandomCitizens>true</ExcludeFromRandomCitizens>
</UnitTrait>
The Improvement I have added is as follows... anyone see anything wrong or have any ideas to improve it?
<Improvement>
<InternalName>RecruitStellarMarine</InternalName>
<DisplayName>RecruitStellarMarine_Name</DisplayName>
<ShortDescription>RecruitStellarMarine_ShortDec</ShortDescription>
<Description>RecruitStellarMarine_Dec</Description>
<Icon>Leader_Minister.png</Icon>
<BuildIcon>Leader_Minister_Build.png</BuildIcon>
<ListIcon>Leader_Minister_Icon.png</ListIcon>
<ImprovementType>DurationalProject</ImprovementType>
<SecondaryType>Special</SecondaryType>
<PlacementType>Special</PlacementType>
<UnderPopulationCapOnly>true</UnderPopulationCapOnly>
<EffectType>ManufacturingCost</EffectType>
<Scope>Queue</Scope>
<TargetType>Improvement</TargetType>
<Value>3250</Value>
<EffectType>PromethionCost</EffectType>
<BonusType>OneTime</BonusType>
<Value>4</Value>
<EffectType>DurantiumCost</EffectType>
<Value>2</Value>
<Triggers>
<OnEvent>OnConstructImprovment</OnEvent>
<TargetType>Colony</TargetType>
<Lifetime>Instant</Lifetime>
<PerformAction>
<Action>CreateUnitOnPlanet</Action>
<StringParam>Defender</StringParam>
<StringParam>DEFAULT</StringParam>
<StringParam>UnitTrait_StellarMarine</StringParam>
</PerformAction>
</Triggers>
<Prerequ>
<Techs>
<Option>Tech_Cloning</Option>
</Techs>
</Prerequ>
<Preclusions>
<RaceTrait>
<Option>SyntheticLife</Option>
</RaceTrait>
</Preclusions>
</Improvement>
As a noob to xml, I thank anyone for their input!
What you could try, is to create a new "Training" option for your citizens. That would be found under the UnitSpecializationDefs xml file. Create a new specialization which would allow you to train existing citizens. Which in turn gives them whatever stats you want them to have. Then load that citizen onto a transport to invade. You could also create a new tech to research to unlock this new specialization or just add it to an existing tech. Not sure if you want to go this route, but if you can't find another way, it's an option for you.
You could try something like this:
<UnitSpecialization> <InternalName>Unit_StellarMarine</InternalName> <DisplayName>Unit_StellarMarine_Name</DisplayName> <Description>Unit_StellarMarine_Dec</Description> <GlobalType>Defender</GlobalType> <Icon>Leader_StellarMarine_Icon_Large.png</Icon> <Image>Citizen_Portrait_Terrans-Defender.png</Image> <Background>Citizen_BG_Soldier.png</Background> <SelectSFX>UI/CITIZENS/WORKER_SELECT</SelectSFX> <ImprovementType>Military</ImprovementType> <Cost> <EffectType>Control</EffectType> <Target> <TargetType>Faction</TargetType> </Target> <BonusType>OneTime</BonusType> <Value>1</Value> </Cost> <Cost> <EffectType>PromethionCost</EffectType> <Target> <TargetType>Faction</TargetType> </Target> <BonusType>OneTime</BonusType> <Value>1</Value> </Cost> <Cost> <EffectType>DurantiumCost</EffectType> <Target> <TargetType>Faction</TargetType> </Target> <BonusType>OneTime</BonusType> <Value>1</Value> </Cost>
<Triggers> <OnEvent>OnStartTurn</OnEvent> <Scope>Global</Scope> <Target> <TargetType>Colony</TargetType> </Target> <Lifetime>Instant</Lifetime> <Modifier> <EffectType>Intelligence</EffectType> <Target> <TargetType>Unit</TargetType> </Target> <BonusType>Flat</BonusType> <Value>100</Value> <----Or whatever value you want here----> </Modifier> </Triggers>
<Triggers> <OnEvent>OnStartTurn</OnEvent> <Scope>Global</Scope> <Target> <TargetType>Colony</TargetType> </Target> <Lifetime>Instant</Lifetime> <Modifier> <EffectType>Social</EffectType> <Target> <TargetType>Unit</TargetType> </Target> <BonusType>Flat</BonusType> <Value>100</Value> <----Or whatever value you want here----> </Modifier> </Triggers>
<Triggers> <OnEvent>OnStartTurn</OnEvent> <Scope>Global</Scope> <Target> <TargetType>Colony</TargetType> </Target> <Lifetime>Instant</Lifetime> <Modifier> <EffectType>Diligence</EffectType> <Target> <TargetType>Unit</TargetType> </Target> <BonusType>Flat</BonusType> <Value>100</Value> <----Or whatever value you want here----> </Modifier> </Triggers> <Triggers> <OnEvent>OnStartTurn</OnEvent> <Scope>Global</Scope> <Target> <TargetType>Colony</TargetType> </Target> <Lifetime>Instant</Lifetime> <Modifier> <EffectType>Resolve</EffectType> <Target> <TargetType>Unit</TargetType> </Target> <BonusType>Flat</BonusType> <Value>100</Value> <----Or whatever value you want here----> </Modifier> </Triggers> <Prerequ> <Techs> <Option>Tech_Cloning</Option> </Techs> </Prerequ> <ForPlanetaryCitizen>true</ForPlanetaryCitizen> </UnitSpecialization>
I haven't tried this before or anything, so I can't guarantee it will do what your looking for. But it's the route that came to mind when reading your idea. I would create a new icon to differentiate the Stellar Marine from the Soldier if I went this route. This is a new icon I just threw together real quick.
https://www.dropbox.com/scl/fi/ua6w4ajk6opab68i6uz8l/Leader_StellarMarine_Icon_Large.png?rlkey=5boy1cd0xline1n3cgoyv63v5&st=mte2iftq&dl=0
Remember to make a UnitSpecializationDefs text file. And you would need to add a Gfx folder with an Icons folder inside to throw your custom icon into, unless you use an existing in game icon.
EDIT: Okay so I tried this and unfortunately it did not work. I'll tinker around some more for you when I get some more free time.
You could make a different kind of transport (module) getting unlocked by these techs which doesn't fit your idea at all but at the moment the soldier's stats on board of a transport have no effect.
Hey Venom,
My apologies for not getting back to your post earlier. IRL hardships keep pulling me away and distracting me from what REALLY matters, lol. I had to read over your idea a few times, but I finally think I got what your idea was, and I liked it since it would allow for quite a bit of flexibility in managing your "ground troops". Specializing a citizen in either soldiers, stellar marines, defensive militia, or something else would be a very fluid way of managing ground forces for a planetary invasion.
I mean, lets face it, there are easily more than half a dozen different futuristic archetypes of armed forces... from 40K Space Marines, to Star Wars' Clone Army and Droid Armies, to the semi-independent AI controlled mechs of Supreme Commander, or even armed forces like those of the Jem'Hadar or Hirogen of Star Trek. My mod (and my work) is aiming to allow the player to customize their ground forces a bit more, along with quite a bit more.
So far, the mod adds about 20 colony improvements (with about another 30-40 planned), half a dozen more terraforming improvements, an upgrade tree for the orbital academy, an orbital dockyard (still not working right, but its meant to repair ships in its zone of control), more than 208 leader traits, approximately 34 new policies, at least two dozen new executive orders, a whole host of new ideology traits, new branch techs for the tech tree, and several new levels and types of ship components. Also, the plan is to include a rewrite of the diplomacy and war aims "system" to make it a bit more organic (add a bit of randomness or at least uncertainty to it). Oh, and not to criticize Stardock's coders, but I'm spending time reorganizing and cleaning up many of the original .xml's just to make them a bit easier to read and search through (such as organizing the Unit Traits in LeaderTraitDefs.xml, into sections for planetary citizen ideology, planetary citizen traits, leader ideology, leader traits, etc.).
Oh! I might as well take this chance to ask a question as well! Right now i'm plugging away, adding leader traits but I am running into something of a bug on my end ( I think ). So, I made a trait called "Devoted" and in the LeaderTraitDef2_mod.xml file I'm writing, I added the following:
<InternalName>LeaderTrait_Devoted</InternalName>
<DisplayName>LeaderTrait_Devoted_Name</DisplayName>
<Description>LeaderTrait_Devoted_Dec</Description>
<Icon>LeaderTrait_Approval_Happy_Icon.png</Icon> <!---- This was copy/pasted from the original .xml -->
..... (The trait itself works well enough and applies the assigned stats)
In the corresponding modded LeaderTraitText_mod file, I have the following:
<StringTable>
<Label>LeaderTrait_Devoted_Name</Label>
<String>[ICON=LeaderTrait_Approval_Happy_Icon] Devoted</String> <!--- I think something is wrong here!! >
</StringTable>
<Label>LeaderTrait_Devoted_Dec</Label>
<String>To be a true leader, one must focus on the needs of their people, and be prepared to sacrifice of themselves for the greater good.</String>
The result is that the trait gets applied to the leader, but the icon for the trait is invisible. You can place your mouse over the invisible trait icon of the leader, and the proper description from the second string table is displayed. I must be overlooking something. Do you know if the Icon used in the LeaderTraitDef file needs to match somehow with the LeaderTraitText file's corresponding string?
And by the way, you might not have pursued it any further after your first attempt, but I am going to give it a try myself... your idea about citizen specializations. Maybe this will lead to another expansion of my planned mod... for instance, not only Citizen to Soldier to Stellar Marine, but Citizen to Worker to Specialized Technician, or Citizen to Farmer to Homesteader, or Citizen to Farmer to Co-Op Farmer. Anyways, thanks a ton for your input before and I really hope you get back to me sometime. I'd love to pick your brain some more, but not too much, lol!
Try [ICON=APPROVAL_HAPPY_ICON]. The Happy and Loyal traits use the same icon and that's the code for the icon in their text.xmls.
Thanks a lot Sarellion. I have to go through most of my added traits and fix their icons. ::Bangs head against wall:: Ok, i'm back.
Let me ask you guys this. The <Prerequ> part of the schema is really throwing me for a loop. I am trying to make one of my improvements have a prerequisite, so that it can only be built on a planet if the Minerals produced on that planet is greater than or equal to 5. I have tried using:
<Stat>
<Option>Minerals</Option>
<Option>GreaterThanOrEqual</Option>
<Option>5</Option>
</Stat>
<Counter>
</Counter>
Both of these prevent the game from loading, so I'm a bit frustrated.
I am certain that I am writing it wrong, but as far as I can tell, if I use <Stat>, then the <Prerequ> has an <Option> child, and requires a Name, Condition, a Threshold, and a ThresholdUpper. If I correctly use <Counter> as a child to <Prerequ>, then I again need a Name, Condition, but then only a Threshold. Any clarification on what I am doing wrong would be appreciated! Thanks!
The Xeloxi buildings which need a certain amount of crime are the only ones I am aware of which use stat. It looks like this:
<Stat> <Option> <Name>Crime</Name> <Condition>GreaterThanOrEqual</Condition> <Threshold>0.3</Threshold> </Option> </Stat>
So it should look like this, when we try to use it for your purpose:
<Stat> <Option> <Name>Minerals</Name> <Condition>GreaterThanOrEqual</Condition> <Threshold>5</Threshold> </Option> </Stat>
There is also a stat called "BaseMinerals," I think that's mineral yield of your planet only, if that's what you are looking for.
I never used stat as a prereq so I don't know if it works, but AFAIK the Xeloxi buildings work fine.
There are many great features available to you once you register, including:
Sign in or Create Account