Solved change the color palette

  • Thread starter Thread starter Naota
  • Start date Start date
Question that is answered or resolved.
N

Naota

Guest
is there a script that changes the color palette according to the quantity of life?




 
Save this text as life.c

Code:
void main()
{
	// Change entity map based on its life
	// Douglas Baldan - 02/08/14
	void self = getlocalvar("self");
        void health = getentityproperty(self,"health"); //get health
	void maxhealth = getentityproperty(self,"maxhealth"); //get health

	if (health<=maxhealth/2 && health >maxhealth/4)// checks if the health is 50% or less
	{
		changeentityproperty(self, "map", 2); //Set map.
	}
		
	if (health<=maxhealth/4)// checks if the health is 25% or less
	{
		changeentityproperty(self, "map", 3); //Set map.
	}
		

}

then you should declare it as script (and not animation script) as takedamagescript:

takedamagescript data/scripts/life.c

It will make you change to map 2 if life is 50% or map 3 if life is 25%
 
I believe it's best to declare this script as takedamagescript instead. Palette change occurs only couple times (as many as palettes to be used) so there's no need to use update script for this purpose

OTOH use update script if the color change is script based
 
If I may, why change color palette at all? OpenBOR supports tinting. Instead of bothering with "almost dead" palettes and such, just tint them red or whatever other mix of your choice. Not only would it mean less work, it will also be more dynamic. The character will have a red tint but still retain the unique look of their original palette.

I tried it out for burn and shock effects - it was so easy I'll never go back to effect palettes again.

DC
 
Because tint would affect all the colors on the palette, where (if I am not wrong) he wants to make the skin to change color. Kinda like in Samurai Shodown.
 
Right, but unless the character has an extra near dead alternate map for every single available color selection and is scripted accordingly the clothes are going to change anyway.

DC
 
No, let me show you:
KqrtR9k.png


I can be way more selective using map. But if the idea is to make all the char to be tinted with red (even the clothes), so yes, tint is better.
 
No no, I get you on the clothes bit. What I'm saying is, think of what happens if Ryu has more than one color selection from the start. Let's say he just has two - white and charcoal. You now have to make a red skin palette for the charcoal gi too, and make sure the script switches to it when needed. If you don't, well it's pretty obvious what's going to happen.

Rinse and repeat for each added color selection. Not a problem if you don't mind doing that, it's just something to keep in mind.

DC
 
Back
Top Bottom