Jump to content

Changing item charges


Drakous79

Recommended Posts

Good news - a number of some charges can be changed in UpdateItemCharges() function.

http://i.imgur.com/1NuZm.jpg
Long story short, if is the item's charge set without m_kGameCore or m_kGameCore.1 , I am unable to change it. Cannot add values. And 1 is defined as 26, while I need two spaces for 2C number.

Here is a list:

  • Medikit with Field Medic perk
    24 4C 16 19 19 2E FA 2C 00 00 19 12 20 4F FE FF FF 0A 00 D8 F9 FF FF 00 1C F6 FB FF FF 16 09 00 98 F9 FF FF 00 01 98 F9 FF FF 09 00 EC 2C 00 00 00 01 EC 2C 00 00 02 00 EC 2C 00 00 00 2C 03
  • Battle Scanner
    2C 08 16 1B 56 61 00 00 00 00 00 00 19 19 2E FA 2C 00 00 19 12 20 4F FE FF FF 0A 00 D8 F9 FF FF 00 1C F6 FB FF FF 16 09 00 98 F9 FF FF 00 01 98 F9 FF FF 09 00 EC 2C 00 00 00 01 EC 2C 00 00 02 00 EC 2C 00 00 00 2C 02
  • Frag Grenades with Grenadier perk
    24 55 16 19 19 2E FA 2C 00 00 19 12 20 4F FE FF FF 0A 00 D8 F9 FF FF 00 1C F6 FB FF FF 16 09 00 98 F9 FF FF 00 01 98 F9 FF FF 09 00 EC 2C 00 00 00 01 EC 2C 00 00 02 00 EC 2C 00 00 00 2C 02
  • Alien Grenades with Grenadier perk
    24 58 16 19 19 2E FA 2C 00 00 19 12 20 4F FE FF FF 0A 00 D8 F9 FF FF 00 1C F6 FB FF FF 16 09 00 98 F9 FF FF 00 01 98 F9 FF FF 09 00 EC 2C 00 00 00 01 EC 2C 00 00 02 00 EC 2C 00 00 00 2C 02
  • Ghost Armor
    1B F0 61 00 00 00 00 00 00 2C 04
  • Arc Thrower
    1B A0 33 00 00 00 00 00 00 24 50 16 2C 02

It seems to be working properly, charges are normally counting all the way down to zero. Also it works only in new mission, not in loaded one. Description text does not change.

And the function: XComGame.upk, class XGUnit, function UpdateItemCharges()

