Hello Everyone! Kinda new here (especially to the forums!), so if this question has already been asked my apologies. Onto the question! Is there a simple way to tell if a token is controlled by a player? A use case example would be the " Bloodied and Dead Status Markers ". In it, a token get a red X if their health (bar) reaches zero or lower. In my game though, I'd rather make it only effect the monster token's, as the players don't die but instead go "unconscious". Afterwords, I could also add an "If Else" rule that adds a different marker on my player tokens instead of the red X. Any Idea how to write this one out? Thanks! TLDR: Check if token is a player before adding markers. -------------- Update! After a little bit of help from DXWarlock & The Aaron , I was able to find my answer! Below you'll see the finished code. It's just a simple script based off " Bloodied and Dead Status Markers ", but now it has a nested IF statement that quickly checks if the selected token is a "Player" or "Monster"! It should be easy to copy and change things around enough now to change it more to your personal preference, but for now I'm happy with it! You can find the different names for the status icons here ! (Thanks Aaron!) Let us know if you find any bugs or have any idea's to make it even better! Thanks again for everyone's help! // Original: Bloodied and Dead Status Markers.js
// Github: <a href="https://github.com/Roll20/roll20-api-scripts/tree" rel="nofollow">https://github.com/Roll20/roll20-api-scripts/tree</a>...
// by: Ken Bauer
// Contact: <a href="https://github.com/Roll20/roll20-api-scripts/tree" rel="nofollow">https://github.com/Roll20/roll20-api-scripts/tree</a>...
// Special thanks too The Aaron & DXWarlock for changes
on("change:graphic", function(obj) {
//if bar is empty, exit script
if(obj.get("bar3_max") === "") return;
//if bar is 0 or less
if(obj.get("bar3_value") <= 0) {
//Set Token data onto oCharacter
//Set Monster or Player onto Type
var oCharacter = getObj('character', obj.get("_represents"));
var type = (oCharacter.get("controlledby") === "") ? 'Monster' : 'Player';
//Check if Token is a Monster
if(type == 'Monster') {
//add dead status onto token
obj.set("status_dead", true);
}
//Check if Token is a Player
if(type == 'Player') {
//add sleepy status onto token
obj.set("status_sleepy", true);
}
}
//if anything else
else {
//remove sleepy status onto token
obj.set("status_sleepy", false);
//remove dead status onto token
obj.set("status_dead", false);
}
});