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

Multi-Target Macro Error

I'm trying to create a custom-fx macro that targets multiple tokens, but I keep getting an error. I know the basic macro works:

/fx agori_eldritch_blast @{selected|token_id}


But when I try to expand it to three blasts:

/fx agori_eldritch_blast @{target|1|token_id} 
/fx agori_eldritch_blast @{target|2|token_id} 
/fx agori_eldritch_blast @{target|3|token_id}

Nothing happens and I get the error:

No character was found for 'selected' TypeError: Cannot read property 'view' of undefined

I've tried using "selected and "target." When I switch "selected" to "target" the VTT will ask me to select three targets, upon clicking the third, nothing happens and I get the "TypeError: Cannot read property 'view' of undefined" error three times.

Can anyone see what I'm doing wrong?

August 19 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter

Try changing the target name to something other than a number, like

/fx agori_eldritch_blast @{target|t1|token_id} 
/fx agori_eldritch_blast @{target|t2|token_id} 
/fx agori_eldritch_blast @{target|t3|token_id}


However, based on my quick testing, there seems to be a problem with including multiple fx in the same macro.

I’ve tried t1, target1, and 1. All have the same error. I’ve seen other posts regarding this where the answer is just change the target name and the OP always says “thanks that worked” but I can’t get this to work.

August 19 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter

I tried with several standard fx, first with your 1, 2, and 3, which reported an error.

Then I changed to t1, t2, and t3, and the error vanished. Only one of the fx worked though.

I tried several variations after that, and couldnt get 3 fx to show up, but i wasnt getting the error once i changed the target names from pure numbers.

Can you post your custom fx? There might be something to do with that, though I'm not sure why that would be.


{
"angle": -1,
"angleRandom": 0,
"duration": 15,
"emissionRate": 60000,
"endColour": [166, 145, 189, 0],
"endColourRandom": [0, 0, 0, 0],
"lifeSpan": 20,
"lifeSpanRandom": 0,
"maxParticles": 3000,
"size": 1,
"sizeRandom": 0,
"speed": 60,
"speedRandom": 22,
"startColour": [123, 3, 252, 0.35],
"startColourRandom": [0, 0, 0, 0.25]
}
August 19 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter

Using that and the following macro generates no error for me, and produces a single blast:

/fx agori_eldritch_blast @{target|t1|token_id}
/fx agori_eldritch_blast @{target|t2|token_id}
/fx agori_eldritch_blast @{target|t3|token_id}

The single blast appears to be a general problem with fx - i cant get it to produce the same fx more than once from the same macro.

August 19 (4 years ago)
David M.
Pro
API Scripter

I think the problem is that the beam FX need an origin and a destination token. The following works for me, generating three beams.

/fx agori_eldritch_blast @{selected|token_id} @{target|First Target|token_id}
/fx agori_eldritch_blast @{selected|token_id} @{target|Second Target|token_id}
/fx agori_eldritch_blast @{selected|token_id} @{target|Third Target|token_id}



I think the problem is that the beam FX need an origin and a destination token. The following works for me, generating three beams.

/fx agori_eldritch_blast @{selected|token_id} @{target|First Target|token_id}
/fx agori_eldritch_blast @{selected|token_id} @{target|Second Target|token_id}
/fx agori_eldritch_blast @{selected|token_id} @{target|Third Target|token_id}

That worked! Thank you very much!

August 19 (4 years ago)
GiGs
Pro
Sheet Author
API Scripter

excellent! I havent used fx before, lol.