RPTools.net

Discussion and Support

Skip to content

It is currently Thu Nov 23, 2017 1:12 pm 






Reply to topic  [ 5 posts ] 

Previous topic | Next topic 

  Print view

Author Message
 Offline
Cave Troll
 
Joined: Sun Apr 30, 2017 3:32 pm
Posts: 30
Location: Fort Smith, AR
 Post subject: Movement based on result of roll
PostPosted: Wed Sep 13, 2017 4:45 am 
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.


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Nov 10, 2009 6:11 pm
Posts: 7949
Location: Bay Area
 Post subject: Re: Movement based on result of roll
PostPosted: Wed Sep 13, 2017 6:24 am 
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.

_________________
Downloads:


Top
 Profile  
 
 Offline
Cave Troll
 
Joined: Sun Apr 30, 2017 3:32 pm
Posts: 30
Location: Fort Smith, AR
 Post subject: Re: Movement based on result of roll
PostPosted: Wed Sep 13, 2017 6:56 am 
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?


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Nov 10, 2009 6:11 pm
Posts: 7949
Location: Bay Area
 Post subject: Re: Movement based on result of roll
PostPosted: Wed Sep 13, 2017 10:15 am 
You need to set the units to 0 for Wiki: moveToken() to use cells.

_________________
Downloads:


Top
 Profile  
 
 Offline
Cave Troll
 
Joined: Sun Apr 30, 2017 3:32 pm
Posts: 30
Location: Fort Smith, AR
 Post subject: Re: Movement based on result of roll
PostPosted: Wed Sep 13, 2017 1:22 pm 
Doh! Can't believe I missed that! Thanks for the help AliasMask, it works perfectly now!


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 5 posts ] 

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 243 on Sun Nov 04, 2012 6:14 am

Users browsing this forum: No registered users and 1 guest





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman