Jump to content
Solver

Guide for modders - new features and variables

Recommended Posts

Xenonauts: Community Edition is largely intended to expose a fair bit of variables and opportunities to modders. As such, X:CE modifies game files with new settings, many of which are in gameconfig.xml, but also elsewhere. Here is a list of the new variables, hopefully many of which should be self-explanatory, or obvious from the in-file comment.

Some of these options may be useful outside of mods, simply as a matter of general convenience.

Contents

Several options are described below in this post, but there are more ways of modding some features, so I am putting them here into a list of sorts, linking to other posts.

Below is the original post with some individual settings being described.

gameconfig.xml

Two new options for controlling mouse wheel behaviour.

<reverseMouseWheelNextSoldier value="false" comment="By default mouse wheel in ground combat goes to next soldier on wheelup and previous on wheeldown. This reverses the order." /><mouseWheelChangesCameraLevel value="false" comment="Makes the mouse wheel change camera level in ground combat, instead of going to next/previous soldier." />
 

Building a new base shows 3 circles, for all possible radar ranges:

<showPossibleRadarRanges  value="true" comment="Show what radar ranges a base about to be built would have with 2 and 3 radars." />
 

The game's start date is moddable:

<startingTime year="1979" month="9" day="1" comment="This is the start date of a new game" />
 

The airplane recovery mechanic of the game can now be turned off if desired.

<airplaneRecovery value="1" comment="If set to 1, lost airplanes will be recovered. Otherwise they are permanently destroyed" />
 

The bonus for completing terror missions is possible to mod, and it's possible to further change based on the number of locals rescued.

 <terrorSuccessBonus value="150" comment="Bonus granted to the region relations if a terror site is successfully secured" /> <terrorCivilianSurvivedBonus value="0" comment="Extra relations bonus for every civilian that survived a terror mission" /> <terrorLocalForcesSurvivedBonus value="0" comment="Extra relations bonus for every local forces fighter that survived a terror mission" />
 

Doing crash sites does not give a relations bonus in Xenonauts. The bonus can now be turned on. If it is on, then the crashsiteFundingModifier variable applies to determine the amount of the bonus.

 <crashsiteFundingBonus value="false" comment="Controls whether doing crash sites grants a relations bonus with the region" /> <crashsiteFundingModifier value="1.0" comment="If relations bonus for crash sites is enabled, the bonus is the shootdown bonus multiplied by this value" />
 

The damage done to relations by an alien base is customizable:

<alienBaseRelationsDamagePerDay     value="6.0" comment="An alien base damages relations in its continent by this much every day (24 hours)" />
 

gameconfig.xml also has settings for any new shortcut keys that have been introduced.

config.xml

Weapons receive a short range bonus - when you're closer than a certain amount of tiles to an enemy, your weapons become more accurate. The distance at which this bonus kicks in can now be changed in config.xml:

<ShortRangeHitBonusMinDistance>5.0</ShortRangeHitBonusMinDistance>
 

armours.xml

Armour can now modify any stat of a soldier. In addition to the strengthBoost tag which existed before, there are now tags to change any other stat. Negative numbers will work to drain the stat.

      <apBoost>0</apBoost>      <accuracyBoost>0</accuracyBoost>      <braveryBoost>0</braveryBoost>      <reflexesBoost>0</reflexesBoost>      <resilienceBoost>0</resilienceBoost>
 

armours_gc.xml

Armours can now provide defence against psionic attacks.

<PsionicDefence defence="0" points="0" degradation="0" />
 

The defence parameter will let the armour block psionic attacks up to that strength. Every time armour blocks a psionic attack, the points stat is decreased by the degradation stat. That way armour may be made to only block a few attacks. Points must be greater than 0 for any blocking to occur.

<PsionicDefence defence="60" points="10" degradation="5" />
 

E.g., that armour will block psionic attacks up to and including strength 60, and will be able to do so twice. Setting degradation to 0 and points to any above-zero value creates armour that can keep blocking indefinitely.

Also, armour can now provide night vision.

<VisualParams range="18" coneAngle="90" nightRangeBonus="0" />
 

The nightRangeBonus is the number of tiles added to the soldier's vision at night time. Note that this will not let the soldier's vision go above maximum daytime vision.

weapons_gc.xml

Some new parameters can now be assigned in this file. For ammunition that drains TUs or morale, use the following:

To make rifle rounds drain 20 TUs, set the rifle ammo to

<Ammo name="ammo.ballistic.rifle" type="kinetic" damage="30" apDamage="20" mitigation="0">
 

The parameter to drain morale is called moraleDamage.

loadouts.xml

This is a new file and I am too lazy to explain it.

colours.xml

This is a new file for Skitso that I am too lazy to explain.

mission_researches.xml

A new file that allows to begin certain research when a mission is completed with a particular UFO type and/or alien mission type.

Entries look like the following.

<MissionResearch><MissionName>ScoutMission</MissionName><UfoType>airplane.alien.lightscout</UfoType><Research>Researches.AlienCruiserDatacore</Research></MissionResearch>
 

MissionName specifies the internal mission name - there's an entry in the file for each mission so that you know what the names are. UfoType can be set to an alien aircraft, or you can write

<UfoType>Any</UfoType>
 

in which case any UFO of that mission will be considered.

The Research tag of course indicates the research that gets unlocked. Note here - it gets unlocked, not necessarily completed. To make sure it is automatically completed, like with autopsies and datacores, this should be a research with a research time of 0 - again, like datacores.

For UfoType, named UFOs take priority over Any entries. So if you specify that Research missions from Corvettes give tech A, while Research missions with Any UFO give tech B, a Corvette will give tech A, while all other UFOs would give tech B.

researches.xml

LockResearch is a new hook that can be used in the "On Discovered" to disable other, currently unresearched, techs. This means you can create a technology tree with mutually exclusive branches.

Share this post


Link to post
Share on other sites

colours.xml

This is a new file for Skitso that I am too lazy to explain.

lol

Share this post


Link to post
Share on other sites

Say, can we hops to see customized allies in the future?

Ya know, so we can have more control over them and give them more varriance? And also se we can set up an Expendable here to there.

Share this post


Link to post
Share on other sites

What's customized allies? Besides the ability to paint their sprites, which you already have, I don't think you're getting much more.

Share this post


Link to post
Share on other sites

Customizing Buildings

Buildings can be customized through buildings.xml (best edited in Excel). Unlike the default game, the X:CE buildings.xml file has many parameters. Here are the new ones and their meaning.

CommandCenter - a value of 1 designates this building as the command center, meaning it will be the building bases start with.

LivingSpace - how much living space this building provides.

ResearchSpace - how many scientists this building can house.

WorkshopSpace - how many engineers this building can house.

MedicSpace - how many hospital beds the building provides (how many soldiers can be healed at a time)

MedicalBoost - does something. Probably.

SetResearchEfficiency - when a building of this type is constructed, it will make research in the base operate at this efficiency. If set to -1, there will be no change.

SetManufactureEfficiency - like above, but with manufacture.

AlienSpace - affects alien space, which does nothing, but I didn't want to remove the code tracking this.

GarageSpace - affects how many vehicles the base can store.

Defence - is used in the base screen for a visual representation of the base's defense strength. No actual defensive effect!

HangarSpace - affects how many aircraft the base can store.

StorageSpace - how many items this building can store. By default X:CE still gives you unlimited storage.

RadarStrength - how many radars this building counts as. For instance a value of 3 will immediately give maximum range.

QuantumDecryptor - a value of 1 means this building provides quantum decryption info on alien missions within range.

StartingTech - if 1, the player can build this building from the beginning of the game

Share this post


Link to post
Share on other sites
What's customized allies? Besides the ability to paint their sprites, which you already have, I don't think you're getting much more.

No, I mean setting up different "classes" and types. wiht different stats and equipment.

Kinda like aliens.

So you have your regular US trooper, a Veteran, an Elite and the rare legenrary (think Expendables)

Share this post


Link to post
Share on other sites

Oh, let us not forget - FIGHTER PILOTS. With experience.

Even a most rudimentary implementation would be nice.

Given that weapons have an accuracy rating, pilot experience increasing dodge (effectively lowering the enemy accuracy) and improving it's own should be doable.

Share this post


Link to post
Share on other sites

Thank you, I was trying find a way to bind mouse-wheel to levels, big thanks. :D

Now a bit far fetched, but can one add line there to bind mouse buttons 3 and 4 for next/previous soldier? They seem to not be functional atm.

Share this post


Link to post
Share on other sites

Okay, please do not use this thread for requests. I would rather have it be an explanation of new modding features, and questions/answers regarding their usage. Ideas and requests should kindly go elsewhere.

