Jump to content

R&D Inventory, Items & Weapons Overhaul


anUser

Recommended Posts

I've got a whole slew of new items in the game. Many of them are not functioning correctly yet (some are), and the lack of graphics is going to be a problem, but it's a step forward.


Here is a screenshot showing some of the new items in the Engineering Build menu:

http://wiki.tesnexus.com/images/3/3d/Added_Items.jpg

 

The complete list I'm working to right now (these can be pretty easily changed if desired):

 

new soldier items:

 

m_aItemNames[eItem_PlaceholderGrenade0]="(NEW) Ceramic Plating"
m_aItemNames[eItem_PlaceholderGrenade1]="(NEW) Basic First Aid Kit"
m_aItemNames[eItem_PlaceholderWeapon7]="(NEW) Personal Effects"
m_aItemNames[eItem_PlaceholderIntWeapon1]="(NEW) Laser Sight"
m_aItemNames[eItem_PlaceholderWeapon0]="(NEW) Alloy Assault Rifle"
m_aItemNames[eItem_PlaceholderWeapon1]="(NEW) Alloy Shotgun"
m_aItemNames[eItem_PlaceholderWeapon2]="(NEW) Alloy LMG"
m_aItemNames[eItem_PlaceholderWeapon3]="(NEW) Alloy Sniper Rifle"
m_aItemNames[eItem_SectopodArm]="(NEW) Rocket"
m_aItemNames[eItem_FlashBang]="Flash Grenade"
new SHIV items:
m_aItemNames[eItem_FloaterGrenade]="(NEW) High Energy Ammo"
m_aItemNames[eItem_CyberdiscGrenade]="(NEW) Grenade Launcher"
m_aItemNames[eItem_ThinManGrenade]="(NEW) Elerium Supercharger"
m_aItemNames[eItem_MutonGrenade]="(NEW) Alloy Ammo Feeds"
m_aItemNames[eItem_SectoidGrenade]="(NEW) HoloTargeter"
m_aItemNames[eItem_PlaceholderWeapon4]="(NEW) Energy Damper"
m_aItemNames[eItem_PlaceholderWeapon5]="(NEW) Ghost Module"
m_aItemNames[eItem_PlaceholderWeapon6]="(NEW) Core Armoring"
m_aItemNames[eItem_PlaceholderVehicle0]="(NEW) Ablative Armor"
m_aItemNames[eItem_PlaceholderVehicle1]="(NEW) Multi-barrel Weapon"
m_aItemNames[eItem_PlaceholderShivUpgrade0]="(NEW) HEAT Ammo"
m_aItemNames[eItem_PlaceholderShivUpgrade1]="(NEW) High Energy Rounds"
m_aItemNames[eItem_PlaceholderArmor0]="(NEW) Reinforced Armor"
I haven't messed with the descriptive text yet.
Link to comment
Share on other sites

  • Replies 129
  • Created
  • Last Reply

Top Posters In This Topic

Very nice, I like how this looks. btw, which is the file to change the display names?

 

Regarding that alloy weapon set, have you tested if they have working models or have you found a way to set the mesh and display of an item? I'd like to confirm those alien grenades don't have a mesh before using them as mere tokens in the inventory, although there are many many technical difficulties to implement them as consumable items. But the same is true for all this suggestive names. Specially thinking of alien plasma weapons. Maybe the aliens don't use them (it seems to me it's been proved the weapons the aliens use have the same stats we set for xcom plasma wepaons in the ini, so all the other stats are ignored), but if they had a working model just like the any plasma weapon then I thought of making several lower class versions of plasma weapon to use for xcom soldiers, and make it so they can be upgraded through investigation or other means

 

I've got a request for more items:

- arc thrower "battery", grants 1 more use

- Plasma rocket, to be used with the Blaster Launcher

- Grapple, I'm trying to implement it in the pistol slot, it could be an item

- Ammo items for ballistic weapons, I want to give it a try, but I don't have a clear plan for implementing it any soon

 

And also I'd love if some of the SHIV modules were equippable by soldiers as well, like the grenade launcher module, I think it could take the pistol slot (to compensate for the extra capability) and display no model. That's all configurable in the ini

Link to comment
Share on other sites

So, apparently once the Slingshot DLC is installed you have to update the Localization files in two locations:

 

