In order to start designing something like this, you want to see what the player's (or another entity's) velocity is as they're moving. On all three axes (x, y, z). You can do this by having your potion effect's on tick procedure trigger print statements that send information to the MCreator console.
Once you know how fast the player is while they're sneaking, walking, sprinting, jumping, etc, you'll know what value you can compare against before causing damage.
There are a couple other things to keep in mind, though: One being that the player can move with positive or negative velocity depending on the direction they're moving. So you want to get the absolute value of their velocity, not just the velocity by itself. The other being that the player has a negative Y velocity when standing completely still, to simulate gravity.
In your potion's "On effect active tick" procedure, you can have an if block check to see if the absolute value of the entity's X or Z velocity is greater than 0, or if the absolute value of their Y velocity is greater than 0.08, and if so, deal damage to them.
The absolute block is in the Math tab, inside the "round" block.
If you didn't want your potion to deal damage while the affected entity was sneaking, for example, you could do something like that by changing the X and Z velocity threshold values to something like 0.04 - since the velocity while sneaking reads as ~0.035.
Lastly, I also recommend having your whole procedure restricted by a 'if not Is provided world client-side' check. This prevents a weird de-sync between the server and client where sometimes the game still thinks you have a potion effect, while the timer is at 0, but it still affects you.
In order to start designing something like this, you want to see what the player's (or another entity's) velocity is as they're moving. On all three axes (x, y, z). You can do this by having your potion effect's on tick procedure trigger print statements that send information to the MCreator console.
Once you know how fast the player is while they're sneaking, walking, sprinting, jumping, etc, you'll know what value you can compare against before causing damage.
There are a couple other things to keep in mind, though:
One being that the player can move with positive or negative velocity depending on the direction they're moving. So you want to get the absolute value of their velocity, not just the velocity by itself.
The other being that the player has a negative Y velocity when standing completely still, to simulate gravity.
In your potion's "On effect active tick" procedure, you can have an if block check to see if the absolute value of the entity's X or Z velocity is greater than 0, or if the absolute value of their Y velocity is greater than 0.08, and if so, deal damage to them.
The absolute block is in the Math tab, inside the "round" block.
If you didn't want your potion to deal damage while the affected entity was sneaking, for example, you could do something like that by changing the X and Z velocity threshold values to something like 0.04 - since the velocity while sneaking reads as ~0.035.
Lastly, I also recommend having your whole procedure restricted by a 'if not Is provided world client-side' check. This prevents a weird de-sync between the server and client where sometimes the game still thinks you have a potion effect, while the timer is at 0, but it still affects you.
how do i find the "is provided with world client-side' block?
You can either just use the search bar in the top left, or find it near the bottom of the list in "World data".