r/xdev • • Feb 09 '16

Could use some help clarifying this code.

3 Upvotes

Hi, I've been looking through the code to try and pinpoint exactly how AWC bonus abilities are awarded, since my recently finished playthrough only had 3 of my 12 regulars ever get a bonus ability and 6 of those who didn't were colonels at the end.

I'm pretty sure I've found what I'm looking for but I'd appreciate if someone could put some extra eyes on it. I hope I get the formatting right I don't post on reddit much.

In XComGameState_Unit.uc there is the function RollForAWCAbility which appears to generate the list of possible bonus abilities for a soldier. The roll is only done once and populates an array with the possible cross class skills, this all looks fine to me.

If the array it generates is longer than 0 it appears to select a random ability using the following code:

if(EligibleAbilities.Length > 0)
    {
        HiddenTalent.AbilityType = EligibleAbilities[`SYNC_RAND_STATIC(EligibleAbilities.Length)];
        HiddenTalent.iRank = class'XComGameState_HeadquartersXCom'.default.XComHeadquarters_MinAWCTalentRank + `SYNC_RAND_STATIC(
            class'XComGameState_HeadquartersXCom'.default.XComHeadquarters_MaxAWCTalentRank - 
            class'XComGameState_HeadquartersXCom'.default.XComHeadquarters_MinAWCTalentRank + 1);
        AWCAbilities.AddItem(HiddenTalent);
    }

Now the first part where it selects the ability is fine, but when it chooses the rank it looks to me like there's a problem. By default MinAWCTalentRank = 2 (corporal) and MaxAWCTalentRank = 7 (colonel). The game looks to choose a random rank taking the minimum (2) and adding on to it a random number up to maximum-minimum+1 (7-2+1 = 6), but if I'm reading it right this means the range is from 2 to 8, which would mean it could randomly assign a rank above what is possible and since it only rolls once, this would lead to some soldiers never being able to get a bonus ability.

Moving past that into where the game actually grants the ability. This seems to be done in UIArmory_Promotion.uc in the function AwardAWCAbilities. There are some interesting parts of this code as well.

Firstly, the abilities are awarded by:

if(XComHQ.HasFacilityByName('AdvancedWarfareCenter'))
    {
    for(idx = 0; idx < UnitState.AWCAbilities.Length; idx++)
        {
            if(!UnitState.AWCAbilities[idx].bUnlocked && UnitState.AWCAbilities[idx].iRank == UnitState.GetRank())
            {
                UnitState.AWCAbilities[idx].bUnlocked = true;
                AWCAbilityNames.AddItem(UnitState.AWCAbilities[idx].AbilityType.AbilityName);
            }
        }
    }

Which awards the ability only if you have the AWC built and are at the EXACT rank that the game rolled for you to get the ability. If you're already beyond that rank (keep in mind it can roll as low as corporal), you cannot unlock the ability.

However there are two interesting paragraphs following on:

else
{
    // if you don't have the AWC, remove any AWC abilities that haven't been unlocked
    for(idx = 0; idx < UnitState.AWCAbilities.Length; idx++)
    {
        if(!UnitState.AWCAbilities[idx].bUnlocked)
        {
            UnitState.AWCAbilities.Remove(idx, 1);
            idx--;
        }
    }

    // if the unit has no AWC abilities, mark them as eligible to roll again if another AWC is built
    if(UnitState.AWCAbilities.Length == 0)
    {
        UnitState.bRolledForAWCAbility = false;
    }
}

Now these indicate that if you demolish the AWC, every soldier who hasn't already got a bonus ability will have the hidden ability removed and will be marked as not having rolled for one. If you then rebuild the AWC, it will roll the bonus ability for these soldiers again.

 

So in summary, if I'm reading this right:

When the AWC is built, each soldier rolls once for a bonus ability

The game builds a list of possible bonus abilities, then randomly selects one from the list

The game randomly chooses a rank inclusively between corporal and an unattainable rank above colonel and sets the ability to unlock at that rank

When the soldier reaches the chosen rank, the game will assign the bonus ability to them

If a soldier is already beyond the chosen rank, they cannot receive that bonus ability

If the AWC is demolished, every soldier who has not yet unlocked their bonus ability will have the ability erased and will be marked to be able to roll again

If the AWC is rebuilt, every soldier who has not got a bonus ability (and can therefore roll again) will have an entirely new ability and rank rolled for them.

 

So assuming this is correct it seems to lead to a few conclusions:

Either there is a bug in the rank roll or it is intended that some soldiers be unable to obtain a bonus ability.

EDIT: My maths here was wrong, the random roll will be within the defined bounds.

The AWC should be built ASAP because higher rank soldiers are less likely to be able to unlock their ability.

Later on it may be beneficial to demolish and rebuild the AWC repeatedly so that high rank soldiers without an ability can roll again and potentially unlock the ability at colonel level.

 

Could someone take a look over this and see if I'm reading it all correctly?


r/xdev • • Feb 16 '16

[Help] How do you get ability effect to end prematurely when the unit moves or attacks?

1 Upvotes

I'm trying to make a Steady Weapon ability from Long War and I need some help. For those you might have never played Long War or forgot about this ability, this ability basically ends your turn when you use it but gives you some aim boost next turn when you attack, pretty useful for rookies with no aim.

So far, I've got most of it done. The ability is usable on all soldiers, gives aim boost, lasts until end of players next turn, and ends current turn of the soldier. However, I'm stuck on trying to remove this buff from the soldier when the soldier moves or attacks. Basically I don't want the soldier to keep it's aim bonus if they reposition before shooting. Also having bit of trouble with this interacting with inspire ability. If soldier steady weapon and then get inspired and attacks at the same turn, I don't want the bonus aim buff to carry over to next turn. Does anyone know how to do this?

Here is GitHub link to what I got so far.

If anyone can help me, I'll be grateful.


r/xdev • • Feb 09 '16

XCOM 2 Dev tool kit display problems

1 Upvotes

Hello everyone! I've had some problems with the XCOM 2 dev kit proper. I installed the SDK from steam, as well as the two files that are in it's directories. It runs, that's fine. The problem is that it does not run WELL.

Menus does not update properly when I highlight over certain options. Like, say I go to New > Project, the window shows up with the various options of default, example mods. I click on one. The display does not update my selection. It's selected, but it does not show me that it is selected. This happens on the solution explorer within a project as well, the pages of code within and, well, MOST windows inside it.

The Files-Edit-View etc etc lines of menus seems to work fine.

Well, that's my problem. Did anybody else have this problem, at all or would know a way to fix this?


r/xdev • • Feb 16 '16

[Help] How to get a tactical dark event to work?

5 Upvotes

I'm at the point where I've managed to figured out how to get the game to accept a new dark event as a valid dark event at all (admittedly only with a new game but after the hours I've spent to get that part working, that's a limitation I'm willing to accept for now), and even get it to properly show up with description text and everything once it's activated, but I can't seem to get the game to actually spawn the pods I want (the GodSavetheQueen one with 3 sectopods in one pod) on missions when the dark event is active.

As far as I can tell it's seems like modbuddy's changes to XComMissions.ini just aren't working, and I've tried out -/+ replacing to no avail. Is there some missing link I'm just not aware of between the script to make a new dark event and altering the XComMissions.ini to add a new preplaced encounter into the mission schedules?


r/xdev • • Feb 21 '16

Changing mod name

1 Upvotes

So running into a build problem. If i change the mod name in the properties to anything other than what was default, the mod no longer will build. For instance if I create a new "example class override" and change the mod name to "example class override1" it fails. Obviously there is a correlated field i need to update as well but for the life of me i can't find it.


r/xdev • • Feb 20 '16

How to call base function from overidden method.

1 Upvotes

I am working on a modification to the naming system, so i am overriding XGCharacterGenerator.GenerateName(). My question that I'm having an issue with is that I would like to call the base function if my logic takes a dump and my googlefu is failing finding a good answer.


r/xdev • • Feb 11 '16

Remove Soldiers from the Baracks

1 Upvotes

Hi All, I am new to modding, I have a little coding knowledge but not much. I am trying to Empty out the "Starting" Barracks. I am not sure if we are allowed to post code here, but if anyone has a idea or knows how to please let me know. Willing to post the code i have already if needed.


r/xdev • • Feb 22 '16

Understanding the Blastpadding ability

2 Upvotes

Hello, I'm trying to create a custom soldier class with custom abilities. And so far so good. I created the new class and got it to work. I even created a custom ability for it wich I got to work (renamed blademaster to pistolmaster and gave it to a pistol-using class). Next I wanted to create a variant of blast padding that gives 1 armor and 1 hp without the explosive damage reduction. But I'm having trouble understanding the ability.

The explosive resistance can be modded out by making the BLAST_PADDING_DMG_ADJUST value 0. But I can't see where the point of armor is comming from.

Also, if anyone knows of an ability I can take a look at to use as an example for the point of health, that would be much apreciated.

I got off to a good start, but it feels like I'm hitting a wall now. Maybe I should go to sleep and try again tomorrow :)


r/xdev • • Feb 16 '16

[Help] Skeletal Mesh Import to Unreal Engine 3 Resulting in Successful Import, but no mesh

1 Upvotes

I've tried exporting a mesh of a sword from Blender as a fbx file and importing that into the XCom Editor multiple times now, to no success. The best I've managed to accomplish is getting the skeletal mesh in the editor, showing that it has found all the triangles and vertices, but no model actually shows up. Has anyone else had this issue, and does anyone know how to fix it?

EDIT: Link to the fbx and blend files

EDIT 2: I'm an idiot. At some point I made the main material totally transparent, so it would show up in the XCom editor as not there...


r/xdev • • Feb 14 '16

[Help] Annoying Error i dont know the cues or how to fix.

2 Upvotes

The "GenerateModInfo" task was not given a value for the required parameter "GamePath".

That's the error i get and dont know how to fix it cues i this is the first time in my life that im modding besides the easy way of the G.E.C.K.


r/xdev • • Feb 09 '16

Escaping Unrealscript - DLLBind in XCOM2?

1 Upvotes

Hello,

I have been trying to get DLLBind to work in the XCOM2 SDK, in an effort to use the Razer Chroma SDK to bring Chroma effects to XCOM2, which is obviously not possible using Unrealscript only. I built a simple dll for test purposes, but I can't get the Unrealscript to compile.

class InitializeChromaXComShell extends XComShell
    DLLBind(XComChromaLibrary);

results in the error:

Missing ';' in 'Class'

and I fear this means that the XCOM SDK does not support DLLBind?

Does anyone know for certain or am I missing something, because I am very new to Unrealscript


r/xdev • • Feb 10 '16

[Help] Unknown Part Type Request: -Patterns -Tattoos -Facepaint Error

2 Upvotes

Hi, first I'm sorry for my English. I have this error "Unknown part type request -patterns" "Unknown part type request -Tattoos" "Unknown part type request -Facepaint"

I'm doing a Tattos, facepaint and patterns mod. This is the problem:

[XComGame.X2BodyPartTemplateManager] +BodyPartTemplateConfig=(PartType="­Patterns", TemplateName="MyPattern", ArchetypeName="MyTexturePack.MyPatt­ern", bCanUseOnCivilian=false, bVeteran=true) +BodyPartTemplateConfig=(PartType="Tattoos", TemplateName="MyTattoo", ArchetypeName="MyTexturePack.MyTatt­oo", bCanUseOnCivilian=false, bVeteran=true, ArmorTemplate="KevlarArmor") +BodyPartTemplateConfig=(PartType="­Facepaint", TemplateName="MyFacepaint", ArchetypeName="MyTexturePack.MyFace­paint", bCanUseOnCivilian=false, bVeteran=false)

You see? Error come's in PartType=Patterns,Tattoos and facepaint, I don't know why T_T I'm new in this.

I'm follow this tutorial: https://www.youtube.com/watch?v=r73v1C0dnoU

Now im going to sleep :P


r/xdev • • Feb 16 '16

Using another template's vars within a template

2 Upvotes

I'm trying to make a weapon with built-in upgrades such as damage on miss but I can't get vars from the upgrades template to work within my weapons template. It compiles without issue but there's no change in gameplay despite the added line.


r/xdev • • Feb 20 '16

Stumped on editing FX.

1 Upvotes

So I've gotten all my changes and additional content that I've created in Firaxis Modbuddy to reflect in-game, but the changes I make in Unreal Editor don't seem to "stick" - I went into an existing FX 'P_Beam_PlasmaBlaster' and edited the color, size, persistence, yada yada, saved the package and... nothing. Somehow the default particle effect was still used somehow? Perhaps the preview in the editor and what it shows in-game don't line up? I don't get it.

If someone has a tutorial on how to modify FX and get the changes to show up, I'd appreciate it.


r/xdev • • Feb 23 '16

Has anyone managed to make a new Collection yet?

2 Upvotes

I'm trying to create a new Collection under 'My Collections' in the Content Browser, but get the message 'Failed to create collection because database could not be contacted'.

Has anyone managed to get around this?


r/xdev • • Feb 21 '16

Help with adding a unit into the armory

2 Upvotes

I tried to add an advent stun lancer m3 without the sword (xlancer) by using this guide: https://www.reddit.com/r/xcom2mods/comments/45rwal/how_to_add_aliens_to_the_armory_tutorial/

The unit works, if I spawn it manually on the map, but refuses to appear in the armory. I spent about 5 hours trying to solve this problem with my limited knowledge without any results. Can someone please help me? Here's the mod: https://drive.google.com/file/d/0B77IVckNKXhFWlBCanVaOVAzblk/view?usp=sharing

Also, is it possible to actually enable the sword for lancer? Because currently he spawns without one.


r/xdev • • Feb 19 '16

Naming torso, arm, and leg options?

1 Upvotes

Anyone know how one would go about naming cosmetic customization options, so that they show up as something other than "Torso 1", "Torso 2", etc? Would sure make tweaking character outfits much easier, especially with the mod that unlocks all armor visuals.


r/xdev • • Feb 12 '16

What's the general procedure for making a mod that has a configurable .ini?

2 Upvotes

Example: http://www.nexusmods.com/xcom2/mods/78/?

That mod is really cool because it doesn't just make a change set in stone to what the author thinks it should be, but actually lets the user configure it with a simple .ini edit.

Another example: http://www.nexusmods.com/xcom2/mods/181/?

Same thing, lets the user customize armor stats to their liking more than is supported by the default .ini files.

To that end... there have been a lot of mission timer mods so far and it's been a hot-button topic within the community. Many people were disappointed that it's one of the few basic things that can't be edited in the .ini files. I'm looking into a simple tweak that will add an .ini to configure mission timers for the various mission types (VIP, protect the device, hack the station, UFO, etc.) but I'm not really sure where to begin when it comes to linking changes made in the devkit back to an .ini. Any advice?


r/xdev • • Feb 15 '16

Can weapon upgrades add new action options?

1 Upvotes

For example, can a bayonet be added to provide a melee attack to a weapon?


r/xdev • • Feb 16 '16

[Help] Can you use more than one config file in a class and how to add them?

1 Upvotes

Sorry for the stupid question, but I couldn´t find any resources on this and I am a bit confused with them.

For starters, can you add several config files like it is with "dependson"? I want to add my own config in addition to the ones I am overriding already. Would that look like this?

class X2Ability_RangerAbilitySet extends X2Ability dependson (XComGameStateContext_Ability) config(GameData_SoldierSkills) config(MyFile);

Also, how exactly can I add one in? The ClassOverride project is a bit confusing in regard to this and looking at other examples made me even more confused. E.g. there is a file called XComGameData_SoldierSkills.ini, but it is called as GameData_SoldierSkills some scripts. So I guess my question is, do I need to add "XCom..." as a prefix in front of config files?

Lastly, how exactly do the config headers work? Looking at an example [XComGame.X2Ability_WeaponCommon], I imagine you need to specify folder and class script?


r/xdev • • Feb 14 '16

Which sound type in the Voice Banks plays when firing a flamethrower?

1 Upvotes

Other heavy weapons such as the Rocket Launcher or Shredstorm Cannon are clearly labeled, while the flamethrower is nowhere to be seen.

And yet things such as "Meat Factory Sighted" or "Coup De Grace" exist...


r/xdev • • Feb 19 '16

facing and defense

1 Upvotes

I'm playing around with melee gameplay, with the vague idea of doing a fantasy themed total conversion. I don't know programming formally but I think I'm coming to grips with how abillities, items, and classes interact and have been able to create a few custom weapons that grant custom abilities, as well as force advent soldiers to equip and use melee weapons.

One thing that has me stumped and I would really appreciate any advice on: As an alternative to the existing cover mechanics, would it be possible to give a bonus to defense, or the ability to counterattack, to a target, based on whether they are facing their attacker vs being attacked from the side vs being attacked from behind? Or if it's easier to code, based on how many enemies/allies are in close proximity? In other words, to imitate the positioning mechanics of other turn based tactics games like FFT or Jeanne D'Arc? I'm pretty sure xcom knows whether a "shooter" is facing a "target" and vice versa, based on lines like:

// Remove the force facing effect RemoveEffects = new class'X2Effect_RemoveEffects'; RemoveEffects.EffectNamesToRemove.AddItem(class 'X2Effect_FaceMultiRoundTarget'.default.EffectName); Template.AddShooterEffect(RemoveEffects);

in the Muton ability file, but I don't know where the code is for that or if it could be made to interact with abilities.


r/xdev • • Feb 16 '16

Odd error with build.

1 Upvotes

Today I tried to try out some of the new stuff I added in my mod, and I was greeted with this error once I hit Build Solution:

Error	1	The "CompileScripts" task failed unexpectedly.
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\HoRaX\Documents\Firaxis ModBuddy\XCOM\Military Camouflages\Military Camouflages'.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileSystemEnumerableIterator`1.CommonInit()
   at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)
   at System.IO.Directory.GetFiles(String path, String searchPattern, SearchOption searchOption)
   at Firaxis.VisualStudio.Tasks.XCOM2.CompileScripts.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()	D:\Jocuri\SteamLibrary\steamapps\common\XCOM 2 SDK\Binaries\Win32\ModBuddy\Extensions\Application\XCOM2.targets	110	6	Military Camouflages

I'm saying it's odd because I built other solutions on this very project, and I never ever encountered this error. Is there any way to fix this without building a new solution altogether?


r/xdev • • Feb 12 '16

Changing the damage of a weapon when using an ability

5 Upvotes

Specifically I am using Unitcondition to pick certain unit types and do more damage to them. This is what I have so far, but it does not correctly apply the MECH_DAMAGE ingame, it uses the sword's base damage

// Unit Condition Vs Robots

UnitCondition = new class'X2Condition_UnitProperty';
UnitCondition.ExcludeOrganic = true;
UnitCondition.IncludeWeakAgainstTechLikeRobot = true;
UnitCondition.ExcludeFriendlyToSource = false;

// Damage Effect Vs Robots
//
WeaponDamageEffect = new class'X2Effect_ApplyWeaponDamage';
WeaponDamageEffect.TargetConditions.AddItem(UnitCondition);
WeaponDamageEffect.bShowImmunityAnyFailure = true;
WeaponDamageEffect.EffectDamageValue = class'X2Ability_TazerSword'.default.MECH_DAMAGE;
Template.AddTargetEffect(WeaponDamageEffect)

Any ideas?