My Games/... /Localization/INT

and

the regular place in the Steam XCOM install directory.

 

The version in My Games is rewritten every time the game is launched, but not making the changes there somehow prevents the localization values from being read.

 

Full credit to johnnylump for telling me this.

 

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

 

Alloy set-

All I've done so far is make the items buildable. In the Barracks display they are equippable, and display stats, but no item mesh is displayed (the same as for the Sentry gun). I haven't tested them in a tactical mission yet. Hopefully I can figure out how to assign a mesh, and get both these and the Sentry gun glitch free.

 

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

 

Grenades-

The Psi Grenade and Flashbang Grenade I have left untouched. If they can be mapped to an ability icon, then there are two additional grenades. My guess is that they are more likely to be made workable then the alien grenades.

 

When looking through the upk's with Gildor's umodel, I saw no meshes for additional grenades. There is a mesh for a motion detector and a flamethrower. Possible I missed them, though :smile:

 

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

 

It's certainly possible to make a grenade launcher work for soldiers. All I'm going to do is make it grant the Bombadier perk, so that grenade range = sight range. Animation-wise it probably makes more sense to give access to the Bombadier perk in the tree, since the soldier will still be using the throwing animation.

 

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

 

Grapple -- in terms of "loadout" slot on the model, Grapple is equipped to the left forearm slot -- the same place that Sectoids equip their plasma pistols. It might be possible to put it in the pistol slot, but some care to re-map it to the left forearm would make the graphics look more consistent.

 

If you check out XGLoadoutManager.ConvertTInventoryToSoldierLoadout, you'll see

 

 

if(XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.ArmorHasProperty(kInventory.iArmor, 2))

{
Loadout.Items[4] = class'XGWeapon_Grapple';
}

 

which is how the Grapple item is mapped to the correct mesh loadout slot currently.

 

You'd probably want to change it to something like the PsiAmp conditional a bit further down in the same function:

 

 

if(XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.CharacterIsPsionic(kChar) || (XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.ArmorHasProperty(kInventory.iArmor, 3)) && (XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.TInventoryCustomItemsFind(kInventory, 35) == -1))

{
XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.TInventoryCustomItemsAddItem(kInventory, 35);
}

which checks to see if the Armor is Psionic, OR the character is psionic, OR if the character has a PsiAmp in the CustomItems Inventory.

 

I did add Grapple, Psi Grenade, and Flashbang. I didn't really consider those three "new" items since they have defined enum values that I'm not going to take over.

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

 

Extra items -- my current BuildItems function hex has 106 free bytes. Each new item built is 24 additional bytes. Some of these bytes I plan on using to define perk-to-item mapping (so that equipping the item gives automatic access to the perk). Each perk assigned to a weapon will consume one of the free bytes. It is possible to squeeze some additional bytes out of the calls that use 0 or 1 prerequisites (1 or 2 freed bytes). Otherwise it's reaching the limit of what can be fit into the BuildItems function.

 

At that point it's probably better to cannibalize some of the items that I added that you don't plan on using.

 

Also, the build menu is getting pretty crowded and difficult to navigate. Their scrollbar implementation doesn't seem to be very smooth with that many items for some reason.

 

I'm going to try to move all of the SHIV items over to the 3rd "vehicles" tab, but haven't confirmed that I can make it work (and still have them be equippable).

Link to comment
Share on other sites

I hit a bit of a snag in my quest to add more items.

 

I have all of the items in and buildable in the strategy game.

 

Laser Sight adds +5 aim

Ceramic Plating adds +1 HP

Personal Effects adds +10 Will

 

However, they don't work in the TACTICAL game. Credit due to johnnylump for pointing out to me a big listing of default values in XGItemLibrary. Apparently only items with entries in this array can "work" in the tactical game. None of the initial test items had entries in this array.

 

To test this I added +1 HP to a Psi Grenade (which IS in the list), made it into a packback item, equipped two of them, and it worked like a charm.

 

The full list is :

 

 

 

