Jump to content

Please help with adding UI to Existng Weapons


Yzaxtol

Recommended Posts

Hi There

 

Just to let you know that I've been struggling with this issue for days, I have so far successfully injected my own stats and UI into both Utility Items and Armor but when it comes to Weapons it seems that my method doesn't work with them. Every mod I've looked at has either re-created the weapon in a messy copy+paste of the X2Item_DefaultWeapons or created a new weapon that has UI changes in the CreateTemplate.

 

Any help anyone could provide in the matter would be invaluable as I'm at my wit's end. I don't have much experience with programming so the basics are often lost to me as I rely solely on pattern recognition and trial and error to get through.

 

EDIT: In case it wasn't implied, the stats are being applied in the tactical section but they never appear on the UI which is paramount in the Overhaul mod that i'm designing :sad:

 

 

 

class Weapons_AssaultRifle_Tier1 extends X2Item_DefaultWeapons	config(SpectrumWeapon); 

var config int ASSAULTRIFLE_CONVENTIONAL_HP_BONUS;
var config int ASSAULTRIFLE_CONVENTIONAL_MOBILITY_BONUS;
var config int ASSAULTRIFLE_CONVENTIONAL_DODGE_BONUS;
var config int ASSAULTRIFLE_CONVENTIONAL_WILL_BONUS;
var config int ASSAULTRIFLE_CONVENTIONAL_CRIT_BONUS;
var config int ASSAULTRIFLE_CONVENTIONAL_SIGHT_BONUS;
var config int ASSAULTRIFLE_CONVENTIONAL_AIM_BONUS;
var config int ASSAULTRIFLE_CONVENTIONAL_DEFENSE_BONUS;
var config int ASSAULTRIFLE_CONVENTIONAL_HACK_BONUS;
var config int ASSAULTRIFLE_CONVENTIONAL_PSI_BONUS;
var config bool ASSAULTRIFLE_CONVENTIONAL_CAN_SQUADSIGHT;

static function array<X2DataTemplate> CreateTemplates()
{
	local X2ItemTemplateManager ItemTemplateManager;
	local X2WeaponTemplate Template;
    local array<X2DataTemplate> Weapons; 

	ItemTemplateManager = class'X2ItemTemplateManager'.static.GetItemTemplateManager();
	Template = X2WeaponTemplate(ItemTemplateManager.FindItemTemplate(name("AssaultRifle_CV")));

	Template.UIStatMarkups.Remove(0,10); 
//WeaponStats Working in Tactical
	Template.Abilities.AddItem('WeaponStats_AssaultRifle_CV');
//WeaponStats UI NOT WORKING :'(
	Template.SetUIStatMarkup(class'XLocalizedData'.default.HealthLabel, eStat_HP, default.ASSAULTRIFLE_CONVENTIONAL_HP_BONUS);
	Template.SetUIStatMarkup(class'XLocalizedData'.default.MobilityLabel, eStat_Mobility, default.ASSAULTRIFLE_CONVENTIONAL_MOBILITY_BONUS);
	Template.SetUIStatMarkup(class'XLocalizedData'.default.DodgeLabel, eStat_Dodge, default.ASSAULTRIFLE_CONVENTIONAL_DODGE_BONUS);
	Template.SetUIStatMarkup(class'XLocalizedData'.default.WillLabel, eStat_Will, default.ASSAULTRIFLE_CONVENTIONAL_WILL_BONUS);
	Template.SetUIStatMarkup(class'XLocalizedData'.default.CritChanceLabel, eStat_CritChance, default.ASSAULTRIFLE_CONVENTIONAL_CRIT_BONUS);
	Template.SetUIStatMarkup(class'X2TacticalGameRulesetDataStructures'.default.m_aCharStatLabels[eStat_SightRadius], eStat_SightRadius, default.ASSAULTRIFLE_CONVENTIONAL_SIGHT_BONUS);
	Template.SetUIStatMarkup(class'XLocalizedData'.default.AimLabel, eStat_Offense, default.ASSAULTRIFLE_CONVENTIONAL_AIM_BONUS);
	Template.SetUIStatMarkup(class'XLocalizedData'.default.DefenseLabel, eStat_Defense, default.ASSAULTRIFLE_CONVENTIONAL_DEFENSE_BONUS);
	Template.SetUIStatMarkup(class'XLocalizedData'.default.TechBonusLabel, eStat_Hacking, default.ASSAULTRIFLE_CONVENTIONAL_HACK_BONUS);
	Template.SetUIStatMarkup(class'XLocalizedData'.default.PsiOffenseBonusLabel, eStat_PsiOffense, default.ASSAULTRIFLE_CONVENTIONAL_PSI_BONUS);
	
		
    return Weapons;  
}

 

 

Link to comment
Share on other sites

  • 1 year later...

Was there ever an answer to this question? Any clues about where to look for answers would be GREATLY appreciated. I have no hair left! My mod works great with this one exception no stats in the strategic Armory UI.

 

I have looked for 3 days and there is very little information about Template.SetUIStatMarkup to be found. I know it has to be something I'm missing or something I have misnamed. I have looked at several mods to see what they did and the code looks exactly like mine. Any help would be very much appreciated.

Link to comment
Share on other sites

Oh Boy, oops! I guess I could say the reason I could not find an answer was that in my case it was a misnamed file. I really should pay more attention to this stuff. TIL: Recheck all file names and dependencies before you start pulling hair out. :laugh:

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...