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

FX Question

Is there any way either through /fx or using the API to specify where on a token the fx is executed on? For instance if I have a big dragon it is centering the fx on the token so it looks like their breath weapon is coming from the middle of their back instead of from their mouth. The only solution I could come up with was to create an invisible token, add an aura to it only the GM could see, and trigger my breath weapon template call and fx call from the invisible token: I figure I might have to edit the following script: on('ready',()=>{ on('chat:message',(msg)=>{ if('api' !== msg.type ) { return; } let args = msg.content.split(/\s+/); switch(args.shift().toLowerCase()){ case '!cfx': { let character = getObj('character',args[1]); let destToken = getObj('graphic', args[2]); if(args[0] && character && destToken) { let pageid = Campaign().get("playerpageid"); let tokens = findObjs({ represents: character.id, pageid: pageid }); if(tokens){ let destPt = { x: destToken.get('left'), y: destToken.get('top') }; tokens.forEach((t)=>{ spawnFxBetweenPoints( {x:t.get('left'),y:t.get('top')}, destPt, args[0], pageid ); }); } else { sendChat("CFX", "/w gm No tokens for that character on your current page.") } } else { sendChat("CFX", "/w gm Use <code>!cfx [effect] [source character id] [destination token id]</code>."); } } break; } }); log("-=> CFX command loaded (!cfx) <=-") }); To take a "left offset" and "top offset" so the FX originates from somewhere other then the direct center of the token. Is there an easier way to do this?
I did the offset method, seems to work fine. I just used magic numbers, since all starships in Starfinder take 1 hex of space, but maybe referencing the token's width for the offset is the way to go. An example of my crappy code for this is in the "alternative gist" in the top post here (in the function "EngineFX, starting at line 351):&nbsp; <a href="https://app.roll20.net/forum/post/6461068/starfinder-helm-controls-via-chat-buttons/?pageforid=6461068#post-6461068" rel="nofollow">https://app.roll20.net/forum/post/6461068/starfinder-helm-controls-via-chat-buttons/?pageforid=6461068#post-6461068</a> Of course, not everything has an ideally centered head, or fx origin point. Maybe the script should reference 3 numbers from the token (in gm notes, or one of the bars maybe): rotation offset, left offset, top offset.
1530279784

Edited 1530279806
MyRoll20Stuffs
API Scripter
Bast L. said: I did the offset method, seems to work fine. I just used magic numbers, since all starships in Starfinder take 1 hex of space, but maybe referencing the token's width for the offset is the way to go. An example of my crappy code for this is in the "alternative gist" in the top post here (in the function "EngineFX, starting at line 351):&nbsp; <a href="https://app.roll20.net/forum/post/6461068/starfinder-helm-controls-via-chat-buttons/?pageforid=6461068#post-6461068" rel="nofollow">https://app.roll20.net/forum/post/6461068/starfinder-helm-controls-via-chat-buttons/?pageforid=6461068#post-6461068</a> Of course, not everything has an ideally centered head, or fx origin point. Maybe the script should reference 3 numbers from the token (in gm notes, or one of the bars maybe): rotation offset, left offset, top offset. Yeah that's what I was thinking. I was gong to go based on left/top then realized I have to worry about rotation as well and suddenly it seemed more complicated than I originally thought. Luckily the token I'm using, while quite large, has a straight facing neck/head. But like you said not all tokens are aligned this. When I get some time later I'll mess around with this. Thanks for the reply and info.