pufmat / skillsmod

A Minecraft mod that adds a fully configurable skill system to the game.
Other
37 stars 11 forks source link

using increase_stat for experience causes constant experience increase. #103

Closed neinome closed 2 months ago

neinome commented 2 months ago

Following the examples in the documentation, increase_stat causes experience bar to constantly increase. Changing the stat, even to a stat that is still 0, does not change this behavior. Removing the section using increase_stat stops the increase.

Here is the original code for what was being used (formatting changed): { "type": "puffish_skills:increase_stat", "data": { "variables": { "dmg": { "operations": [{ "type": "get_stat" }, { "type": "puffish_skills:test", "data": { "stat": "minecraft.custom:minecraft.damage_dealt" }}]}}, "experience": [{ "expression": "1" }]}}

Attempt 2: { "type": "puffish_skills:increase_stat", "data": { "variables": { "dmg": { "operations": [{ "type": "get_stat" }, { "type": "puffish_skills:test", "data": { "stat": "minecraft.custom:minecraft.damage_dealt" }}]}, "amt": { "operations":[{ "type": "get_increase_amount" }]}}, "experience": [{ "expression": "amt" }]}}

Attempt 3: { "type": "puffish_skills:increase_stat", "data": { "variables": { "dmg": { "operations": [{ "type": "get_stat" }, { "type": "puffish_skills:test", "data": { "stat": "minecraft.custom:minecraft.jump" }}]}, "amt": { "operations":[{ "type": "get_increase_amount" }]}}, "experience": [{ "expression": "amt" }]}}

Attempt 4 (stat that is still 0): { "type": "puffish_skills:increase_stat", "data": { "variables": { "dmg": { "operations": [{ "type": "get_stat" }, { "type": "puffish_skills:test", "data": { "stat": "minecraft.custom:minecraft.boat_one_cm" }}]}, "amt": { "operations":[{ "type": "get_increase_amount" }]}}, "experience": [{ "expression": "amt" }]}}

neinome commented 2 months ago

Don't know how I overlooked this during my previous testing... Experience needs to have a condition associated with it, or it will just keep increasing.

Adding a condition using the referenced variable before the experience expression fixed the issue. { "type": "puffish_skills:increase_stat", "data": { "variables": { "dmg": { "operations": [{ "type": "get_stat" }, { "type": "puffish_skills:test", "data": { "stat": "minecraft.custom:minecraft.damage_dealt" }}]}}, "experience": [{ "condition": "dmg", "expression": "1" }]}}