A Workaround How To Give Maps, Armor or Weapons Through Dialogue
WIP
This information is from Boron & Lucius.
The item given is conjured from nothing, does not need to be in the NPC’s possession.
How to give maps, weapons or armor via dialogue
This is based on the fact, that through dialogue an object is given using its StringID. The game only checks if an item is ‘givable’ when the modder adds the item on the dialogue using the give item drop down. The list is populated by object type, defined in the fcs.def file (in Kenshi installation folder). Although the fcs.def allows only one object type listed there, one can change that any time as long as they restart the FCS each time they want to change object types.
Thus, it is possible for one single NPC, in one dialogue give multiple different types of objects. Each item just has to be set on a different dialogue line. And one must take care to not accidentally change the item once the fcs.def is changed for a different type (or you would have to do the change again).
- Set up your NPC and their dialogue normally. Set a separate line of dialogue for each item.
- When you are ready to add the item, open its file and see what object type it is.
- Save and close fcs entirely.
- Click open fcs.def (you need either Visual Studio Community or Notepad++)
- Edit line 875; give item (in yellow below) Replace the word ITEM (in blue below) with the object type you want, all caps with underlines if any. Do not change the boolean (1).
- Save the fcs.def and open FCS again.
- Add the desired object to the dialogue line normally using the give item feature. The drop down menu is now populated with your chosen object type.
- Repeat steps 5 to 7 for each item type you want to give to the player. It may be this NPC only gives armor, if then you do not need another change.
- Do not forget to change the fcs.def line 875 back to ITEM after you finish.
Weapons
Weapons are a bit trickier, as they are divided into Manufacturer groups. Meaning you can only put the WEAPON_MANUFACTURER on the fcs.def file, and doing so your give item list will only be populated with weapon manufacturers. But that is the ONLY WAY to get textured weapons, because the texture is attached to the manufacturer of the weapon. So if you put WEAPON on the line 875, you would get the mesh reference, and not a weapon with stats and a texture. It will also crash the game. HOWEVER this means you cannot pick one special weapon to be given UNLESS you make a special manufacturer with only that one weapon in the list.
What Object Types are compatible?
Any item that can be put inside the player inventory. I would assume buildables will probably crash the game.
If you find it under the Item category in FCS, it should work, excluding naturally the material files and such sub files. Containers below refer to bags.
ITEM, MAP_ITEM, ARMOR, CONTAINER, WEAPON_MANUFACTURER, CROSSBOW, NEST_ITEM, CHARACTER_PHYSICS_ATTACHMENT, LIMB_REPLACEMENT
And YES the same trick also applies to target has item on the line 886. But the item may not be equipped when the NPC does the testing.
Note we have not tested all these, so please comment below if you crash or something. Rumor has it one can also give RESEARCH. These works also as special items, but alas RESEARCH crashes the game as special items.
Speaking of, yes this method works as both research cost and material cost in machines. In theory, I did not test if they make the game crash.
Lucius also has this info https://steamcommunity.com/workshop/filedetails/discussion/2909495250/3887227031502321150/
“[Note that changing item type like this, given] crossbows and prosthetic limbs are level 0 and are displayed as prototype grade.
Armor is also level 0, but is treated as level 100, so it will have a performance level higher than the masterwork level 95. (The grade is not displayed, but the price and weight follow the inventory settings.)“
See also A Workaround How to Make Weapons Lootable by NPCs
List of FCS.def file lines where you can use this workaround
Always remember to change it back after, so you do not forget you changed it later when you wonder why you do not get items for your inventory.
Show table
| Description | Line | Original Type | Tested? | Notes |
|---|---|---|---|---|
| NPC shopping list | 595 | ITEM | PARTIALLY | Not all types tested |
| Dialogue: NPC give item to player | 875 | ITEM | YES | Target must have enough inventory space. |
| Dialogue condition: target has item | 886 | ITEM | PARTIALLY | Must not be equipped, not all types tested |
| Character: inventory | 592 | ITEM | YES | Character must have enough inventory space. |
| Race: special food | 1500 | ITEM | NO | We have no idea what would happen if a character ate a prosthetic limb XD I would assume it would not be eaten when equipped. |
| Race: severed limbs | 1498 | ITEM | NO | Would be funny to drop armor, but there is a crash risk with rigged items and physics. Do test and report back. |
| Research: cost | 1587 | ITEM | YES | Note: studying an object will consume it |
| Research: enable item | 1593 | ITEM | NO | All object types already have their own research unlock |
| Character: death items | 94 | ITEM | NO | |
| Building: construction cost | 413 | ITEM | NO | |
| Building func: consumes | 516 | ITEM | PARTIALLY | Should work regardless |
| Building func: item crafts | 518 | ITEM | NO | Most items already have their own category. |
| Building func: produces | 519 | ITEM | NO | Do note there already is a separate type for prosthetics, armor and weapon crafts. |
| Building func: special tool | 521 | ITEM | NO | See Special Tools. Must be a non-rigged mesh object. Cannot use meshless items. I would venture this is one of the lines you actually cannot use any other object type. |