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

[request/assistance/info] deleting selected or targeted token if computed value is less than 0

I'm having a very hard time trying to understand wether what I want to accomplish can be done with available scripts or it's a complete nightmare.. here is the scenario:     1 - I run a macoro on a targeted token reading and altering its bar1 value, lets say bar1 = bar1 - X     2 - IF bar1 results in 0 or less (I know hot to do it, returning 1 for true and 0 for false ), my missing function kicks in      3 - now my function needs to delete the very same token and ONLY that one in the entire game (thus not using its linked character). I was thinking I could crack it in different ways: 1 -  just a magic script that deletes the token based on the T or F value I pass to it within the mcaro. 2 -  use something to just move it to the GM layer or another map entirely if T. 3 -  use token mod to move the token on the page on coords computed with the T or F (so F doesnt actually move it on the map, and T places it in a trigger zone) and then use Its a Trap or teleport or whatever to move it to GM layer. This is the least desirable solution. Any help appreciated  
1640270719
The Aaron
Roll20 Production Team
API Scripter
I don't know if a script that will do this right now, but it could be a fairly simple one-off. A script that deletes a selected token if one of its bars is zero or less would be about a dozen lines. 
1640304216
Oosh
Sheet Author
API Scripter
What's the end goal? It sounds like you're trying to avoid GM clutter from dead NPC's, is that right? Do you want to apply the big red X ('dead' marker) and move it to the map layer so the corpse is visible, but unclickable for the GM? If the X is too jarring, applying a white tint and shifting it to the map layer is another option. Deleting it is the simplest option, though these other ones are still pretty straight-forward (especially if Aaron writes it, since, you know.... tokenMod). Personally, as a player, I like corpses. They're a good reference point when backtracking through an area. "Oh, a decapitated manticore! I remember this cave, it's the one where the barbarian got upset."
I believe SmartAOE can do this for tokens that have their bar dropped to zero after applying area of effect damage.
1640527555

Edited 1640527629
Oosh said: What's the end goal? It sounds like you're trying to avoid GM clutter from dead NPC's, is that right? The goal would be to delete a token, representing a certain item, after beeing consumed (the quantity value updates in the bar). I've had a little visual inventory system in mind for a long time.  (Btw I'll move my corpses on map layer when donee with on a regular basis from now on! it makes sense!) Here is a gif showing the process. There's a needs system here as well, water need is the blue bar, and the green statusmarker on tokens is the quantity of that type of object. Thisi is accomplished with tokenmod for altering the item token  (bicchiere d'acqua=glass of water) and chatsetattr to alter the character. as tested before, token mod can move the token when its quantity reaches less than 0 but this is where I'm stuck at. the next step on the list would be either removing the token directly or move it on another map; here are my considerations: - teleport script works on a character basis and it's meant to navigate players between maps, not tokens; but it could be somehow a solution because it would move the "marked for delete" token to GM layer, so hiding it from players, decluttering the screen and giving the sense of item consumption. - I tired installing both itsatrap and smart aoe but I still cant seem to set up any of those; I'd be glad if anyone could tell me how to:     a) set up a simple trap that deletes the token on contact or, even better, moves it to another map at specific coordinates. (still unable to  launch any generic script nor tokemod with itsatrp,sigh)     b) set up smartaoe to have it, again, delete or move token between maps (I dont seem to get how this one works at all) Sorry for the late answer and happy winter holydays! EDIT:  All thing considered, other than the item consumption step, my inventory system would need an API script able to move a  Token  from one map to another and a way to activate it both with a macro/chat command and on token contact like a trap
1640533692
David M.
Pro
API Scripter
FYI SmartAoE is an Area of Effect approximation, targeting, and execution script that can perform "group" rolls (e.g. saving throws) to tokens within the area, applying damage and/or status markers to affected tokens based on those rolls. One of the script options will delete the token(s) if the applied "damage" takes a given bar value to 0. Doesn't sound like this script would be the best fit to your specific application. 
1640623650
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
If moving dead opponents to the map layer, be aware that token markers (the red X, for example) will not display. Tinting it white or turning it upside down before switching its layer might be a better option to visually indicate its status.
keithcurtis said: If moving dead opponents to the map layer, be aware that token markers (the red X, for example) will not display. Tinting it white or turning it upside down before switching its layer might be a better option to visually indicate its status. FWIW I see token markers appearing on tokens on the map layer (incl. the red X).
1640642344
GiGs
Pro
Sheet Author
API Scripter
Jim R. said: keithcurtis said: If moving dead opponents to the map layer, be aware that token markers (the red X, for example) will not display. Tinting it white or turning it upside down before switching its layer might be a better option to visually indicate its status. FWIW I see token markers appearing on tokens on the map layer (incl. the red X). are you a player or the GM?
Either GM or dummy account player, I can see markers on tokens on the map layer. Never mind though, I must be misunderstanding the problem stated by Keith.
1640648216
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
Either something changed, or (more likely) I am misremembering.
1640661765
Oosh
Sheet Author
API Scripter
Changing a marker on the map layer doesn't update for players AFAIK, but setting it and then moving it to the map layer is fine.
Thank you all for the responses, my needs seem to be more specific than I thought, I shall close this topic and move on with more focused questions.