m_arrItems(0)=none
m_arrItems(1)=none
m_arrItems(2)=class'XGWeapon_Pistol'
m_arrItems(3)=class'XGWeapon_AssaultRifle'
m_arrItems(4)=class'XGWeapon_Shotgun'
m_arrItems(5)=class'XGWeapon_Minigun'
m_arrItems(6)=class'XGWeapon_SniperRifle'
m_arrItems(7)=class'XGWeapon_RocketLauncher'
m_arrItems(8)=class'XGWeapon_LaserPistol'
m_arrItems(9)=class'XGWeapon_LaserAssaultRifle'
m_arrItems(10)=class'XGWeapon_LaserAssaultGun'
m_arrItems(11)=class'XGWeapon_HeavyLaser'
m_arrItems(12)=class'XGWeapon_LaserSniperRifle'
m_arrItems(13)=class'XGWeapon_PlasmaPistol'
m_arrItems(14)=class'XGWeapon_PlasmaLightRifle'
m_arrItems(15)=class'XGWeapon_PlasmaAssaultRifle'
m_arrItems(16)=class'XGWeapon_AlloyCannon'
m_arrItems(17)=class'XGWeapon_HeavyPlasma'
m_arrItems(18)=class'XGWeapon_PlasmaSniperRifle'
m_arrItems(19)=class'XGWeapon_BlasterLauncher'
m_arrItems(20)=none
m_arrItems(21)=none
m_arrItems(22)=none
m_arrItems(23)=none
m_arrItems(24)=none
m_arrItems(25)=none
m_arrItems(26)=none
m_arrItems(27)=none
m_arrItems(28)=none
m_arrItems(29)=none
m_arrItems(30)=class'XGWeapon_SectopodArm'
m_arrItems(31)=class'XGWeapon_SectopodCannon'
m_arrItems(32)=none
m_arrItems(33)=class'XGWeapon_ChryssalidClaw'
m_arrItems(34)=class'XGWeapon_DroneBeam'
m_arrItems(35)=class'XGWeapon_PsiAmp'
m_arrItems(36)=class'XGWeapon_Grapple'
m_arrItems(37)=class'XGWeapon_Cyberdisc'
m_arrItems(38)=none
m_arrItems(39)=class'XGWeapon_PlasmaPistolSectoid'
m_arrItems(40)=class'XGWeapon_PlasmaLightRifle_ThinMan'
m_arrItems(41)=class'XGWeapon_PlasmaLightRifle_Floater'
m_arrItems(42)=class'XGWeapon_PlasmaLightRifle_Muton'
m_arrItems(43)=class'XGWeapon_PlasmaAssaultRifle_Muton'
m_arrItems(44)=class'XGWeapon_HeavyPlasma_Floater'
m_arrItems(45)=class'XGWeapon_HeavyPlasma_Muton'
m_arrItems(46)=none
m_arrItems(47)=class'XGWeapon_ZombieFist'
m_arrItems(48)=class'XGWeapon_EtherealWeapon'
m_arrItems(49)=class'XGWeapon_MutonBlade'
m_arrItems(50)=class'XGWeapon_OutsiderWeapon'
m_arrItems(51)=class'XGWeapon_SoldierNoWeapon'
m_arrItems(52)=class'XGWeapon_Plague'
m_arrItems(53)=class'XGWeapon_SectopodClusterBomb'
m_arrItems(54)=none
m_arrItems(55)=none
m_arrItems(56)=none
m_arrItems(57)=class'XGArmor_LevelIMedium'
m_arrItems(58)=class'XGArmor_LevelIIMedium'
m_arrItems(59)=class'XGArmor_LevelIILight'
m_arrItems(60)=class'XGArmor_LevelIIIMedium'
m_arrItems(61)=class'XGArmor_LevelIIIMediumAir'
m_arrItems(62)=class'XGArmor_LevelIIILight'
m_arrItems(63)=class'XGArmor_Psionic'
m_arrItems(64)=none
m_arrItems(65)=none
m_arrItems(66)=none
m_arrItems(67)=none
m_arrItems(68)=none
m_arrItems(69)=none
m_arrItems(70)=none
m_arrItems(71)=none
m_arrItems(72)=none
m_arrItems(73)=none
m_arrItems(74)=none
m_arrItems(75)=none
m_arrItems(76)=class'XGWeapon_Medikit'
m_arrItems(77)=class'XGWeapon_CombatStims'
m_arrItems(78)=class'XGWeapon_MindShield'
m_arrItems(79)=class'XGWeapon_ChitinPlating'
m_arrItems(80)=class'XGWeapon_ArcThrower'
m_arrItems(81)=class'XGWeapon_TargetingModule'
m_arrItems(82)=class'XGWeapon_ReinforcedArmor'
m_arrItems(83)=none
m_arrItems(84)=none
m_arrItems(85)=class'XGWeapon_FragGrenade'
m_arrItems(86)=class'XGWeapon_SmokeGrenade'
m_arrItems(87)=none
m_arrItems(88)=class'XGWeapon_AlienGrenade'
m_arrItems(89)=none
m_arrItems(90)=none
m_arrItems(91)=none
m_arrItems(92)=class'XGWeapon_SectoidGrenade'
m_arrItems(93)=class'XGWeapon_FloaterGrenade'
m_arrItems(94)=class'XGWeapon_MutonGrenade'
m_arrItems(95)=class'XGWeapon_CyberdiscGrenade'
m_arrItems(96)=class'XGWeapon_ThinManGrenade'
m_arrItems(97)=none
m_arrItems(98)=class'XGWeapon_PsiGrenade'
m_arrItems(99)=class'XGWeapon_BattleScanner'
m_arrItems(100)=none
m_arrItems(101)=none
m_arrItems(102)=none
m_arrItems(103)=none
m_arrItems(104)=none
m_arrItems(105)=none
m_arrItems(106)=none
m_arrItems(107)=none
m_arrItems(108)=none
m_arrItems(109)=none
m_arrItems(110)=none
m_arrItems(111)=none
m_arrItems(112)=none
m_arrItems(113)=class'XGWeapon_Shiv_Minigun'
m_arrItems(114)=class'XGWeapon_Shiv_Sentry'
m_arrItems(115)=class'XGWeapon_Shiv_Laser'
m_arrItems(116)=class'XGWeapon_Shiv_Plasma'
m_arrItems(117)=class'XGArmor_SHIV'
m_arrItems(118)=class'XGArmor_SHIV2'
m_arrItems(119)=class'XGArmor_SHIV3'
m_arrItems(120)=none
m_arrItems(121)=none
m_arrItems(122)=none
m_arrItems(123)=none
m_arrItems(124)=none
m_arrItems(125)=none
m_arrItems(126)=none
m_arrItems(127)=none
m_arrItems(128)=none
m_arrItems(129)=none
m_arrItems(130)=none
m_arrItems(131)=none
m_arrItems(132)=none
m_arrItems(133)=none
m_arrItems(134)=none
m_arrItems(135)=none
m_arrItems(136)=none
m_arrItems(137)=none
m_arrItems(138)=none
m_arrItems(139)=none
m_arrItems(140)=none
m_arrItems(141)=none
m_arrItems(142)=none
m_arrItems(143)=none
m_arrItems(144)=none
m_arrItems(145)=none
m_arrItems(146)=none
m_arrItems(147)=none
m_arrItems(148)=none
m_arrItems(149)=none
m_arrItems(150)=none
m_arrItems(151)=none
m_arrItems(152)=none
m_arrItems(153)=none
m_arrItems(154)=none
m_arrItems(155)=none
m_arrItems(156)=none
m_arrItems(157)=none
m_arrItems(158)=none
m_arrItems(159)=none
m_arrItems(160)=none
m_arrItems(161)=none
m_arrItems(162)=none
m_arrItems(163)=none
m_arrItems(164)=none
m_arrItems(165)=none
m_arrItems(166)=none
m_arrItems(167)=none
m_arrItems(168)=none
m_arrItems(169)=none
m_arrItems(170)=none
m_arrItems(171)=none
m_arrItems(172)=none
m_arrItems(173)=none
m_arrItems(174)=none
m_arrItems(175)=none
m_arrItems(176)=none
m_arrItems(177)=none
m_arrItems(178)=none
m_arrItems(179)=none
m_arrItems(180)=none
m_arrItems(181)=none
m_arrItems(182)=none
m_arrItems(183)=none
m_arrItems(184)=none
m_arrItems(185)=none
m_arrItems(186)=none
m_arrItems(187)=none
m_arrItems(188)=none
m_arrItems(189)=none
m_arrItems(190)=none
m_arrItems(191)=none
m_arrItems(192)=none
m_arrItems(193)=class'XGWeapon_SectopodChestCannon'

 

 

 

