How to tune enchant of equipment.

File: data/enchant_items.xml
Enchantment chances are set in the <chances> section for different item types. Each <chance val="X"/> defines the success percentage for a specific enchantment level (starting from +0). Values are in percent (e.g., 100 = 100%, 50 = 50%).
Example Chance Configuration:
Code:
<chances type="ARMOR"> <!-- Standard armor -->
    <chance val="100"/> <!-- +0 → +1: 100% -->
    <chance val="100"/> <!-- +1 → +2: 100% -->
    <chance val="100"/> <!-- +2 → +3: 100% -->
    <chance val="50"/>  <!-- +3 → +4: 50% -->
    <chance val="50"/>  <!-- +4 → +5: 50% -->
    <chance val="33"/>  <!-- +5 → +6: 33% -->
    <chance val="25"/>  <!-- +6 → +7: 25% -->
    <chance val="20"/>  <!-- +7 → +8: 20% -->
    <chance val="14"/>  <!-- +8 → +9: 14% -->
    <chance val="11"/>  <!-- +9 → +10: 11% -->
    <chance val="8"/>   <!-- +10 → +11: 8% -->
    <chance val="6"/>   <!-- +11 → +12: 6% -->
    <chance val="5"/>   <!-- +12 → +13: 5% -->
    <chance val="4"/>   <!-- +13 → +14: 4% -->
    <chance val="3"/>   <!-- +14 → +15: 3% -->
    <chance val="2"/>   <!-- +15 → +16: 2% -->
    <chance val="2"/>   <!-- +16 → +17: 2% -->
    <chance val="1"/>   <!-- +17 → +18: 1% -->
    <chance val="1"/>   <!-- +18 → +19: 1% -->
    <chance val="1"/>   <!-- +19 → +20: 1% -->
</chances>

<chances type="FULL_ARMOR"> <!-- Full armor -->
    <chance val="100"/> <!-- +0 → +1: 100% -->
    <chance val="100"/> <!-- +1 → +2: 100% -->
    <chance val="100"/> <!-- +2 → +3: 100% -->
    <chance val="100"/> <!-- +3 → +4: 100% -->
    <chance val="50"/>  <!-- +4 → +5: 50% -->
    <!-- ... (similar to ARMOR up to +20) -->
</chances>

<chances type="JEWELRY"> <!-- Jewelry -->
    <chance val="100"/> <!-- +0 → +1: 100% -->
    <chance val="100"/> <!-- +1 → +2: 100% -->
    <chance val="100"/> <!-- +2 → +3: 100% -->
    <chance val="50"/>  <!-- +3 → +4: 50% -->
    <!-- ... (similar to ARMOR up to +20) -->
</chances>

<chances type="WEAPON"> <!-- All weapons (non-magical) -->
    <chance val="70"/>  <!-- +0 → +1: 70% -->
    <chance val="60"/>  <!-- +1 → +2: 60% -->
    <!-- ... (configure as needed) -->
</chances>

<chances type="MAGIC_WEAPON"> <!-- Magical weapons (optional) -->
    <chance val="60"/>  <!-- +0 → +1: 60% -->
    <chance val="50"/>  <!-- +1 → +2: 50% -->
    <!-- ... (configure as needed) -->
</chances>
Key Notes:
  • Chance Order: Each <chance> corresponds to an enchantment level (from +0 to max).
  • Types:
    • ARMOR: Standard armor (helm, gloves, boots, etc.).
    • FULL_ARMOR: Full-body armor.
    • JEWELRY: Accessories (rings, earrings, necklaces, etc.).
    • WEAPON: All weapons, unless MAGIC_WEAPON is specified.
    • MAGIC_WEAPON: Magical weapons only (optional; falls back to WEAPON if not defined).
  • If <chances type="MAGIC_WEAPON"> is missing, magical weapons use WEAPON chances.