function UpdateItemCharges()
{
if(GetCharacter().HasUpgrade(48))
{
SetMediKitCharges(GetInventory().GetNumItems(76) * XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.3);
}
else
{
SetMediKitCharges(GetInventory().GetNumItems(76));
}
if(GetCharacter().HasUpgrade(93))
{
SetRockets(XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.1 + XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.1);
}
else
{
SetRockets(XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.1);
}
if(GetCharacter().HasUpgrade(22))
{
SetShredderRockets(1);
}
if(GetCharacter().HasUpgrade(44))
{
if(GetCharacter().HasUpgrade(92))
{
SetSmokeGrenadeCharges(XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.1 + XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.1);
}
else
{
SetSmokeGrenadeCharges(XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.1);
}
}
if(GetCharacter().HasUpgrade( :cool:)
{
SetBattleScannerCharges(XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.2);
}
if(GetCharacter().HasUpgrade(24))
{
SetFragGrenades(GetInventory().GetNumItems(85) * XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.2);
SetAlienGrenades(GetInventory().GetNumItems(88) * XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.2);
}
else
{
SetFragGrenades(GetInventory().GetNumItems(85));
SetAlienGrenades(GetInventory().GetNumItems(88));
}
SetGhostCharges(4);
SetArcThrowerCharges(GetInventory().GetNumItems(80) * 2);
}

Edit: Added an image and text below.

There is "Uses per mission" string in Item Card on Loadout screen in Barracks. Strange this info is not shown on Build Screen in Engineering. It's managed via:
XComSTrategyGame.upk, class XGSoldierUI
noexport function int GetItemCharges(XComGame.XGGameData.EItemType eItem, optional bool bForce1_for_NonGrenades, optional bool bForItemCardDisplay)
{
bForce1_for_NonGrenades = false;
bForItemCardDisplay = false;
if(eItem == 0)
{
return 0;
}
switch(eItem)
{
case 85:
case 88:
if(m_kSoldier.HasPerk(24))
{
return XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.2;
}
break;
case 76:
if(m_kSoldier.HasPerk(48))
{
return XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.3;
}
break;
case 99:
return ((bForce1_for_NonGrenades) ? 1 : 2);
break;
case 80:
return ((bForce1_for_NonGrenades) ? 1 : 2);
case 78:
case 79:
case 82:
case 81:
return ((bForItemCardDisplay) ? 0 : 1);
default:
return 1;
}
}
  • Frag and Alien Grenades with Grenadier perk
    2C 18 16 04 19 19 2E 92 FE FF FF 19 12 20 FD FE FF FF 0A 00 39 FB FF FF 00 1C 91 FD FF FF 16 09 00 23 FB FF FF 00 01 23 FB FF FF 09 00 FF FA FF FF 00 01 FF FA FF FF 02 00 FF FA FF FF 00 2C 02
  • Medikit with Field Medic perk
    2C 30 16 04 19 19 2E 92 FE FF FF 19 12 20 FD FE FF FF 0A 00 39 FB FF FF 00 1C 91 FD FF FF 16 09 00 23 FB FF FF 00 01 23 FB FF FF 09 00 FF FA FF FF 00 01 FF FA FF FF 02 00 FF FA FF FF 00 2C 03
  • Battle Scanner - seems like leftover from times, when BS was equipable item
    24 63 04 45 2D 00 11 40 00 00 01 00 26 02 00 2C 02
  • Arc Thrower - applies for S.H.I.V. Repair and Drone Hack as well
    24 50 04 45 2D 00 11 40 00 00 01 00 26 02 00 2C 02
Edited by Drakous79
Link to comment
Share on other sites

Just happened upon this while messing with my own project..most all strings are referenced from the .int files, this is from xcomgame.int:

 

m_strPenaltyTitle[ePerk_Grenadier]=Grenadier

m_strPassiveTxt[ePerk_Grenadier]=Allows <XGAbility:GrenadierCharges/> grenades in a single inventory slot.

 

 

A quick and dirty way would be to just manually add your charges in there..not tried just an idea.

 

Well that may fix the description problem but i think you will run into the same problem i am having adding more ranks, you can increase them but the UI is static and you cant see them..not sure how the UI for inventory will like tryin to stuff 6 or so grenades on your pocket..LOL

Edited by tsanford01
Link to comment
Share on other sites

Thank you for poiting out localization files. Well, may be "dirty" but works.

 

Where is <XGAbility:GrenadierCharges/> or <XGAbility:RocketeerExtraRockets/> defined?

 

Also UI has limitations you mentioned. There is 3 images maximum for small slot. Edited the first post with GetItemCharges function and added an image.

Link to comment
Share on other sites

Nice to see. Can you add charges of a different type to an item?

 

Specifically I've been trying to make combo medkits like original X-Com - give combat stims Heal Wound. It works, except they don't have any "medkit" charges, that's what is missing.

Link to comment
Share on other sites

I am sorry, but it cannot be done without adding new scripts. I mean adding charges to Combat Stims or any other item not having them now. If I dream, we would have to be able to add stuff like:

 

 

// XGUnit
function SetCombatStimCharges(int charges)
{
m_iCombatStimCharges = charges;
}

simulated function int GetCombatStimCharges()
{
return m_iCombatStimCharges;
}

function UpdateItemCharges()
{
if(GetCharacter().HasAbility(43))
{
	SetCombatStimCharges(GetInventory().GetNumItems(77) * XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.3);
}
}

// XGUnitNativeBase - few lines to define the variable and replication
var int m_iCombatStimCharges;

// UITacticalHUD_AbilityContainer - help messages for no charges

// XGAbilityTree
function ApplyActionCost(XGAbility_Targeted kAbility)
{
if(kAbility.GetType() == 43)
{
	kAbility.m_kUnit.SetCombatStimCharges(kAbility.m_kUnit.GetCombatStimCharges() - 1);
}
}

// XGSoldierUI - for item card info
noexport function int GetItemCharges(XComGame.XGGameData.EItemType eItem, optional bool bForce1_for_NonGrenades, optional bool bForItemCardDisplay)
{
switch(eItem)
{	
	case 77:
	if(m_kSoldier.HasAbility(43))
	{
		return XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.3;
	}
}
}

 

Link to comment
Share on other sites

Drakous79: I see.

 

Well that may fix the description problem but i think you will run into the same problem i am having adding more ranks, you can increase them but the UI is static and you cant see them..

So you managed to add more ranks? Didn't think it was possible.

 

It's still worth doing if yes. So what if you can't add more abilities, at least you won't have to take anyone reaching colonel off the team to let others grow.

Link to comment
Share on other sites

yes i managed to add more ranks, well 1 by increasing the column number to 8 in several locations, but it did not show up in UI you arrow down out of window and can not see it. So, i backed up and punted. My final solution was to rework the trees and make it possible to get both perks per level..I also tried making a rank point system but was unable to make the counter visible do to not being able to add bytecode for a counter and the damn UI. damn locked up textures for the meshes pisses me of. I hope to get the mod out in the next couple of days, been working on finishing touches and documentation. Edited by tsanford01
Link to comment
Share on other sites

Well, I personally don't care much about the extra perk. It's worth doing just for the stat gains and flavor.

How do you specify its name, for instance - just add it to xcomgame.int and it works, or some other way?

What icon is displayed for that rank, or is there no icon?

Do soldiers actually progress to that rank automatically, gain stats on promotion, if yes are these stats specified in the ini or fixed in the upk mod?

Link to comment
Share on other sites

once i figured out you wouldn't be able to see the ranks i stopped, but yes you just add an 8th column and an 8th entry in the xcomegame.int to name it. the name will appear. To make it usable for tactical purposes you would need to add a perk to it. I did not assign an icon to it i stopped as not useful but i would be think you could progress there. Edited by tsanford01
Link to comment
Share on other sites

  • Recently Browsing   0 members

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