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

[Script] Patrolling Tokens

I haven't really had a chance to sit down and make this script highly customizable yet, so you have to dig in a bit and modify it to suit your specific needs. But here's how to make a token walk left 10 squares, then back right 10 squares, repeatedly. <a href="https://gist.github.com/rileydutton/5489038" rel="nofollow">https://gist.github.com/rileydutton/5489038</a>
Brilliant.&nbsp; Upgrading my membership. I think this will be really huge guys. Thanks!
1367342656
Pat S.
Forum Champion
Sheet Author
how would you set the var direction to go up and down? I understand the -70 pixel as it is one unit to the left but it is getting the up and down puzzling me. This would be cool to be able to setup a complete direction of a token. Make it move down a corridor then have it turn and continue down the corridor in a different direction.&nbsp; example: the orc patrol marches down the corridor to the left 10 units then turns south to travel another 10 units before turning left and going 20 units which would put it in front of a stairway leading down then you have them return the route they traveled. That would be cool way of doing a random encounter. It would let the party be able to avoid the encounter if they get out of the way in time.
You would use the "top" property instead of "left". You can take a look at the wiki for a full list of all attributes on the token objects: <a href="https://wiki.roll20.net/API:Objects#Graphic_.28Token.2FMap.2FCard.2FEtc..29" rel="nofollow">https://wiki.roll20.net/API:Objects#Graphic_.28Token.2FMap.2FCard.2FEtc..29</a>
1367344884
Pat S.
Forum Champion
Sheet Author
cool thank you. I know nothing about javascripting but it looks like I will be learning.
Go check out:&nbsp;<a href="http://www.codecademy.com/tracks/javascript" rel="nofollow">http://www.codecademy.com/tracks/javascript</a>
1367350643
Pat S.
Forum Champion
Sheet Author
I have that bookmarked and already started on it. Give me computer hardware and I can tear it down and rebuild it in my sleep but software I'm going to college for that stuff. Just about done with my first semester and will be digging into more stuff during the summer,
How would you stop the script from making the guard patrol? For example, if the guard spotted a hidden character and you wanted to start combat against that character.
The example above only patrols if the green status maker is set on the token.
Doh, I see that now.
so then, does the status marker dynamically change itself to stop if something came into its line of sight?&nbsp; Like say you could set players to use a certain status marker, and stealthing players to use another then do the perception rolls when the get close enough, maybe even automatically (within x squares while in a potential visible area via dynamic lighting range/ los).&nbsp; Maybe make it so macros / abilities could get fired off when something stepped within range of an aura (if that's not already possible, ive been looking but could of easily overlooked that, lots of stuff to take in). This particular script has gotten me excited enough that ill probably signup, and it'll be a good excuse to start learning java :P&nbsp;
Hey, this is my first API project, and to be honest, used a MASSIVE chunk of Riley's script, but it should solve all of your requests Buddy. Aura 1 is guards line of sight, bar 2 is his perception roll, and character token's bar 2 is the characters stealth roll <a href="https://gist.github.com/anonymous/5980034" rel="nofollow">https://gist.github.com/anonymous/5980034</a>