2. Configuring Enchantment Scrolls
File
: data/enchant_items.xml
Enchantment scrolls are configured in the <scroll> section. Below are the key parameters and their meanings:
ParameterDescriptionValues
idScroll IDNumeric ID, e.g., 959
infallibleGuarantees enchantment successtrue (100% success) / false (uses <chances>)
on_failAction on enchantment failureCRYSTALIZE (breaks item into crystals), RESET (resets enchant level), NONE (keeps current level)
reset_lvlEnchant level on reset (on_fail="RESET")Number, e.g., 3 (resets to +3)
chance_bonusBonus to enchantment chanceDecimal, e.g., 0.2 (+20% chance)
gradeItem gradeNONE, D, C, B, A, S, S80, S84
incrementEnchant level increase on successNumber, e.g., 1 (+1), 3 (+3)
levels min/maxMin/max enchantment levelsE.g., min="0" max="20"
items_restrictItem type or specific IDsWEAPON, ARMOR, or list of item IDs
Example Scroll Configurations:
1. Reset to +3 on Failure

Code:
<scroll id="959" infallible="false" reset_lvl="3" on_fail="RESET" chance_bonus="0" grade="S">
    <levels min="0" max="20"/>
    <items_restrict type="WEAPON"/>
    <chances type="WEAPON">
        <chance val="70"/>
        <!-- ... -->
    </chances>
</scroll>
  • On failure, enchantment resets to +3.
  • Enchants S-grade weapons.
2. Enchant by +3 on Success
Code:
<scroll id="960" infallible="false" reset_lvl="0" increment="3" on_fail="RESET" chance_bonus="0" grade="S">
    <levels min="0" max="20"/>
    <items_restrict type="WEAPON"/>
    <chances type="WEAPON">
        <chance val="70"/>
        <!-- ... -->
    </chances>
</scroll>
  • Success increases enchantment by +3 (e.g., +0 to +3).
  • On failure, resets to +0.
3. No Reset on Failure
Code:
<scroll id="961" infallible="false" reset_lvl="0" on_fail="NONE" chance_bonus="0" grade="S">
    <levels min="0" max="20"/>
    <items_restrict type="WEAPON"/>
    <chances type="WEAPON">
        <chance val="70"/>
        <!-- ... -->
    </chances>
</scroll>
  • On failure, enchantment level remains unchanged.
4. Add +20% Chance Bonus
Code:
<scroll id="962" infallible="false" reset_lvl="0" on_fail="RESET" chance_bonus="0.2" grade="S">
    <levels min="0" max="20"/>
    <items_restrict type="WEAPON"/>
    <chances type="WEAPON">
        <chance val="70"/> <!-- Becomes 70% + 20% = 84% -->
        <!-- ... -->
    </chances>
</scroll>
  • chance_bonus="0.2" adds 20% to each chance.
5. Scroll for Specific Items
Code:
<scroll id="13540" infallible="false" on_fail="CRYSTALIZE" chance_bonus="0" grade="NONE">
    <levels min="0" max="23"/>
    <items_restrict type="WEAPON">
        <item id="13539"/> <!-- Item ID -->
        <item id="13550"/> <!-- Another item -->
    </items_restrict>
    <chances type="WEAPON">
        <chance val="70"/>
        <!-- ... -->
    </chances>
</scroll>
  • Enchants only specified items (13539, 13550).
  • On failure, items crystallize.
6. Scroll for Magical Weapons
Code:
<scroll id="963" infallible="false" reset_lvl="0" on_fail="RESET" chance_bonus="0" grade="S">
    <levels min="0" max="20"/>
    <items_restrict type="WEAPON"/>
    <chances type="WEAPON">
        <chance val="70"/>
        <!-- ... -->
    </chances>
    <chances type="MAGIC_WEAPON">
        <chance val="60"/> <!-- Custom chances for magical weapons -->
        <!-- ... -->
    </chances>
</scroll>
  • Magical weapons use MAGIC_WEAPON chances.
  • If MAGIC_WEAPON is not defined, WEAPON chances apply.
 
