variables' duration attribute not working
Summary
When a duration is set for the variable, the variable is never set to begin with
Steps to reproduce
One can simply spawn this mob and try to hit it to trigger the setvariable mechanic. While the mob is always sending the value of the variable in chat, even prior to the variable being set, triggering the setvariable mechanic will not set the variable at all
VariableProblem:
Type: WITHER_SKELETON
Options:
Despawn: persistent
AIGoalSelectors:
- clear
AITargetSelectors:
- clear
Skills:
- setvariable{var=caster.test;val=1;duration=60} @self ~onDamaged
- command{c="say <caster.var.test>"} @self ~onTimer:20
Current behavior
A variable with a duration will not be set
Intended correct behavior
A variable with a duration will be set and, if no other attempt to set it wih a different duration is made while the variable exists, the variable is unset after the duration. If one or more such attempts are made, the duration is reset and changes to the new one. for instance:
Skills:
- setvariable{var=caster.test;val=1;duration=60}
- delay 40
- setvariable{var=caster.test;val=2;duration=80}
While using this skill, the expected result is this:
- the variable is set from the original tick to the 120th one
- the variable does not undet itself after 60 ticks, but after 120
- if one tries to access the variable during the first 40 ticks,
1
is returned. - if one tries to access the variable from the 41th to the 120th tick,
2
is returned - if one tries to access the variable after the 120th tick, the variable will be UNDEFINED
Versions
- Minecraft:
1.19.4
- Paper:
527
- MythicMobs:
Dev Build 4516