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

CFX & Delay

I am trying to get delays to work in conjunction with custom FX.&nbsp; For example, a fireball macro:&nbsp; !roll20AM --audio,play|Fireball /fx FireballStart @{target|Caster|token_id} @{target|Foe|token_id} @{Watcher|wtype}&amp;{template:atkdmg} {{mod=+2}} {{rname=Fireball}} {{r1=[[@{Watcher|d20}cs&gt;20 + 2[PROF]]]}} @{Watcher|rtype}cs&gt;20 + 2[PROF]]]}} {{attack=1}} {{range=}} {{damage=1}} {{dmg1flag=1}} {{dmg1=[[6d6]]}} {{dmg1type=}} 0 {{dmg2=[[0]]}} {{dmg2type=}} {{crit1=[[6d6[CRIT]]]}} {{crit2=[[0[CRIT]]]}} 0 {{desc=}}&nbsp; &nbsp;{{spelllevel=}} {{innate=}} {{globalattack=@{Watcher|global_attack_mod}}} {{globaldamage=[[0]]}} {{globaldamagecrit=[[0]]}} {{globaldamagetype=@{Watcher|global_damage_mod_type}}} ammo= @{Watcher|charname_output} /fx Explode @{target|AoE|token_id} ^ This works great, to an extent. This script will start the sound effect, shoot the fireball from caster to target, then the explosion will occur at the target, a to-hit roll is performed, and damage. The issue with this macro is, everything happens at the same time, no matter how I order it. The roll, sound, and both FX all trigger together. I've tweaked things where it still looks good, but ideally, the timing of everything would be better. Also, having delays be part of macros opens up so many possibilities. I am trying to use: <a href="https://app.roll20.net/forum/post/6533907/script-delay" rel="nofollow">https://app.roll20.net/forum/post/6533907/script-delay</a> ...in conjunction with:&nbsp; <a href="https://app.roll20.net/forum/post/6534452/script-cfx" rel="nofollow">https://app.roll20.net/forum/post/6534452/script-cfx</a> ...but it seems like the CFX script does not support custom FX.&nbsp; Has anyone had any luck tweaking the CFX script to allow custom fx? I am going to look into that, but curious if others already have or if the author has insight. Thanks.
1587008674
The Aaron
Roll20 Production Team
API Scripter
This version will work with custom fx: on('ready',()=&gt;{ const isBuiltinFx = (name) =&gt; /(beam|bomb|breath|bubbling|burn|burst|explode|glow|missile|nova|splatter)-(acid|blood|charm|death|fire|frost|holy|magic|slime|smoke|water)/.test(name); on('chat:message',(msg)=&gt;{ 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] &amp;&amp; character &amp;&amp; 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') }; let effect = isBuiltinFx(args[0]) ? args[0] : (findObjs({type: 'custfx', name: args[0]}, {caseInsensitive: true})[0]||{id:""}).id; tokens.forEach((t)=&gt;{ spawnFxBetweenPoints( {x:t.get('left'),y:t.get('top')}, destPt, effect, pageid ); }); } else { sendChat("CFX", "/w gm No tokens for that character on your current page."); } } else { sendChat("CFX", "/w gm Use &lt;code&gt;!cfx [effect] [source character id] [destination token id]&lt;/code&gt;."); } } break; } }); log("-=&gt; CFX command loaded (!cfx) &lt;=-"); });
Will try it out immediately! You're my hero!
Hi I have a similar dillema! I want the effect to play after the sound. I installed the delay script and cfx from this page because i will be using custom&nbsp; effects. I tested cfx first: this is my macro: !roll20AM --audio,play,nomenu|Cold Cone !cfx frostbreath @{selected|token_id} @{target|token_id} the sound plays then cfx returns the message as this: (From CFX): &nbsp;Use&nbsp; !cfx [effect] [source character id] [destination token id] . Thank you for any assistance
1587385340
The Aaron
Roll20 Production Team
API Scripter
Use: !roll20AM --audio,play,nomenu|Cold Cone !cfx frostbreath @{selected| character_id } @{target|token_id}
Hi thank you for your response! I have tried the script and it is not showing the error anymore but the effects is not executing too only the sound.
I haven't played with it too much, Aaron, but I, too, am unable to get it to work with the custom effects I've created still.
1587449225
The Aaron
Roll20 Production Team
API Scripter
Try running it without the ! on the front and verify that it is getting the expected ids.&nbsp; Also make sure the effect is spelled correctly.&nbsp; Worst case, PM me an invite to your game and GM me and I'll come take a look.
1587685700

Edited 1587686058
Let me be more specific. First, thank you! Your changes to the !cfx script do allow custom effects to be called with !delay. In playing more with the macro, it doesn't seem to be doing what I want, or I am not doing it right, or maybe it's not possible.&nbsp; :-) Example: In this example, the cartoon dragon token, we'll call him Watcher, is shooting an FX fireball at the Kadrin token.&nbsp; Desired outcome: The custom "fireball going through the air" effect, FireballStart, will go from caster to target. The custom Explode effect will delay for a brief moment, then erupt at the target. Actual outcome: The FireballStart effect goes from Watcher to Kadrin. The Explode effect waits the half second and "explodes" at the caster token. The macro used here is: /fx FireballStart @{target|Caster|token_id} !delay .5 --!cfx Explode @{target|Caster|character_id} @{target|AoE|token_id} This is what it looks like in action: FireballStart is correctly going from caster (Watcher) to target (Kadrin), but the Explode is happening at the caster token. Thoughts? Thanks!
1588626217

Edited 1588719091
Hello there ! I had the same problem Dietrich ! Solved it partially by inverting @{targert_n°1|...} and @{target_n°2|...} so in your case it would look like :&nbsp; !delay .5 --!cfx Explode @{target|AoE|character_id} @{target|Caster|token_id} I think that !cfx commands are functioning for beam-like fx but not explosion fx. Indeed when I actually use a command like :&nbsp; !cfx burst-fire @{selected|character_id} @{target|token_id} the burst effect takes place at the caster's feet (just like your problem Dietrich). What about the solution I just proposed ?&nbsp; ? Well I tried and it worked perfectly fine as long as I had only ONE token representing the character I want to target physically on the map. Let me be a bit more precise. For instance, if I type " !cfx burst-fire @{target|character_id} @{selected|token_id} " at an ogre (which is the "target") (the "selected" token is the red-horned tiefling) and if there is only ONE&nbsp; token "ogre" on the map, then the ogre will burst into flame, great. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Fig. 1 : 1 ogre burst into flames But if I try the same script at a goblin, and let's say there are 3 goblins on the map, all 3 goblins burst into flame (and that's logic because the script calls as an argument the character_id, and all three goblins are linked to the same character, the same NPC Sheet. Hence they have the same character_id). &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Fig.2 : All 3 goblins burst into flames Hence, the "normal" sequence ([effect] [source] [target]) does not work for explosion-type fx but works perfectly fine for beam-like fx. The reverse "sequence" ([effect] [target] [source]) only works for explosion-type fx if there is only ONE&nbsp; token representing the target on the map (and as a consequence this sequence is also not a viable solution). I thought to some solutions :&nbsp; 1) Keep the "reverse" sequence for explosion-types fx but instead of using "character_id" use "token_id" (as each token has a unique token_id, all 3 goblins should not all burst into flame but only the one I targeted) 2) Keep the "reverse" sequence for explosion-types fx but instead of using "character_id" use "token_name" AND a script like TokenNameNumber so that every token has a different name (same conclusions). The problem is : I'm not familiar with roll20 programming language (and Object Oriented Programming in general ^^) and I don't know how to modify the code in order to do that ..! If someone can help it would be really nice :) Thanks !
[EDIT] Maybe this strides a bit from the original subject ..! So that the future viewers of this topic feel less confused, I created another one targeting specifically the last problem Dietrich and I had :) : CFX target/source problem
1589036832
The Aaron
Roll20 Production Team
API Scripter
Ok, I've rewritten this script to correct all those problems, I believe.&nbsp; I posted it and the details of it here:&nbsp;<a href="https://app.roll20.net/forum/permalink/8637357/" rel="nofollow">https://app.roll20.net/forum/permalink/8637357/</a>
Amazing, thank you.
1589193604
The Aaron
Roll20 Production Team
API Scripter
No problem!