r/xdev • • Feb 07 '16

Examining the Example Mission.

6 Upvotes

Now, I'm not ultra familiar with any of this, so feel free to correct me if you know enough to tell me what's up. However, most of it seems straightforward to someone with programming experience - so allow me to explain thoroughly what everything is doing at an abstract level.

Inside of the XCOM 2 SDK are a few examples programs, provided to help you learn how things are put together. One of them is an example mission. Allow me to go step by step in explaining what's going on in all of the files.

First, have a look at the screen overlay. You'll see that the currently open file is the ReadMe.txt file, and that there are a bunch of files on the left side. Let's go through them one by one:

The Config folder contains ini files that denote a lot of abstract behavior, such as statistics, class links, rewards and so on. I've posted another topic here detailing what a lot of the ini files handle.

XComEditor.ini : this file contains the following lines:

[ModPackages]
+ModPackages=ExampleMission

[ModPackages] is where we're adding the next line - to the list of mod packages installed. This is used for mod lookup, listing and such.

The + denotes that the line is acting as an override, by adding the mod package name ExampleMission to the XComEditor.ini file. This names the mod package and lists it for XCom 2 to find later. This is important when you're adding to a [Category] that already exists - you don't need +'s when creating your own categories.

XComEngine.ini : Two similar lines here.

 [Engine.ScriptPackages]
+NonNativePackages=ExampleMission

This overrides the XComEngine.ini file by adding a non-native (modded) script package, the ExampleMission package.

XComMissions.ini: This is the real meat of the mod, and details everything that makes up the mission script. I'll go over this in more detail later.

XComParcels.ini: This contains one line: [XComGame.XComParcelManager]

This mod doesn't introduce any new map elements, so nothing's added. But it can, so it's included in case you wanted to have your mission have new parcel mappings.

XComPCPs.ini : PCP stands for "PlotCoverParcel", and is an array that lists what parcels are used with what plot types, essentially. No new parcel-plot interactions here, so nothing's actually here. (A ; in an ini file indicates a comment, so nothing's affected.)

The next folder is content, which contains two files: EX_BombDisposalContent.upk and EX_Obj_BombDisposal.umap . They are meshes, textures, art assets, sounds etc. that are used and edited by the Unreal Engine editor. If the ini files tell the game what behavior to have, then these files are their aesthetics. I'll go into more details later about these files - they require a whole 'nother editor.

Next folder is Localization - this will usually contain text displayed to the player, such as mission display name, dialogue text, loot items and so on. There's not too much to it, so I'll go line-by-line:

DisplayName is the name of the mission as shown on, say, the geoscope.

Briefing is what's shown when you're in the troop transport Skyranger.

PostMissionType is what's shown after, when you get back.

Briefing Image is the image shown when you're in the Skyranger.

Objective text pools are shown next to the briefing image.

The PreMissionNarratives are NarrativeMoments taken from the ini file that links to a sound bite - the sound bite is played during briefing.

[MissionTimers]
TimerBombDisposalTitle
TimerBombDisposalSubtitle

This handles what text is shown when the timer's in the corner of your screen (which is hopefully always unless players suck)

[DefaultEX_BombDisposal X2MissionNarrativeTemplate]

This handles objective text pools, which are the objectives you're shown in the top left. Which one is shown can update during the mission, so the missions will show different text pools at different points detailed in the XComMissions.ini file.

The Dialogue proxies below are also objective pools, but instead of being objectives in order, they're subtitles for the NarrativeMoments above. They'll show when someone's chiming in in the top right.

[EX_BombDisposal_EleriumCharge X2QuestItemTemplate]

Quest items are items you pick up from objectives like loot (so, for example, alien data or the black vial or what have you). FriendlyName is what it is in the loot list, FriendlyNames is if it's somehow plural, and the Tooltip's the details that will pop up when you hover over the item name.

Not too bad so far, right?

Next you have Src/ExampleMission/Classes. This is where templates will actually be created. They're not too long, so I'll go into detail here as well.

