@Adroiid I don't know if it will fit for your purpose, but I have an example using the updatescript event.
To apply it, just call it at the character header this way:
Then, create the deceleration.c file and put the code below inside it.
void main()
{
deceleration();
}
void...