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

Messing around with knockback and chain pull macros, any ideas?

I'm working on upgrading a few scriptcard macros for some of my character in a game, one of which uses scriptcards in a "get over here" type move where the target is pulled to the character, and deals damage based on the distance, the other character uses the crusher feat which allows for a knockback like effect, both of which i believe should be as simple as using token mods --move command, however, this has a "Direction" input which i am going to need to dynamically input, my idea is to take a direction that is created between two tokens (Target, and selected) and use that as the direction. And this brings me to the question, what commands would i use to create said direction or Angle?
1728830408
timmaugh
Pro
API Scripter
Fetch can get locations of tokens: @(selected.left) @(selected.top) @(target.left) @(target.top) And then MathOps lets you do SIN, COS, TAN, etc. with those numbers, which can tell you where a token should end up whether it was being pushed or pulled. Both of those are part of the Metascript Toolbox, and would plug right into your TokenMod command line. If you can't see how to construct the equations, I can try to mock up an example later.
Im not sure how to get the fetch calls to work properly
1729104166
timmaugh
Pro
API Scripter
You'll want the full Metascript Toolbox installed... then you can check the values like this: !The selected token is at (@(selected.left), @(selected.top)) {&simple} The target ones aren't as clean, since you have to actually use the targeting syntax of Roll20 to get the ID of the token: !The targeted token is at (@(@{target|token_id}.left), @(@{target|token_id}.top)) {&simple} Though, I have to say, if I needed this for myself, I would probably want to write a Plugger plug-in to handle it for me... four arguments: two tokens (with one being the "origin" and the other being the one that will move toward or away from the origin), a "push" or "pull" argument, and an amount... possibly with the ability to "cap" a "pull" at no more than to the origin point (instead of along that line but past the origin point). On the backend, the plug-in will do the figuring in javascript, and return... values that other scripts can make use of. Hmm... let me think about that. Maybe I can code something up later.