Last edited:
ATTENTION! THE CHANCE OF ENCHANTING HAS BEEN MOVED TO data/enchant_items.xml
Example:
<scroll id="6574" infallible="false" reset_lvl="0" on_fail="RESET" chance_bonus="0" grade="C">
<levels min="0" max="20" />
<items_restrict type="ARMOR"/>
<chances type="ARMOR">Chance for normal armor
<chance val="100"/>
<chance val="100"/>
<chance val="100"/>
<chance val="50"/>
<chance val="50"/>
<chance val="33"/>
<chance val="25"/>
<chance val="20"/>
<chance val="14"/>
<chance val="11"/>
<chance val="8"/>
<chance val="6"/>
<chance val="5"/>
<chance val="4"/>
<chance val="3"/>
<chance val="2"/>
<chance val="2"/>
<chance val="1"/>
<chance val="1"/>
<chance val="1"/>
</chances>
<chances type="FULL_ARMOR"> Chance for Full Armor
<chance val="100"/>
<chance val="100"/>
<chance val="100"/>
<chance val="100"/>
<chance val="50"/>
<chance val="50"/>
<chance val="33"/>
<chance val="25"/>
<chance val="20"/>
<chance val="14"/>
<chance val="11"/>
<chance val="8"/>
<chance val="6"/>
<chance val="5"/>
<chance val="4"/>
<chance val="3"/>
<chance val="2"/>
<chance val="2"/>
<chance val="1"/>
<chance val="1"/>
</chances>
<chances type="JEWELRY"> Chance for Jewelry
<chance val="100"/>
<chance val="100"/>
<chance val="100"/>
<chance val="50"/>
<chance val="50"/>
<chance val="33"/>
<chance val="25"/>
<chance val="20"/>
<chance val="14"/>
<chance val="11"/>
<chance val="8"/>
<chance val="6"/>
<chance val="5"/>
<chance val="4"/>
<chance val="3"/>
<chance val="2"/>
<chance val="2"/>
<chance val="1"/>
<chance val="1"/>
<chance val="1"/>
</chances>
</scroll>
 
Last edited:
Possible to make different rate for Mage and Fighter weapons ?


5. Add scroll for enchanting unique item id
Unique scroll for unique item. Example:
Where scroll id="13540" is unique scroll
items_restrict type of item - WEAPON or ARMOR
item id="13539" - Item ID for enchant

Final result:
<scroll id="13540" infallible="false" on_fail="CRYSTALIZE" chance_bonus="0" grade="NONE">
<levels min="0" max="23" />
<items_restrict type="WEAPON">
<item id="13539" />
</items_restrict>
</scroll>

delete default scrolls and add scrolls with id mage/fighter weapons
 
Cara, nós temos isso
<scroll id="10998" infalível="falso" reset_lvl="3" on_fail="RESET" chance_bonus="0" nota="D">
No, you don't get the idea. the method that already exists only returns to a fixed value... as you mentioned.
My suggestion would be to reduce the on-failure value by 1 :

66666.webp
In this Print, Draconic was +13. Failed to try +14. Using your example, it went back to a fixed value of +3.
My suggestion is to add a function to reduce the value by 1 on failure. Was +13 Tried +14, Would go back to +12...
 
No, you don't get the idea. the method that already exists only returns to a fixed value... as you mentioned.
My suggestion would be to reduce the on-failure value by 1 :

View attachment 5172
In this Print, Draconic was +13. Failed to try +14. Using your example, it went back to a fixed value of +3.
My suggestion is to add a function to reduce the value by 1 on failure. Was +13 Tried +14, Would go back to +12...
Do you need to decrement the failure count from existing value ?
 
It's not about reducing the failure count, it's about reducing the item's enchant by 1 instead of being fixed or resetting it.
Look at my example : Was +13 Tried +14, Would go back to +12...
if it fails again. +12 - reduce to +11
if it fails again. +11 - reduce to +10
if it fails again. +10 - reduce to +09
 
It's not about reducing the failure count, it's about reducing the item's enchant by 1 instead of being fixed or resetting it.
Look at my example : Was +13 Tried +14, Would go back to +12...
if it fails again. +12 - reduce to +11
if it fails again. +11 - reduce to +10
if it fails again. +10 - reduce to +09
As far as I understand you correctly, with each failure you don't reset the value, but decrease it by -1, which is a decrement.
 
Back
Top