Share this post


Link to post
Share on other sites

Independent alien base growth

In vanilla, alien bases do not grow themselves. Instead, their size depends on the AI ticker like this. (All variables here are from gameconfig.xml)

<mediumAlienBaseTickerLimit value="400"  comment="Alien bases are medium sized above this ticker value."  /> <largeAlienBaseTickerLimit  value="600" comment="Alien bases are large sized above this ticker value."  />

At 400 ticker, all bases are medium, at 600, all are large.

X:CE offers the possibility of much more freedom here. To enable each alien base to grow independently, toggle the feature on:

<independentAlienBaseGrowth value="1" />

This means that each alien base will have an internal ticker. The size of the base is determined by it, so if you leave the limits unchanged, a base will become medium sized at 400 internal ticker, and large at 600 internal ticker. The progression of this ticker is simple to control:

<alienBaseGrowthPerDay 	  value="20.0" />

The above variable determines by how much the internal ticker increases every in-game day. The other factor is of course the ticker value at which new alien bases start. It's equal to the global AI ticker times a custom multiplier:

<alienBaseStartingTickerMultiplier value = "1.0" />

With that setting at 1.0, bases begin at internal ticker equal to the global ticker, with the setting at 0, all bases will begin at 0.

To make things more interesting, alien supply run missions can also be made to increment the ticker of the base by using the following variable.

<alienBaseSupplyGrowth	  value="0" />

Every successful supply run mission will then help the base grow if that number is changed to something above zero.

Share this post


Link to post
Share on other sites

Adding more Hidden Movement screen images:

The base generic hidden movement image is hiddenmovement(_small).png in assets/gui/GroundCombat/hiddenmovement . There can be additional images with the same name and _[tileset] appended and/or a number appended. If there's a tileset-specific image, generic image(s) are not used. When there are numbered images, one is randomly chosen.

Example:

If assets/gui/GroundCombat/hiddenmovement contains hiddenmovement.png , hiddenmovement2.png , hiddenmovement_farm.png , hiddenmovement_arctic1.png and hiddenmovement_arctic2.png , missions on arctic tilesets will randomly choose from the two arctic images, farm will have the one farm image, while the rest of tilesets will randomly choose from the two generic ones.

Share this post


Link to post
Share on other sites

Hello Coders

The apDamage and moraleDamage variables are working? I run some test and seems to be working the moraleDamage only.

I'll really appreciate if you can check this variables.

Thank you!

Share this post


Link to post
Share on other sites
+<!-- This is mainly meant for testing and reporting bugs. It works even in Ironman mode, but if it is used to actually circumvent Ironman, that is obviously cheating. -->+  <endTurnAutosave value="false" comment="If enabled, game is autosaved right after the player's turn ends. Only for debugging purposes." />
+<!-- SAVE GAME COMPATIBILITY -->+<!-- This is primarily for being able to use XCE saves with official GH releases. Change the value only temporarily, using other formats for normal play will lose some data. -->+<!-- Allowed values are "xce" for Community Edition and "gh107" for official release 1.07 and up. -->+  <saveCompatibility value="xce" comment="The version of game for which to write save files." />

If you want a save created in format for the official version of the game, exit the game, change the setting to true, do the intended save, exit the game and restore the setting.

Share this post


Link to post
Share on other sites

Would it be possible to have this thread stickied? It's really useful and a pain to find.

Share this post


Link to post
Share on other sites

Soldier recovery (as of X:CE 0.28)

The soldier recovery formula can be modded. Soldier recovery is processed as follows. All of this is in gameconfig.xml.

First, soldiers at or below a certain hit points value will be excluded from the calculation and marked as dead immediately. This is soldierUnrecoverableHitPoints.

<soldierUnrecoverableHitPoints value="-20" comment="Soldiers whose health is at or below this number will never be recovered" />

The remaining soldiers have a chance to be recovered. The chance is in percent:

chance = B + C * HP

B and C are moddable variables, see below. HP is the soldier's hit points, which is 0 or a negative value.

<soldierBaseRecoveryChance value="50" comment="The base recovery chance at 0 HP. This is B in the recovery formula" /><soldierRecoveryDecreaseCoefficient value="2.5" comment="Recovery chance drops by this many percent for every HP below zero - this is C in the formula" />