This means that (as it stands) none of the placeholdier EItem placeholder values or Item Categories values can be used.

 

Unused entries from the list seem to be only:

m_arrItems(92)=class'XGWeapon_SectoidGrenade'
m_arrItems(93)=class'XGWeapon_FloaterGrenade'
m_arrItems(94)=class'XGWeapon_MutonGrenade'
m_arrItems(95)=class'XGWeapon_CyberdiscGrenade'
m_arrItems(96)=class'XGWeapon_ThinManGrenade'
m_arrItems(98)=class'XGWeapon_PsiGrenade'

 

This will severely limit the number of new items that can be added (and used in the tactical game) unless some workaround is found.

Link to comment
Share on other sites

As always it's bad to have another limitation but it's good to know how it works, good point guys.

While this limits the number of items that need ini stats in the tactical game, that's not all the new items there could be. Rockets for example, they only need to have price, time and min engis (strategic game) and be present in the inventory so it can be checked if the unit's got them equipped and so they can be removed. And many other items that may grant a perk or just increase the charges of abilities won't need ini settings on tactical game... maybe on that regard if we are short on ini-sensitive items we could re-use standard items such battlescanners that actually don't need to read ini settings during the tactical game, and place them onto other items.

Link to comment
Share on other sites

Unfortunately, it's not just the ini stats.

 

