Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Rotate Token on movement

1567894120

Edited 1567894261
I would like to know how to write a script that will Rotate a token if moved in a direction. im not sure how to code this on roll20, since i am not familiar with API coding. if i were to do this script using c# i know i would take a vector3 of the current location and take the vector3 of the new location and set my rotation based on that.  so what i am asking is if someone could help me rotate a token to face west when a player moves his token to the right with an arrow key, and so on with the other directions, as well as a key that they can hold down to strafe. any help would be greatly appreciated thank you. p.s. The reason i want this is so i can add a blind spot to the back on my player tokens to prevent them from seeing directly behind them. I am running a campaign where i want npcs to be able to sneak behind my pcs, but i also dont want to hassle them with turning their tokens every time they move. also if there is anyway to stop them from being able to rotate in combat unless it is their turn would be appreciated.
1567900807
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
See if you can use something from here .
1567901330
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
You might be able to get something useful form here , as well. This one doesn't change facing, but does add a facing indicator. It also adds an attribute to the character that reports the facing angle.
Thank you Keith