Friday, September 10, 2021

A Minor Barricade Exploit


I forgot to mention a little bug/exploit I found when investigating barricades:

When you add a plank, sheet, or bar as a barricade, the health of the barricade is determined by the condition of the object and a modifier based on your skill.

So if you are level 10 carpentry and add an undamaged plank to a barricade, it gives a health of 1500.

But when you remove that object from the barricade, the condition of that object is based on the health of the barricade divided by the base health the barricade would normally have without the skill modifier.

            float f = Math.min((float)this.plankHealth[n] / 1000.0f, 1.0f);
            inventoryItem = InventoryItemFactory.CreateItem((String)"Base.Plank");
            inventoryItem.setCondition((int)Math.max((float)inventoryItem.getConditionMax() * f, 1.0f));

This can technically be exploited to give yourself cheap repairs to barricades.  All it takes is for your skill to give you any positive modifier to the barricade health, so level 2 or more in the appropriate skill (metalworking and/or carpentry).

Here's an example using wood planks:

  • A wood plank has a base health of 1000 in a barricade.
  • At level 10 carpentry, this gets modified by 1.5, so the initial health is 1500.
  • Let's say a zombie comes along and causes 400 points of damage to the barricade.  Then you kill the zombie and remove the plank.
  • The barricade's health is 1100, so after you remove the plank the plank's health is 1100 1000 = 1.1 which is adjusted to be 1.  
  • The plank is in perfect condition, and if you immediately add it back to the barricade you have a barricade of 1500 again.  

A bug, but not something that is going to break the game.  

To fix it, I'm guessing they'd need to add a variable to hold the maximum health of the barricade at the time it is created.  Then they can take the current health at the time they remove the barricade, and use the percentage to determine the health of the object.

If you notice a mistake, or if you have a question you'd like me to investigate by looking at the code, let me know!  Thanks!

No comments:

Post a Comment

Do Gloves Protect You From Broken Glass?

Yes, gloves protect you from handling broken glass - any pair of gloves.  But gloves are not needed when removing broken glass from a smashe...