The XGItemLibrary and the functionality in XGLoadoutManager is how every item gets translated from the transfer soldier's TInventory into the XGInventory, which is how the item is accessed.

 

If the item isn't in the XGItemLibrary, it won't even make it into the soldier's backback, so any check to see if the soldier has the item will fail.

 

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

 

On a side note, I've discovered that this is how the meshes/animations get assigned to objects. While playing around I forced the ItemLibrary to return 03 (AssaultRifle) for every item, and the soldiers in the barracks view were suddenly festooned with 5 or 6 Assault Rifles attached in unlikely places.

 

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

 

I'm working on a way to try and "trick" the code into loading a class, but assigning its m_eType (the item ID) to a different value AFTER a copy of the class has been spawned.

 

I already (apparently) melted JL's brain in a PM, so to limit the damage I won't post all of the gory details here yet ^_^

Link to comment
Share on other sites

Well, all of my attempts to workaround this issue have failed. I think I'll have to concede ... the funky item code has defeated me.

 

Workarounds I tried:

1) Deferring the assignment of a class-type to a loadout slot until the Loadout was applied, then after the new weapon-class was spawned assigning a new itemID to it (this was tricky because the m_eType is a protected variable).

 

FAILED. Somehow the item ID was very 'sticky' -- I can only surmise that the XGWeapon.Init function (which is implemented in native code) is somehow overwriting what I'm trying to do.

 

2) In XGUnit.ApplyInventoryStatModifiers, I changed:

 

kInventory.GetRearBackPackItemArray(arrBackPackItems);

 

to:

 

XComGameReplicationInfo(class'Engine'.static.GetCurrentWorldInfo().GRI).m_kGameCore.GetBackpackItemArray(m_kCharacter.m_kChar.kInventory, arrBackPackItems);

 

The second function uses the unit's TInventory structure instead of the XGInventory. The TInventory method is how the strategy game gets the information. This also failed.

 

