Suggestion Open

Using variables in Drops:

#6225 opened by Unknown 1 year ago

Unknownreported this suggestion

Summary

I’d love to see scaling mob levels added to MysticMobs, where higher-level mobs have an increased chance to drop rare loot from their drop tables. Right now, trying to implement this manually causes issues—any math-based chance in the Drops: section forces the drop to become 100% guaranteed, which breaks the intended progression.

I’ve tested multiple approaches, including setting variables via skills and applying them to drop chances, but the system doesn’t interpret them correctly. Thankfully, with help from the community (shoutout to mikekevie), I found a partial workaround using ?chance{c=...} in skills. However, this doesn’t work with FancyDrop, and it’s still far from ideal since we can’t use dynamic values directly in the Drops: config.

Usage

This would allow admins to create tiered loot systems where mobs drop better rewards as they level up. For example:

Drops:

  • diamond 1 0.05*<caster.level> # 5% base chance, scaling with level
    Or, if variables were properly supported in skills:

Skills:

  • setvariable{var=scaledDrop; value="0.05 * <caster.level>"; type=FLOAT} @self ~onSpawn
  • dropitem{i=diamond 1} @self ~onDeath ?chance{c=<caster.var.scaledDrop>}

Value

Better loot progression – Players get more exciting rewards as they face stronger mobs.

Less scripting work – No need for convoluted workarounds just to scale drop rates.

Future-proofing – Works seamlessly with FancyDrop and other mechanics.

Priority

High – This is a major limitation for anyone trying to create RPG-like mob progression. Right now, we have to either accept static drop rates or use janky skill-based fixes that don’t play well with other features.

Implementation

Fix math expressions in Drops: – Ensure formulas like 0.1*<caster.level> calculate correctly instead of defaulting to 100%.

Support variables in drop chances – Allow <caster.var.x> or similar syntax in both Drops: and skill-based drops.

Maintain compatibility – Ensure it works with FancyDrop and other loot-related mechanics.

Ideally, we could use something like:

Drops:

  • diamond 1 ?chance{c=0.05*<caster.level>} # Clean, dynamic chance
    This would be a huge quality-of-life improvement for server owners!

This version keeps the technical details but makes it feel more natural and engaging, like a real suggestion from a user. Let me know if you'd like any tweaks!

Unknowncommented

I apologize, but how does the function exist if in practice, together with helpers in the discord channel, it was checked and it is clear that it does not work.

When using any mathematical formulas in the chance fields (and the amount) of Drops, then the loot is guaranteed to fall, as if there is 1 (100%) or more... If it does exist, then there is a question with the fact that it does not work correctly:

Drops:

  • diamond 1 0.05*<caster.level>

When killing a mob with level 1 and 10, with a 5% chance, any loot is guaranteed to drop. Which is clearly a bug or a non-working mechanic.

Sign in to join the discussion.