character.RemoveTint will crash a game if called when a character has no tint (in 2.72). Is there any way to tell if a character is tinted?
Or a way to test if RemoveTint will crash the game, then not run it (like testing for null or something)?
// script header
import function Tnt(this*Character, int red, int green, int blue, int saturation, int luminance);
import function RemTnt(this*Character);
// global script
int tinted[];
tinted = new int[Game.CharacterCount]; // this line inside game_start!
function Tnt(this*Character, int red, int green, int blue, int saturation, int luminance) {
tinted[this.ID] = true;
this.Tint(red, green, blue, saturation, luminance);
}
function RemTnt(this*Character) {
if (!tinted[this.ID]) return;
this.RemoveTint();
tinted[this.ID] = false;
}
EDIT: removed redundant export line.
Thanks!
[edit after trying it:]
So basically there is no internal way to tell if a character is tinted. So we need to keep a record every time 'tint' is used. Fair enough.
Correct, afaik. I guess a Character.Tinted property sounds like a reasonable request though.