I actually managed to build that second function (it's crazy), the game ran without crashing, but backpack inventory items still failed to apply any stats.

 

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

 

One funky issue that I still don't completely understand is that the base Item class (on which everything in XGInventory is based on), has TWO different functions for retrieving item IDs:

 

// Export UXGItem::execGameplayType(FFrame&, void* const)

native static simulated function XGGameData.EItemType GameplayType();

 

and

 

static simulated function XGGameData.EItemType ItemType()

{
return default.m_eType;
//return ReturnValue;
}

 

both return EItemType enums, and both are frequently used in the game code.

 

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

 

I was able to get stat adjustments to work when I assigned them the eItem_PsiGrenade. However, they did NOT work with the other alien grenades (which also have a class defined) unless I changed the retrieved type in XGInventory.GetRearBackpackArray from:

 

 

 

arrBackPackItemsReturned.AddItem(kItem.GameplayType());

 

to:

 

arrPackPackItemsReturned.AddItem(kItem.ItemType());

 

------------------------------------------------
So, where does this stand right now?
I can only get stats to assign properly, and get items added to the XGInventory Backpack with correct itemIDs with the following six items:

m_arrItems(92)=class'XGWeapon_SectoidGrenade'
m_arrItems(93)=class'XGWeapon_FloaterGrenade'
m_arrItems(94)=class'XGWeapon_MutonGrenade'
m_arrItems(95)=class'XGWeapon_CyberdiscGrenade'
m_arrItems(96)=class'XGWeapon_ThinManGrenade'
m_arrItems(98)=class'XGWeapon_PsiGrenade'

This allows stats to be granted in the tactical game, and is present to be counted for any other tactical-game test as well.
-----
Many other items can be added in the strategy game (around 18 to 20), but since they are based on item IDs that do not have a corresponding class in the XGItemLibrary, they will not be transferred correctly in the unit's XGInventory, will not apply stats, and will not pass a HasItemOfType test, and will not be counted using a GetNumItems function call.
However, they can be used in the strategy game to grant effects to the XGStrategySoldier that will carry over regardless of any other effects in the tactical code itself.
This can be used to:
1) Assign perks to units, since the perk information is transferred separately
2) Give charges to units, if the charge information is carried via the perk array
Link to comment
Share on other sites

Here is where my progress stands:

 

1) Added 3 new "stat" items to the game, designed to be additional options in the early game

Ceramic Plating : +1 HP

Laser Sight : +5 Aim

Alien Trophies : +10 Will

 

2) Added a First Aid Kit

Functions as a Medikit, but only heals half as much HP. Can Stabilize soldiers.

 

3) Added capability to configure any item to grants perks.

Will not conflict with perks from perk tree (as long as are using my Enhanced Perk Tree mod).

It will conflict with the vanilla perk tree (e.g. A soldier with an equipped Smoke Grenade will be unable to select a perk from a column that includes the Smoke Grenade perk)

 

4) Added Smoke Grenades and Battlescanner as equippable items. These will properly stack with charges granted by related perks.

Smoke and Mirrors double charges from both Smoke Grenade perk and equipped Smoke Grenades.

Battlescanner perk grants two charges of Battlescanner. Each equipped Battlescanner grants 1 charge.

 

5) Removed Claim system

This is now compatible with consumable items. Items removed from inventory in the tactical game will not be added back into Storage when soldiers return. Items that grant perks and are consumable need to have the perk array reduced when the item is removed from inventory (important for Smoke Grenades, Battlescanners and First Aid Kits).

 

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

 

It's not yet quite in a complete state. Item Cards are pretty broken, and SHIV Loadout 1.0 will lose an extra SHIV weapon if a SHIV goes MIA.

 

I'll start posting some info up on the wiki shortly.

Edited by Amineri
Link to comment
Share on other sites

ok so that's why I couldn't get smoke grenades, battle scanners or extra rockets... only those 6 items are allowed with ini stats?

 

I like this idea of items granting perks that grant extra charges. What sort of mechanism have you thought about for this? On(Un)Equip grants/removes perk, and UpdateItemCharges sets charges according to number of times each perk is present? I'm just thinking of making this compatible with vanilla perk trees, given that item-related perks don't appear at all as selectable perks. I guess ApplyActionCost would need a rework as well to remove perks as they're used.

 

Speaking of which, I tried the code I posted in the previous page but it didn't remove the item from inventory. Unless something's wrong there and I'm attempting to remove an item that it isn't the right one or I've mistaken somewhere else, or just setting an inventory item to 0 doesn't work as I expected. I'd appreciate if someone could take a look at that code, or if someone found a way to call that TInventorySmallItemsRemoveItem function from there, that seemed to work.

Link to comment
Share on other sites

My apologies... I wasn't including the Smoke Grenade and Battlescanner in that previous list of six. There are defined weapon classes for Smoke Grenades and Battlescanners, so they can be added in just fine.

 

In XGItemLibrary, m_arrItems.default has :

m_arrItems(86)=class'XGWeapon_SmokeGrenade'
m_arrItems(99)=class'XGWeapon_BattleScanner'

 