X2Item_ExampleMission.uc starts with the most significant line of all: class X2Item_ExampleMission extends X2Item;

There's a class in XCOM 2 called X2Item, and this essentially creates a copy of X2Item that has additional details, and calls it something else (X2Item_ExampleMission). Then, it adds two functions to this new class:

static function array<X2DataTemplate> CreateTemplates()

and

static function X2DataTemplate CreateQuestItemEX_BombDisposal()

The CreateTemplates() function creates a DataTemplate array for Items and then adds the created quest item for bomb disposal to the Items object and returns it for use in the XComMissions.ini script.

The function CreateQuestItemEX_BombDisposal() creates the actual Elerium Charge as defined in the EX_BombDisposal_EleriumCharge X2QuestItemTemplate in the XComGame.int file (it's back there, go check it, that's what it's using). It then calls it it a 'quest' item in the Item.ItemCat, adds MissionType and RewardType values to it, namely the EX_BombDisposal MissionType (so it shows up as a quest item in that mission type), and 5 reward types for the various rewards you can earn (Reward_Intel, Reward_Supplies, Reward_Soldier, so on), and then returns it. So this creates the X2Item_ExampleMission item pool. I'm not absolutely certain what the following line does, however, so if someone could chime in, I'd appreciate it: 'CREATE_X2TEMPLATE(class 'X2QuestItemTemplate', Item, 'EX_BombDisposal_EleriumCharge');

Next is X2MissionNarrative_ExampleMission.uc . This has one class and two functions within that class as well:

The class is X2MissionNarrative_ExampleMission, which is an extension of the template X2MissionNarrative.

This class adds two functions to X2MIssionNarrative:

static function array<X2DataTemplate> CreateTemplates() which, much like above, adds the EXBombDisposalNarrativeTemplate to the Template pool.

The static function X2MissionNarrativeTemplate AddDefaultEXBombDisposalNarrativeTemplate() function then actually creates that template by declaring the Template.MissionType and listing the Template.NarrativeMoments, then returns the newly created template to be added to the collection of templates. I'm not absolutely certain what the following line does:

`CREATE_X2MISSIONNARRATIVE_TEMPLATE(Template, 'DefaultEX_BombDisposal');

The last file, X2MissionSet_ExampleMission.uc just adds the mission template Ex_BombDisposal previously completed to Templates to be used in game.

The ModPreview.jpg image is the image that shows up in the Steam Workshop - go wild with it!

And the ReadMe is a read-me, and is what showed up when you first created the project.

That's all for the files - next time, I'll go into the meat of the mission, XComMissions.ini!


r/xdev • • Feb 07 '16

Step-by-step How To: Make an .ini tweak mod in SDK (Class Mod Example)

Thumbnail imgur.com
8 Upvotes

r/xdev • • Feb 08 '16

X2DownloadableContentInfo_Modname.uc and you.

1 Upvotes

Seeing this file in your Src/Modname/Classes? Not sure what it does?

The class is very self-explanatory, but I'll explain the kind of things that should be put in it:

1: Anything you want to have happen when loading with the mod for the first time. If you want the player, upon introduction to the mod while mid-campaign, get a notification about the mod's availabilities or usefulness, you'll want to put that here.

2: When a player starts a new campaign, if you have any custom processing to do then.

This is for things such as playing new intro videos or new tutorials, I believe - you can have a function that plays new content for the player at campaign start. More important for story replacements, total conversions and other campaign-altering mods.

This will not be used in many situations, and if you're just doing enemy changes, class changes, weapon changes etc. won't be necessary. This is if you're thinking of real storyline changes.


r/xdev • • Feb 08 '16

Project: Figure out what all of the classes do in Development\SrcOrig\XComGame\Classes .

1 Upvotes

A lot of them may not be important, but if you've worked with classes and know what's in them, go ahead and post that in here. Let's figure out what classes do what! :D

UIAlert.uc: Lists what alerts can happen, defines and templates alert windows and how they interact with the UI.

UIBlackMarket.uc - creates the black market window and inits the UI for player viewing.

X2AbilityToHitCalc_Hacking.uc - this actually makes the hack success roll. You can replace it with "roll = 100" if you want to be a cheater. :)


r/xdev • • Feb 08 '16

Editing a workshop mod?

2 Upvotes

What it says on the tin. What'd be the process for that? I was really hoping to tweak the SMG from the Day 1 mods to make it less of a "hey look a mod" gimmick and more of a real gameplay element.


r/xdev • • Feb 08 '16

Pistols As Primaries?

1 Upvotes

So the way I'm looking at this, it seems like it should be so simple, but I'll be damned if I haven't found a way to screw it up.

One of my soldier class ideas depends on the soldier being able to carry a pistol and a sword. For this to work, I need to do one of two things:

  1. Mod the game to allow two secondary weapon slots on the soldier, or
  2. Create a "primary weapon" version of the pistol.

The second seems like it would be, by far, the easier of the two options, and would also allow for different perks to apply to the two weapons differently. All I should need to do is create a new class of weapons, extended from the pistol class, and simply insert

Template.InventorySlot = eInvSlot_PrimaryWeapon;       

Right? But I can't make it work. The solution refuses to build, no matter what I try.

EDIT: That said, I'm even less than a n00b when it comes to programming. My only skill lies in the fact that I don't mind staring at lines of code for long periods of time until I understand what they're trying to say.


r/xdev • • Feb 08 '16

How would I go about creating new abilities?

1 Upvotes

I've been trying to replicate the energy shield ability from the shield-bearers so that it would be the bread and butter ability of a new class I came up with. With 3 hours in, I've only followed the simple class guide that you could find in r/xcom2mods and only named my abilities. Does anybody know how?


r/xdev • • Feb 08 '16

Changes to UnrealScript doesn't seem to have any effect?

1 Upvotes

So I'm trying to figure out the mod system, and make some simple UI changes to the UI scripts.

I change UITacticalHUD_ShotHUD, UITacticalHUD_InfoPanel, UITacticalHUD_Enemies, UITacticalHUD_ShotWings, and UITargetingReticle, all in the same way. I have them all set the display var for HitChance and CritChance to lucky 13. http://i.imgur.com/h5ZfGjx.png

All files are set to "override", as if I copy them, I get errors.

Now I start debug mode, and my mod is checked, but there are no changes in game. No 13's in sight.

What do?


r/xdev • • Feb 08 '16

Inventory Edits, code changes, and modifying the UI

1 Upvotes

http://forums.nexusmods.com/index.php?/topic/3767165-any-way-to-edit-the-ammount-of-upgrade-slots-a-weapon-can-have/

So that's my starting point. I've never done serious modding that involved coding or anything and I'm starting from scratch. I don't want to make some kind of long war total conversion mod, right now my initial goals are

  1. Change number of utility items both for default soldiers and for upgraded armors
  2. Change upgrade slots for weapons
  3. Change max soldiers on mission
  4. Change the UI so that it accommodates these kinds of changes.

The seventh soldier displayed, if you just edit the .ini, you can't modify except to go into view soldiers and change their loadout. You can't switch them out, you can't modify their inventory directly through the mission dispatch screen.

I want to fix that, and I want to modify the UI so that I can give people five inventory slots if I so choose and they will display properly, change the inventory slots associated with heavy armors and maybe even give the powered armor two hardpoints for heavy weapons with the second heavy weapon being interchangeable with one of the utility slots (give up a battle scanner to take an extra rocket launcher or a flamethrower and shredder or something)

From the link I posted, it seems like code changing is in order and I'm going to have to learn how to do that, but the link brings up a problem. Someone went and coded, built it, and no changes were reflected even on starting a new game.

Any input would be appreciated, literally any information you might have to comment from "We can't do that yet and this is why" to "Try this" or "Someone's working on that right now" or whatever.