Jump to content

Altering Perks to work with weapons(EW).


naqel

Recommended Posts

Question 1: Is there a way to make weapons grant specific perks while they are used(kinda like a weapon can have the Suppression ability built in)?

 

Question 2: Above failing short, how would one go about making weapon specific Perks work with all weapons?

 

 

I know at least the second part should be possible, but can't find anything on how to make it work with Enemy Within.

Link to comment
Share on other sites

1. Yes Merciless did it. At least the beta build did it along with making all classes use any weapons so it is possible at least in theory. I know other mods like long war have created perks so, all you need to do is create the effect you want. Like "This weapon gives you +10 aim" and attach it to the weapon. So if you need to look at code just look at the light plasma rifle and try to emulate that for something else. If you want to see it perks added to weapons look at merciless

Link to comment
Share on other sites

I added the capability to have a weapon grant a single perk as a side-effect of equipping said weapon. Keep in mind that from a technical perspective (which is what matters here) in XCom there are only armors and weapons. Armors are only the items that go in the the armor slot (e.g. Kevlar, Ghost Armor).

 

Every other item in the game that can go on a soldier is classified as a "Weapon". This includes things such as Nanofiber Vest and Medikits which intuitively one would not categorize as weapons.

 

I originally developed the capability in order to make the Battlescanner and Smoke Grenade work as an equippable item. These abilities (in EU at least) were only triggered by having the perk, which required the capability to grant the perk as a side effect of equipping the item.

 

Merciless later extended this use in order to grant "Large Item" weapon perks, and Long War uses it extensively to make the Small Item modules for the SHIV Customization.

 

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

 

Unfortunately this was a small effect added as a part of a larger item overhaul, including adding a host of new items. The set of changes never really gelled into a single installable mod, but it was used at least in Merciless and Long War in various ways. The original thread is : http://forums.nexusmods.com/index.php?/topic/967933-r-d-inventory-items-weapons-overhaul/

 

and what info I did get up onto the wiki is :

 

http://wiki.tesnexus.com/index.php/Additional_Items_Mod_XCOM:EU_-_2012

Edited by Amineri
Link to comment
Share on other sites

I remember this one, too bad I implemented this in last huge update of my mod, which was kinda broken (crash at launch of tactical mission), and I even don't know was it success or not. And link to wiki is broken, fixed: http://wiki.tesnexus.com/index.php/Additional_Items_Mod_XCOM:EU_-_2012

 

It is shame that article on wiki is still unupdated. Btw, any plans for updating that mod for EW? I would like to give MEC weapons some unigue perks, to make them more different and versatile, and not just straight upgrade; also is it even possible to grant several perks with single item?

Edited by Tycus
Link to comment
Share on other sites

...

It is shame that article on wiki is still unupdated.

It (the article, not the mod) has been updated, except has not had any of the available new items from EW added because no one has listed them. (And as I do not have EW, I can't identify them myself.) But a list of items is not any reason you couldn't use the information to tweak your own.

 

If you find any information incorrect or missing, please let me know. Because individual games are modded differently and experiences vary, I prefer to have two confirmations of a problem before making changes, just to reduce the confusion level.

 

-Dubious-

Edited by dubiousintent
Link to comment
Share on other sites

I'll likely be updating it. The SHIV small items stuff will need it, although I'm not sure if the smoke/battlescanner does, as it looks like that perks are now configurable to grant items -- and I think smoke and battlescanners are set up that way now.

 

As I recall I stored the perk in the unused TItem.iStructureReq field.

 

Now that I know how to change variables into static array variables, I can likely turn iStructureReq into iStructureReq[16] or so, enabling the storing of multiple perks per item. The other issue to resolve would be setting the perks for each item -- in the prior implementation I hacked it into the XGItemTree.BuildItems call.

Link to comment
Share on other sites

@Dubious
What I was referring to is "Individual Item Changes" section, which has no info (even for previous version of XCOM:EU, not like it matters now). Basically it was required to disable specific exclusion preventing making Smoke Grenade an item - outdated code:

XComStrategyGame.upk >> XGFacility_Lockers.GetLockerItems

The surrounding hex code is: (this is unique)
16 25 16 07 7E 03 9A 00 06 2D 00 00 2C 56 16 06 6F 04 07 AF 03
change to: (also unique)
16 25 16 07 7E 03 9A 00 06 2D 00 00 2C C3 16 06 6F 04 07 AF 03

Battlescanners don't seem to have similar exclusion, and I really don't know about other two items.

 

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

 

 

<..>
Now that I know how to change variables into static array variables, I can likely turn iStructureReq into iStructureReq[16] or so, enabling the storing of multiple perks per item. The other issue to resolve would be setting the perks for each item -- in the prior implementation I hacked it into the XGItemTree.BuildItems call.

Exactly how many perks can be granted via this new method? (3 should be enough, I think). Good luck on resolving second issue, though. Btw, about smokes and battlescanners: it is perks granting items, not other way around (there is no "Smoke Grenade" or "Battlescanner" perks in perk trees in my mod; anyway, I should wait for updated Extended Perk Trees mod before I really need worry about that :tongue:).

Edited by Tycus
Link to comment
Share on other sites

@Dubious

What I was referring to is "Individual Item Changes" section, which has no info (even for previous version of XCOM:EU, not like it matters now). Basically it was required to disable specific exclusion preventing making Smoke Grenade an item - outdated code:

XComStrategyGame.upk >> XGFacility_Lockers.GetLockerItems

 

The surrounding hex code is: (this is unique)

16 25 16 07 7E 03 9A 00 06 2D 00 00 2C 56 16 06 6F 04 07 AF 03

change to: (also unique)

16 25 16 07 7E 03 9A 00 06 2D 00 00 2C C3 16 06 6F 04 07 AF 03

Battlescanners don't seem to have similar exclusion, and I really don't know about other two items.

 

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

 

If I'm reading everything correctly, that exclusion still exists. Looking at XGGameData.EItemType, line 85 = eItem_SmokeGrenade and since the struct starts on line 3 with eItem_NONE, EItemType[82] == eItem_SmokeGrenades. XGFacility_Lockers.GetLockerItems still has:

if(iItem == 82)
{
} 

So that's still present. I suspect that simply changing the hex string:

From: 00-00-16-25-16-07-3d-04-9a-00-52-38-00-00-2C-52
To:   00-00-16-25-16-07-3d-04-9a-00-52-38-00-00-2C-E2

Rewrites that condition to look for eItem_MAX as Ameniri suggests. This lets you build and allocate the items in the locker view, but doesn't grant you their 'charges' or 'perks' if you don't already have them. I'll work on that next.

 

Edit: Looks like XComGame:XGUnit.UpdateItemCharges will need to be fairly heavily edited to grant the perks for the items. Trying that now.

Edited by IceRaptor
Link to comment
Share on other sites

  • Recently Browsing   0 members

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