Solved Revert to default palette

Question that is answered or resolved.

O Ilusionista

Captain 100K
I've made to small functions to change the player palette - one to change to a specific palette and one to revert it back

Code:
void changepal(int Pal)
{// change the current pallete
// O Ilusionista - 20/11/2013
    void self = getlocalvar("self"); //Get calling entity.
    int oPal = getentityproperty(self, "mapdefault");
changeentityproperty(self, "map", Pal);
}

Code:
void resetpal()
{// revert to original palette
// O Ilusionista - 20/11/2013
    void self = getlocalvar("self"); //Get calling entity.
    int oPal = getentityproperty(self, "mapdefault");
	changeentityproperty(self, "map", oPal);
}

But the last one isn't workin while in animscript. If I past the same code on a didhitscript, it works.

Any clue of what is going on?

Edit:
Solution by White Dragon:

Code:
void changepal(int Pal)
{// change the current pallete
// O Ilusionista - 20/11/2013
    void self = getlocalvar("self"); //Get calling entity.
    changeentityproperty(self, "map", Pal);
}

void resetpal()
{// revert to original palette
// O Ilusionista - 20/11/2013 - Thanks White Dragon!
    void self = getlocalvar("self"); //Get calling entity.
    changeentityproperty(self, "map", 0);
}
 
Isn't it because no 0 set for reverting to the default map?

Code:
changeentityproperty(self, "map", 0);
 
Setting 0 will make it revert to the first palette, not the default one. Think in case where I choose the player with pal 2 - I want to revert back to this palette.

This is my antivenon code. It works perfectly in didhitscript and its the same code:

Code:
void main()
{// anit-venon script
    void self = getlocalvar("self"); //Get calling entity.
    void Health = getentityproperty(self,"health");
	int Type = getlocalvar("attacktype");
    int oPal = getentityproperty(self, "mapdefault");
	if(Type == openborconstant("ATK_NORMAL4")){
	changeentityproperty(self, "map", oPal);


		
		if (Health > 0){
		  changeentityproperty(self, "dot", 1, "owner", self);
          changeentityproperty(self, "dot", 1, "force", 1);
          changeentityproperty(self, "dot", 1, "mode", 4);
          changeentityproperty(self, "dot", 1, "rate", 80);
          changeentityproperty(self, "dot", 1, "time", 1600);
		}
	}

}
 
Reading the manual, it says:

changeentityproperty(entity, propname, values)
"map" - Current color remap in use. 0 = default, 1 = first remap, and so on.

But when I use this code, it reverts to the first palette, not the palette the player was choose with.

Why defaultmap doesn't works?
 
Hola O'!
Tested your code.
It works to me in animationscript and in takedamage and everywhere!
This isn't a proper script... better is a wrapper.

BTW the right wrappers are:

Code:
void changepal(int Pal)
{// change the current pallete
    void self = getlocalvar("self"); //Get calling entity.
    changeentityproperty(self, "map", Pal);
}

void resetpal()
{// revert to original palette
    void self = getlocalvar("self"); //Get calling entity.
    changeentityproperty(self, "map", 0);
}
 
really?
So there is something really wrong at my game :(

edit: I tested it again. If I just use RESETPAL after the palette changed under a takedamage, it works.
But if the palette was change by script, it doesn't works.
 
O Ilusionista said:
really?
So there is something really wrong at my game :(

see right wrappers:

Code:
void changepal(int Pal)
{// change the current pallete
    void self = getlocalvar("self"); //Get calling entity.
    changeentityproperty(self, "map", Pal);
}

void resetpal()
{// revert to original palette
    void self = getlocalvar("self"); //Get calling entity.
    changeentityproperty(self, "map", 0);
}
 
Thanks WD, now it works. The manual said map 0 is the default one, but last time it wasn't working.
What is the difference between use map 0 and "defaultmap"?
 
Hola O'!
Tested your code.
It works to me in animationscript and in takedamage and everywhere!
This isn't a proper script... better is a wrapper.

BTW the right wrappers are:

Code:
void changepal(int Pal)
{// change the current pallete
    void self = getlocalvar("self"); //Get calling entity.
    changeentityproperty(self, "map", Pal);
}

void resetpal()
{// revert to original palette
    void self = getlocalvar("self"); //Get calling entity.
    changeentityproperty(self, "map", 0);
}
I know this is an old topic, but I am now working on this and it is not working for me.
changeentityproperty(self, "map", 0);
Please correct me if I am wrong, this actually changes to the palette 0, not the palette that was chosen during the char selection screen.


Code:
palette         data/chars/players/pal/pal01.gif #0   //changeentityproperty(self, "map", 0);  will change to this palette
alternatepal    data/chars/players/pal/pal02.gif #1
alternatepal    data/chars/players/pal/pal03.gif #2
alternatepal    data/chars/players/pal/pal04.gif #3
alternatepal    data/chars/players/pal/pal05.gif #4
alternatepal    data/chars/players/pal/pal06.gif #5
Basically, it doesn't matter which color I selected, this changeentityproperty(self, "map", 0); will change to palette #0

Thank you
 
Back
Top Bottom