How does the item reduction feature work?

Do you want to create a more challenging survival experience on your server? Our item reduction feature allows you to control the scarcity of items, shaping the overall gameplay dynamic.

Here's a breakdown of the script's functionality:

  • XML Loading: The script starts by attempting to load the types.xml file using the simplexml_load_string function. Any errors encountered during this process will be captured, and the script will throw an exception to prevent unexpected behavior.

  • Iterating Through Elements: Once loaded, the script meticulously iterates through each relevant element within the XML file. For each element:

    • Nominal Value Retrieval: The script retrieves the current nominal value, which represents the maximum number of a particular item that can exist on the map at any given time.

    • Calculating New Nominal Value: Based on your chosen reduction factor (expressed as a percentage), the script calculates the new nominal value. This calculation involves subtracting the reduction factor from 100 and then dividing by 100.

    • Updating XML Values: The script then updates the XML element with the newly calculated nominal value. Additionally, if applicable, the script ensures the minimum value (min) doesn't exceed the new nominal value, maintaining consistency.

  • Saving Changes: After processing all relevant elements, the modified XML content is converted back into a string format using the asXML() function. This allows the script to save the changes you've defined.

By utilizing item reduction, you can create a more challenging environment where resources are scarcer, demanding more strategic gameplay from your players. This allows you to fine-tune the difficulty and overall feel of your server to your preferences.

Last updated