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

Is there a way to send all instances of a token to the map layer?

Hey, I was using Corpse Cart, and I started wondering if there was a way to bury all instances of a given token like that mod does, but with a summoned blood splatter?  I wrote a macro to spawn an animated blood spatter as I kill a token (unfortunately I still need to manually activate its animation), but and I was looking for a way to bury it with the corpse when carting it all away. Does anyone here know how I'd need to modify the script to bury all instances of a specific token? I've created a Rollable Table and assigned it to a specific NPC character sheet, but I'm new to the scripting side of Roll20 and have no idea how I would search for all instances of a given token. Any suggestions?
1662583993
timmaugh
Forum Champion
API Scripter
If you are coding this in JS yourself, you'll just need to use the findObjs() function and filter the results down to the tokens you want to remove. The actual mechanic will depend on what you call "all instances"... is that by name or by source image... or something else? I *think* you're looking to get rid of all blood-spatters at the same time that Corpse Cart removes the tokens that have been marked dead. If so, I think you're fine to operate as a "whenever I bury or delete a corpse, I want to remove all blood spatters". And if you're fine with that, you'd want to modify the 2 functions deleteCorpses() and buryCorpses() at lines 170 & 176 (as the code sits at this link ). Add something like: findObjs({type: 'graphic', subtype: 'token', pageid: body.get('pageid')})     .filter(t => t.get('imgsrc') === 'your URL for the token art here')     .forEach(t => t.remove()); caveat: air-coded That should get rid of anything on the page shared with the token that is getting collected that is using that token splatter artwork (provided you put the right URL in).