Jump to content

PurePassive and Salvo


ClaytonCross

Recommended Posts

static event OnPostTemplatesCreated()
{
	local X2SoldierClassTemplateManager ClassManager;
	local X2SoldierClassTemplate Template;
	local array<SoldierClassAbilityType> AbilityTree;
	local int i;

	Template = class'X2SoldierClassTemplateManager'.GetSoldierClassTemplateManager().FindSoldierClassTemplate('yourclassname');
	AbilityTree = Template.GetAbilityTree(iRank);
	for(i = 0; i < AbilityTree.length; ++i)
	{
		`log("Ability name:"@AbilityTree[i].AbilityName);
		`log("Applied to:"@AbilityTree.ApplyToWeaponSlot);
	}
}

I would do this for whatever rank(s) Return Fire and Ever Vigilant are at. Check if the output matches what you intended.

BTW, I was going to use this in my own mod, but it doesn't work. The GetSoldierClassTemplateManager command causes build errors.

Link to comment
Share on other sites

  • Replies 44
  • Created
  • Last Reply

Top Posters In This Topic

I have made some ground:

 

Appling to src -> Stormguard -> classes -> X2GlobalHooks.uc

 

static event OnPostTemplatesCreated()
{
local X2SoldierClassTemplate ClassManager;
local X2SoldierClassTemplate Template;
local array<SoldierClassAbilityType> AbilityTree;
local int i;

Template = class'X2SoldierClassTemplateManager'.static.GetSoldierClassTemplateManager().FindSoldierClassTemplate('StormGuard');
AbilityTree = Template.GetAbilityTree(2);
for(i = 0; i < AbilityTree.length; ++i)
{
`log("Ability name: EverVigilant "@AbilityTree.abilityName);
`log("Applied to: eInvSlot_PrimaryWeapon"@AbilityTree.ApplyToWeaponSlot);
}
}

But I get:

Error, Invalid property or function call on a dynamic array

 

Which seems to be I messed up the two log lines but I don't know how. Any help would be appreciated! Thanks you!

Link to comment
Share on other sites

@ Kregano

 

Would you mind posting your adjusted script so I could see your variable changes? I kind of understand what prowler83 is suggesting but I am not sure of the replacements.

I think what might be missing is a way to set AbilityName to whatever you want. I've got a bit of code in another mod that handles that and modified it for this:

{
CheckSkill('Grenadier','Suppression');
}
static function CheckSkill(Name BaseTemplateName, Name AbilityName)
{
    local X2SoldierClassTemplate ClassManager;
    local X2SoldierClassTemplate Template;
    local array<SoldierClassAbilityType> AbilityTree;

    local int i;

    Template = class'X2SoldierClassTemplateManager'.static.GetSoldierClassTemplateManager().FindSoldierClassTemplate(BaseTemplateName);
    AbilityTree = Template.GetAbilityTree(1);
    for(i = 0; i < AbilityTree.length; ++i)
    {
        `log("AbilityName"@AbilityTree[i].AbilityName);
        `log("Applied to: eInvSlot_PrimaryWeapon"@AbilityTree.ApplyToWeaponSlot);
    }
}

Unfortunately, I still got same error code.

Link to comment
Share on other sites

Okay, it compiles, but there's still a warning because ClassManager is an unreferenced local variable. Couldn't find log entries related to the class and its tree, but I might have been looking in the wrong spot.

Link to comment
Share on other sites

So I applied it successfully. However they are still using pistols so I am sure I did something wrong. Here is what I used:

 

[XcomClassData.ini]

 

; Corporal (Corporal = iRank 2 I would think)
+SoldierRanks=( aAbilityTree=( (AbilityName="EverVigilant", ApplyToWeaponSlot=eInvSlot_PrimaryWeapon), (AbilityName="Salvo", ApplyToWeaponSlot=eInvSlot_Unknown)

 

[X2GlobalHooks.uc]

 

static event OnPostTemplatesCreated()
{
local X2SoldierClassTemplate ClassManager;
local X2SoldierClassTemplate Template;
local array<SoldierClassAbilityType> AbilityTree;
local int i;

Template = class'X2SoldierClassTemplateManager'.static.GetSoldierClassTemplateManager().FindSoldierClassTemplate('StormGuard');
AbilityTree = Template.GetAbilityTree(2);
for(i = 0; i < AbilityTree.length; ++i)
{
`log("AbilityName"@AbilityTree.abilityName);
`log("Applied to: eInvSlot_PrimaryWeapon"@AbilityTree.ApplyToWeaponSlot);
}
}

My only concern is how does it know to use EverVigilant instead of Salvo?

Link to comment
Share on other sites

What do you mean, use EverVigilant? It should be logging both/all of them.

 

Also it looks like you're missing some closing parentheses in your ini, and also the error could have started several lines up so you'd need to check those too.

 

Does the log for EverVigilant say it's linked to the primary weapon or not?

 

Corporals have a rank of 2, however since rookie tier wouldn't have an ability tree it's likely you need Template.GetAbilityTree(1);

Link to comment
Share on other sites

Ah, it failed. I see now:

 

Analyzing...
C:\Program Files (x86)\Steam\steamapps\common\XCOM 2 SDK\Development\Src\StormGuard\Classes\X2GlobalHooks.uc(76) : Warning, 'ClassManager' : unreferenced local variable
Scripts successfully compiled - saving package 'C:\Program Files (x86)\Steam\steamapps\common\XCOM 2 SDK\binaries\Win64\..\..\XComGame\Script\StormGuard.u'

Warning/Error Summary
---------------------
C:\Program Files (x86)\Steam\steamapps\common\XCOM 2 SDK\Development\Src\StormGuard\Classes\X2GlobalHooks.uc(76) : Warning, 'ClassManager' : unreferenced local variable

Success - 0 error(s), 1 warning(s) (0 Unique Errors, 1 Unique Warnings)

 

Like Kregano said, ClassManager has and issue.

 

Also, Rookie 0 --> Squaddie 1 --> Corporal 2 ?

My INI has the closing parentheses but I omitted it and the leveling stats.

 

Here is the full line for referance:

+SoldierRanks=( aAbilityTree=( (AbilityName="EverVigilant", ApplyToWeaponSlot=eInvSlot_PrimaryWeapon), (AbilityName="Salvo", ApplyToWeaponSlot=eInvSlot_Unknown) ), aStatProgression=((StatType=eStat_Offense,StatAmount=2), (StatType=eStat_HP,StatAmount=1), (StatType=eStat_Strength,StatAmount=1), (StatType=eStat_Hacking,StatAmount=5), (StatType=eStat_CombatSims,StatAmount=0)), )

 

I was looking at the script and it looked to me that the first line was redundant to the second line.

local X2SoldierClassTemplate ClassManager;
local X2SoldierClassTemplate Template;

So I removed the first line, saved, and ran it again. It did remove the error, but it did not provide a log statement. At least that I can see.

 

Analyzing...
Scripts successfully compiled - saving package 'C:\Program Files (x86)\Steam\steamapps\common\XCOM 2 SDK\binaries\Win64\..\..\XComGame\Script\StormGuard.u'

Success - 0 error(s), 0 warning(s) (0 Unique Errors, 0 Unique Warnings)

Execution of commandlet took: 8.93 seconds


SUCCESS! Copying compiled script binaries...

Package StormGuard => C:\Program Files (x86)\Steam\steamapps\common\XCOM 2 SDK\XComGame\\Mods\StormGuard\Script\StormGuard.u

Thanks again for your guidance Prowler83! Sorry If my lack ability is frustrating.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...