By the way, i have only the main palette for now (i planned to make others, that's too bad), what is your small script?
I think it was BloodBane who did the empty entity trick first. Anyway, you need to create a new entity called Empty (and LOAD it at models.txt):
name Empty
health 10
type obstacle
shadow 0
anim idle
delay 100
offset 1 1
frame data/chars/misc/empty.gif
anim fall
delay 100
offset 1 1
frame data/chars/misc/empty.gif
This Empty entity can be used to do a plethora of things! From modyfing objects, to players, to the stage, etc. Its just a placeholder. In OpenBOR, we have way more control of the stages than Mugen (we have more control of many other things, as you will see).
So, spawn the placeholder entity at the very start of the stage (its the first thing I spawn on my stage). In older released, to use a script when any entity was spawned, it was needed to use a SPAWNSCRIPT. But since many releases ago, you can use a spawnscript right when you spawn an entity, take a look:
spawn empty
@script
void main()
{
int P1 = getplayerproperty(0, "entity"); // detects the player 1
int P2 = getplayerproperty(1, "entity"); // detects the player 2
void self = getlocalvar("self"); // gets the "self". IOW who will be calling the function
if(P1){ // if the player 1 exists
changeentityproperty(self, "map", 1); // changes the P1 palette
}
if(P2){ // if the player 2 exists
changeentityproperty(self, "map", 1); // changes the P2 palette
}
}
@end_script
coords 180 189 // It doesn't matter, in this case
at 0 // but this matters
If I am not wrong, the default map (palette) is "0", so the map "1" is the second (in your case, the B&W one). That code force the players to change their palettes to another one.
You can even use this trick to revert back to the default palette. OpenBOR knows which is the default color of an entity (Kudos to the OpenBOR coders for that!) if you set one.
Take a look:
spawn empty
@script
void main()
{
int P1 = getplayerproperty(0, "entity"); // detects the player 1
int P2 = getplayerproperty(1, "entity"); // detects the player 2
void self = getlocalvar("self"); // gets the "self". IOW who will be calling the function
if(P1){ // if the player 1 exists
int oPal = getentityproperty(self, "mapdefault");
changeentityproperty(self, "colourmap", oPal); // changes the P1 palette to the default one
}
if(P2){ // if the player 2 exists
int oPal = getentityproperty(self, "mapdefault");
changeentityproperty(self, "colourmap", oPal); // changes the P2 palette to the default one
}
}
@end_script
coords 180 189 // It doesn't matter, in this case
at 0 // but this matters
That code will revert the player palette to its default. You can use it on the start of the next level, or inside a script file like ENDLEVEL.C (more advanced) or even use it on the same stage, just change the AT position to another one.
The options are endless. You can simulate many things with that, like players changing their palettes to match the stage illumination, etc.
Another good usage of that spawnscript right on the stage is the option to spawn any entity with a specific animation:
spawn Soldier
@script void main() {
performattack(getlocalvar("self"), openborconstant("ANI_FOLLOW7"));
} @end_script
coords 360 400
at 50
With that code, I spawn an entity called "Soldier" using the FOLLOW7 animation (he comes flying from the sky). Cool, isn't it?
