Palette script

I want to use a script found in zvitors mfa2 mod to match a projectile to the players current palette but I'm not sure how to write the script in the projectiles text file. How should I adapt it to a different character?

here's the script
Code:
void paleta(int Pal)
{// 
    void self = getlocalvar("self"); //Get calling entity.
    int oPal = getentityproperty(self, "mapdefault");

    if (Pal > 0){
	changeentityproperty(self, "colourmap", Pal);
   }
	else{
changeentityproperty(self, "colourmap", oPal);

and here's an example of the script in one of black panthers projectiles
Code:
@script
	void self = getlocalvar("self");
	int cor = getglobalvar("palBlack");
       	changeentityproperty(self, "map", cor);
	@end_script
 
The best answer is: Don't.

If your projectile and main entity have matched color tables you don't need to bother with map numbers. OpenBOR allows you to get the color table itself from one entity and apply it directly to another. Just like tinting vs. mapping, it takes more understanding up front but saves a ton of work in the long term.

I posted an example some time back - maybe I can add it to demo later on.

DC
 
Back
Top Bottom