Jump to content

Modding details? Ask away!


Amineri

Recommended Posts

DefaultGameDate_SoldierSkills.ini has influence on abilities right? But nothing I change seems to do anything. I'm trying to outright remove the mindcontrol ability Sectoids have, but modifying the "SECTOID_MINDSPIN_CONTROL_DURATION=2" in any way doesn't actually do anything. Deleting it doesn't change anything, setting it to zero or -1 dosen't do anything either.

 

It also confirmed my annoyance with the ability: It's actually global. It has no range variable like the Bind ability vipers have, would it be easier to give it a max range?

Edited by StealthClaw
Link to comment
Share on other sites

  • Replies 399
  • Created
  • Last Reply

Top Posters In This Topic

Amineri,

 

I'm currently working on a mod that will add and modify weapon mods and I wanted to make all the default weapons have the same number of upgrade slots for balancing but that is where I'm currently hitting an annoying wall.

 

Since for some reason the weapon upgrade slots are defined directly in X2Item_DefaultWeapons and not exposed in an .ini the only way I've managed to mod it reliably is to override X2Item_DefaultWeapons in its entirety with my new upgrade slot value.

This is a very messy way of doing it but as NumUpgradeSlots is defined inside a function extending the file with a new override function doesn't appear to work, is there a simple method that I'm missing?

 

Edit: Completely overriding X2Item_DefaultWeapons also appears to have some strange side effects and occasionally makes weapons have a max ammo of 0.

Link to comment
Share on other sites

I figured playing around with mission names would be a good small little thing to start off with. I determined easily enough that XGMission was responsible for those. Its a Class, I want to change what that class does, helpfully included in the templates was ExampleClassOverride. I read it, it makes sense to me, create a new class, inherent from the old, override what functionality you wish to change.

 

Register your desire to override the original class with ModClassOverrides

 

But here I am, not seeing my changes make it into the game.

 

At this point my override class basically reads:

// This is an Unreal Script

class XGMission_OAN extends XGMission;

static function string GenerateOpName(optional bool bTutorial = false)
{
    return "TEST";
//Original code that should be irrelevant.
}

And my XComGameEngine.ini reads:

[Engine.ScriptPackages]
+NonNativePackages=OperationAdjectiveNoune

[Engine.Engine]
+ModClassOverrides=(BaseGameClass="XGMission", ModClass="XGMission_OAN")

I saw this post earlier in the thread by you Amineri which i hoped would help me figure it out.

 

As far as I can tell this is not a GameState class. It is not an archetype. If I intentionally write some bad code it fails to build. When it does build it happily deposits a OperationAdjectiveNoune.u there.

 

I've been testing it by loading up the debug-mode strategy layer and scanning until a misison is generated to check the name, so there should not be a problem with savegame baked classes or data.

 

I am most likely doing something wrong but I have no clue what it is.

Link to comment
Share on other sites

DefaultGameDate_SoldierSkills.ini has influence on abilities right? But nothing I change seems to do anything. I'm trying to outright remove the mindcontrol ability Sectoids have, but modifying the "SECTOID_MINDSPIN_CONTROL_DURATION=2" in any way doesn't actually do anything. Deleting it doesn't change anything, setting it to zero or -1 dosen't do anything either.

 

It also confirmed my annoyance with the ability: It's actually global. It has no range variable like the Bind ability vipers have, would it be easier to give it a max range?

 

Abilities in general are set within the template code -- within Unrealscript.

 

Also, mindspin as an ability gives the Sectoid a random chance to disorient, panic, OR mind control. It makes a number of will stat contests, and the more it succeeds at, the more powerful the effect.

Link to comment
Share on other sites

Amineri,

 

I'm currently working on a mod that will add and modify weapon mods and I wanted to make all the default weapons have the same number of upgrade slots for balancing but that is where I'm currently hitting an annoying wall.

 

Since for some reason the weapon upgrade slots are defined directly in X2Item_DefaultWeapons and not exposed in an .ini the only way I've managed to mod it reliably is to override X2Item_DefaultWeapons in its entirety with my new upgrade slot value.

This is a very messy way of doing it but as NumUpgradeSlots is defined inside a function extending the file with a new override function doesn't appear to work, is there a simple method that I'm missing?

 

Edit: Completely overriding X2Item_DefaultWeapons also appears to have some strange side effects and occasionally makes weapons have a max ammo of 0.

 

Unfortunately, modifications of existing templates is a system that didn't end up with a great interface for -- yet. Firaxis is aware of it, for sure. Two of the three Long War Studios release mods had to modify existing templates, so they know it's something we have to do.

 

In the simple answer (see SMG mod for example of this), the template doesn't build difficulty variants. In this case you can simple retrieve the appropriate TemplateManager, retrieve the template, modify it, and store it back. The SMG mod does this to modify the existing upgrade templates to make them work for the SMGs, and it sounds like you should be able to do the same.

 

In the hard answer (see Officer mod for example of this), the template builds difficulty variants. Difficulty variants are handled transparently by native code in the TemplateManager -- you simply query the TemplateManager for a template of a given name, and the native code that executes it retrieves the current difficulty and returns the appropriate difficulty variant of the requested template. The problem is that when you request a template during the template-creation phase when the game is launching, there is no difficulty set, so it defaults to Veteran. This results in the template only being modified for the difficulty, not all of them.

 

There is one confirmed workaround for the hard-answer, which is what I implemented in the Officer mod. In this case I had to modify the existing OTS template (called that in code) in order to add an upgrade and a staffslot for training the officer. However, FacilityTemplates generate difficulty variants, as the costs and times increase on Legend. The workaround is to build a call (I used a UIScreenListener attached to UIFacility_Academy), and in that call invoke code that loops over all difficulties, setting the difficulty (in a way that doesn't change the min difficulty), then retrieving the necessary template from the TemplateManager, modifying it and storing it back. This has to occur after a campaign is launched or a savefile is loaded, as before then there is no CampaignSettings game state with which to change the difficulty.

 

-----------------------

 

Just to reiterate, there are possible situations when trying to modify existing templates, and it turns out that your case appears to the the easier one. :)

Link to comment
Share on other sites

It is good to see there are so many nations, but how do you add more?

 

I would personally like to add Denmark and Finland for example as a nation your soldiers can come from as an example.

 

Look at the unreal template class X2CountryTemplate. Currently all of the countries are created in the class X2StrategyElement_DefaultCountries (using that template), but you can create a new class by mirroring this and add new countries.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...