RPTools.nethttp://forums.rptools.net/ Movement based on result of rollhttp://forums.rptools.net/viewtopic.php?f=20&t=27335 Page 1 of 1

 Author: SzassT [ Wed Sep 13, 2017 4:45 am ] Post subject: Movement based on result of roll I'm trying to make a macro for racing. My intention is that a character moves (Race Check*10)ft each round for a race. I was wondering if it is possible to have a macro that rolls 1d20+Racing and moves the token the appropriate distance in a straight line based on the result. Overall, my goal is to make a macro for horse races where I can simply select a group of horses and press one button per check so players can see the race in action. Assuming the horses (or whatever token) has a property on their stat sheet called "Racing" (without the quotes), does anyone know how to make a macro for this? I'm assuming it is either very simple and I'm missing something, or very complex. Any help is appreciated.

 Author: aliasmask [ Wed Sep 13, 2017 6:24 am ] Post subject: Re: Movement based on result of roll You want to use Wiki: getTokenX() and Wiki: getTokenY() and depending on direction of the race add your random value to the coordinate. Then use Wiki: moveToken() to put in new value.

 Author: SzassT [ Wed Sep 13, 2017 6:56 am ] Post subject: Re: Movement based on result of roll Thanks for your reply! So I tested out this macro:Code:[h: CurrentX = getTokenX(0)][h: CurrentY = getTokenY(0)][h: NewX = CurrentX + 1d20+getProperty("Racing")][h: NewY = CurrentY][h: moveToken(NewX, NewY)]with Auto Execute and Apply to Selected Tokens checked. The result moves the token a static distance diagonally (mostly up, a little to the right). Any idea what I'm doing wrong?EDIT: So I believe the issue is that I'm not understanding the xy coordinate system. I switched it to display the results, and it showed -97 207 for Current and -75 207 for New. How far is a a single coordinate cell? I was assuming it would use the Grid, but that appears very incorrect. How would I make this apply to grid movement?

 Author: aliasmask [ Wed Sep 13, 2017 10:15 am ] Post subject: Re: Movement based on result of roll You need to set the units to 0 for Wiki: moveToken() to use cells.

 Author: SzassT [ Wed Sep 13, 2017 1:22 pm ] Post subject: Re: Movement based on result of roll Doh! Can't believe I missed that! Thanks for the help AliasMask, it works perfectly now!

 Page 1 of 1 All times are UTC - 6 hours [ DST ] Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Grouphttp://www.phpbb.com/