With the default numbers therefore, a soldier at 0HP has a 50% chance of recovery, down to 25% at -10HP.

Alien base discovery (as of X:CE 0.29)

In the vanilla game, a check is performed every 5 days on an alien base, and then the base is discovered automatically. It looks like this.

<alienBaseDiscoveryChance value="100" comment="This is the percentage chance for an alien base to be discovered automatically whenever a check is performed using the value below." /><alienBaseDiscoveryCycle value="5" comment="This many days need to pass to have a chance to detect an alien base - Should this not be done on a monthly basis?" />

The 100 there makes base detection certain. X:CE provides two additional settings that can be used for a better gameplay experience if that discovery chance is reduced or eliminated.

<alienBaseReportChance value="50" /><alienBaseReportPreciseChance value="25" />

alienBaseReportChance provides a chance for you to get a notification in the Geoscape log about a suspected base. If you get such a notification, a further dice roll is made to determine whether it will be precise or imprecise, with the alienBaseReportPreciseChance variable specifying the probability of it being precise.

An imprecise report indicates the continent where the base is. A precise report will indicate the city closest to the base.

Share this post


Link to post
Share on other sites

Something I noted about soldier recovery. One round I had a soldier die from a plasma blast at close range, long story short the area the soldier died suffered a direct hit from a rocket launcher, destroying the soldiers corpse.

After the battle was over, I discovered to my surprise my soldier had survived the battle! Amusing considering the last time I saw her she was just a pile of blood.

Nonetheless, I like the alternative Alien Base detection, I always felt Alien bases never would last long. However it is still very easy for someone to glance at a continent's funding to see which one is losing funding.

Share this post


Link to post
Share on other sites
Nonetheless, I like the alternative Alien Base detection, I always felt Alien bases never would last long. However it is still very easy for someone to glance at a continent's funding to see which one is losing funding.

This is true. It's still a useful feature for modding, though. Dynamic UFOs, for example, turns off the funding damage for alien bases and makes them spawn more UFOs instead so the funding damage they do is indirect rather than direct and you can't work out where the base is by looking at finding drain. In that instance, it's useful to get information about where bases are.

Share this post


Link to post
Share on other sites

Adding main UFO/base crews of other races (X:CE 0.29)

In the original game, Caesans, Sebillians and Androns are special. They are the only three races that may be the main crew of a UFO, and all alien bases belong to one of these three alien types. X:CE makes it possible to add other races as one of the "main" races. If a race is a "main race", it means you may define additional ufocontents file with that race in the name, and they will work.

There is a new file, ufocontents/races.xml. In it, there is one entry per race, such as

<Race id="caesan">caesan</Race>

To add a new race, just add an entry. For example, adding Harridans as a main race:

<Race id="harridan">harridan</Race>

This will allow ufocontents files named like airplane.alien.cruiser.harridan.xml to work and spawn UFOs with crews defined therein.

The race may also be a completely new race created in a mod, it does not have to be Harridans, Reapers or a race already present in Xenonauts. In fact the entire point of this feature is to remove the special treatment that the three default main races receive.

Share this post


Link to post
Share on other sites

Awesome!

is possible to change the properties of the races? The main reason of my question is because, for example, Reapers only use melee attacks and have some part of his behavior hardcoded.

Thank you coders!

:D

Share this post


Link to post
Share on other sites

I am not aware of such hardcoding, but it may well be the case. What happens if you give a Reaper a gun, does it get used?

Share this post


Link to post
Share on other sites
I am not aware of such hardcoding, but it may well be the case. What happens if you give a Reaper a gun, does it get used?

The reaper never use it, is restricted to melee attack integrated weapons.

Share this post


Link to post
Share on other sites

My guess would be that it's the zombification ability that overrides everything else and so they just try to go melee.

Share this post


Link to post
Share on other sites
My guess would be that it's the zombification ability that overrides everything else and so they just try to go melee.

Even removing Zombification. The unit can hit to cause damage xenonauts without zombify but they will never use fireweapons.

Share this post


Link to post
Share on other sites
This is true. It's still a useful feature for modding, though. Dynamic UFOs, for example, turns off the funding damage for alien bases and makes them spawn more UFOs instead so the funding damage they do is indirect rather than direct and you can't work out where the base is by looking at finding drain. In that instance, it's useful to get information about where bases are.

Great idear!! So in the Aircraft file is radarchance for detection of all aliens or just bases?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×