Jump to content

Looking fo Item/Repair Tutorial.


Kiwinut

Recommended Posts

Hello,
I'm making a couple of rebalance changes to effect the mid and late game, and one of the things we've often noticed is that item repair is very cheap and even low loot abundance can lead to stockpiling items and regular trips to the trader.

One of the proposed changes we are going to try is quite harsh, but we want to remove the ability to repair Quality 1 items, and make repairing an item reduce its quality level by one. I thought I could inject this when the item is added to the Repair Queue in the inventory, but it wasn't obvious where to put the change.
FWIW I'd want to add a Q1 check to prevent repair, and then actually reduce the quality when the repair completes.
I noticed that it also looks possible to add maybe Q7 and Q8 loot options if this repair policy becomes too harsh.

However, I'm still quite new to this and don't really know what I'm doing. I don't want to hook into the XUiC_ side as that felt like the wrong approach and I thought there should be a way to find it from the Inventory and ItemStack side of things.

Anybody got experience with the Items system?

Link to comment
Share on other sites

OK, as a follow up, this is done through the XUIC class by the look of it.

XUIC_RecipeStack::OutputValue for the curious.

 

Quality values are 1 indexed, with Quality zero items having zero durability but otherwise having Q1 stats and still functioning.

So decrementing the quality of an item when the repair completes is pretty easy.

Preventing Q1 items from being repaired has to happen when items are added to this stack, but that shouldn't be too hard either.

 

Link to comment
Share on other sites

15 hours ago, Kiwinut said:

OK, as a follow up, this is done through the XUIC class by the look of it.

XUIC_RecipeStack::OutputValue for the curious.

 

Quality values are 1 indexed, with Quality zero items having zero durability but otherwise having Q1 stats and still functioning.

So decrementing the quality of an item when the repair completes is pretty easy.

Preventing Q1 items from being repaired has to happen when items are added to this stack, but that shouldn't be too hard either.

 

What happens when the quality decrease would remove a mod slot that is already filled?

 

 

Link to comment
Share on other sites

9 minutes ago, meganoth said:

What happens when the quality decrease would remove a mod slot that is already filled?

 

 

Hi, I don't know yet. I didn't have a save with any stuff. 

I'll find the cheats and try it out. 

I'm going go guess bad things will happen, and that's a good point.
If the mods array is truncated, the mod will be lost.
If not it'll still be present on the weapon, but since the UI slot won't show you won't be able to remove it.
I guess I should find a way to remove the mod and add it to your inventory.


Thanks for asking - while we would have found that while playing, far better to fix it before it breaks.

I also prevented Q1 items being added to the repair queue, which is the wrong place to do it because it reports "queue full", but it has the right effect so I'm going to roll with that as a shippable workaround until I find a proper fix.

 

Link to comment
Share on other sites

I moved everything to the same Prefix method so it's an atomic process, and popped the mods off as the slots reduced.

All working! Thanks for the thoughts, @meganoth


Items now drop a quality level each time you repair them, and Q1 cannot be repaired. This will make specialisation more important, stimulate the economy, and keep looting for Q6 relevant into the late game.

 

Link to comment
Share on other sites

3 hours ago, Kiwinut said:

I moved everything to the same Prefix method so it's an atomic process, and popped the mods off as the slots reduced.

 

 

This sounds pretty cool, but the whole "lose a mod" thing does have to be done very carefully.

 

When you say "popped the mods off" what exactly happens? What I personally think should happen, is that the mod should go back into the player's backpack. If there's no more room in the player's backpack, it should drop the mod on the ground.

 

This is what SphereII did in his food spoilage code. If you want to learn from him, this is the code that does it:
https://github.com/SphereII/SphereII.Mods/blob/master/0-SphereIICore/Harmony/FoodSpoilage/FoodSpoilage.cs#L288

Link to comment
Share on other sites

5 hours ago, khzmusik said:

 

This sounds pretty cool, but the whole "lose a mod" thing does have to be done very carefully.

 

When you say "popped the mods off" what exactly happens? What I personally think should happen, is that the mod should go back into the player's backpack. If there's no more room in the player's backpack, it should drop the mod on the ground.

 

This is what SphereII did in his food spoilage code. If you want to learn from him, this is the code that does it:
https://github.com/SphereII/SphereII.Mods/blob/master/0-SphereIICore/Harmony/FoodSpoilage/FoodSpoilage.cs#L288

Hi, thanks for the thoughts.
The Mod is currently pushed into the inventory if there aren't enough mod slots on the repaired item. If there isn't space, then I'm not allowing the repair to start.

The idea there was that mods can be valuable, and I didn't want to dump them on the ground.
But there are a few problems with this, and I think you are right that I should drop it on the floor as a new Entity.

I should be ejecting ammo into the inventory, and prioritise ammo over the mod. Some mods change ammo capacity and I don't want to end up exceeding maximum ammo.
I'm not sure if I can do the two atomically - so dropping the mod/ammo on the floor if it can't be held has to be right.

We're also working out if we need new recipes for the crafting parts, or if scavenging is sufficient.
 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...