However, items such as FlashBangs have no XGWeapon_<type> class, so won't work in the same way.

 

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

 

To remove the claim system I mostly just modified XGStorage.

 

Changed ClaimItem to :

 

function bool ClaimItem(int iItemType, XGStrategySoldier kSoldier)
{
// End:0x1A
if(IsInfinite(byte(iItemType)))
{
return true;
}
m_arrItems[194] = iItemType | (1 << 16);
RemoveLoadout(kSoldier);
m_arrItems[iItemType] -= 1;
return true;
}

 

Changed ReleaseItem to:

function bool ReleaseItem(int iItemType, XGStrategySoldier kSoldier)
{
// End:0x1A
if(IsInfinite(byte(iItemType)))
{
return true;
}
m_arrItems[194] = iItemType;
RemoveLoadout(kSoldier);
m_arrItems[iItemType] += 1;
return true;
}

 

 

Just the m_arrItems[iItemType] change is sufficient to break the claiming system. Instead of incrementing or decrementing a claim array, the item is simply removed or added into storage.

 

With this change, the RemoveLoadout function is no longer needed (to cause equipped items to "disappear" simply delete the soldier and don't release the items back into storage).

 

So, I rebuilt RemoveLoadout as a helper function to set perks as a side effect. Unfortunately I needed both the ItemID and the XGStrategySoldier. So I piggypacked the ItemID into the m_arrItems[194] slots.

 

I set bit 16 to 1 if the item is being claimed (and hence perk should be ADDED).

 

The rebuilt RemoveLoadout function:

function RemoveLoadout(XGStrategySoldier kSoldier)
{
local TInventory kTempInv;
local int I;

iNumCaptives = ITEMTREE().GetItem(m_arrItems[194] & 255).iStructureReq;
// End:0xF6
if(iNumCaptives > 0)
{
// End:0xB7
if((m_arrItems[194] & (1 << 16)) > 0)
{
kSoldier.m_kChar.aUpgrades[iNumCaptives] += 2;
}
// End:0xF6
else
{
kSoldier.m_kChar.aUpgrades[iNumCaptives] -= 2;
}
}
m_arrItems[194] = 0;
return;
}

 

What it does is add 2 to the perk array (aUpgrades) if the item has a non-zero value stored in iStructureReq. iStructureReq is an extra unused field.

 

To configure an item to add a perk when equipped, all that has to happen is setting iStructureReq = PerkID in the item.

 

The perk tree mod only sets (and checks) bit 0 of the aUpgrades element to identify whether a perk has been truly selected.

 

This can also be used in XGUnit.UpdateItemCharges to distinguish between the perk available due to item and perk available due to perk tree.

 

For example, I've got my game configured to grant two additional charges for the Battlescanner perk, but each Battlescanner item only grants 1 additional charge.

 

The BuildAbilities code only checks whether the aUpgrades element > 0, so either case is sufficent to make the Ability available.

 

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

 

If you never assign the abilities that grant charges, there will be no conflict with the vanilla tree. I just figured it's just as simple to add my perk tree mod, because you can rebuild the exact same vanilla trees if you want. It supports up to 3 perks per rank, but you can build the normal old 1-2-2-2-2-1-2 configuration if you want.

 

Part of my motivation in building the perk tree was to allow for this mixing of perks and items.

 

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

 

To make a Rocket item that grants extra charges, you'd build a new item, change the localization file to call it a rocket, set an image, and make it grant the a perk (say the Rocketer perk).

 

Then, in XGUnit.UpdateItemCharges, simply extract the number of items equipped with a shift left 1 operation:

 

m_kCharacter.m_kChar.aUpgrades[93] >> 1

 

You'd set the total number of charges with something like:

 

SetRockets(1); // default number of rocket charges -- could be omitted if you want zero default Rocket Charges

 

m_iNumRockets += m_kCharacter.m_kChar.aUpgrades[93] >> 1; // add number of Rocket Items equipped

 

 

if((m_kCharacter.m_kChar.aUpgrades[93] & 1) > 0) // explicitly check bit 0 for "real" Rocketeer perk

{

m_iNumRockets += 2;

}

 

This is how you can set a different number of charges for a perk than for the number of items equipped, which can help balance out the value of the perk.

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...