mtrain there is command to change fglayer by script
Code:
changelayerproperty("fglayer", layer_index, "enabled", 1);
The "layer index" is the order of all elements you put on the stage - yes, the order matters in this case.
As DC explaine to me before:
So the first fglayer is always index 0, the next is index 1, and so on.
each "type" of layer has its own count.
So if the 3rd fglayer, from the top of the file, is the one you wanna change, its index is 2.
Just pay attention to this:
each "type" of layer has its own count.
So if you have:
background (...)
bglayer (...)
bglayer (...)
fglayer (...)
That fglayer index will be 0 and not 3, because its the first fglayer count index.
You can "changelayerproperty" every single property of a fglayer.
Damon Caskey made a script for animating fglayers by script https://gist.github.com/DCurrent/bf4ad635b78ca1e64d73474af1f848a9?fbclid=IwAR0wszHfuQZH5Y18-Yr2sUj_Og3IBrvQFiXh7sV_mj9oM--B9DC3OpHs4DY
fglayer is completely different than frontpanel BTW.
Bloodbane inside the engine, everything is a fglayer - even "background". All "types" are just nicknames to fglayer settings.
The engine will parse those nicknames and change some settings according to it.
Take a look at the source:
Code:
case CMD_LEVEL_BACKGROUND:
case CMD_LEVEL_BGLAYER:
case CMD_LEVEL_LAYER:
case CMD_LEVEL_FGLAYER:
__realloc(level->layers, level->numlayers);
bgl = &(level->layers[level->numlayers]);
if(cmd == CMD_LEVEL_BACKGROUND || cmd == CMD_LEVEL_BGLAYER)
{
i = 0;
bgl->z = MIN_INT;
}
else
{
i = 1;
bgl->z = GET_FLOAT_ARG(2);
if(cmd == CMD_LEVEL_FGLAYER)
{
bgl->z += FRONTPANEL_Z;
}
}
If the engine reads "background", it sets that fglayer z to MIN_INT. If it reads "fglayer", it will set the Z to FRONTPANEL_Z
(a lot of things are tied with each other. FRONPANEL_Z is PLAYER_MAX_Z+50, for example)
As it reads the "nickname", it will set that layer to the desired type
Code:
if(cmd == CMD_LEVEL_BACKGROUND)
{
if(bgPath[0])
{
errormessage = "Background is already defined!";
goto lCleanup;
}
value = GET_ARG(1);
strcpy(bgPath, value);
bgl->oldtype = BGT_BACKGROUND;
}
else if(cmd == CMD_LEVEL_BGLAYER)
{
bgl->oldtype = BGT_BGLAYER;
}
else if(cmd == CMD_LEVEL_FGLAYER)
{
bgl->oldtype = BGT_FGLAYER;
}
else if(cmd == CMD_LEVEL_LAYER)
{
bgl->oldtype = BGT_GENERIC;
}
and sets some default values, like ratio.x and ratio.z
Code:
if((GET_ARG(i + 2))[0] == 0)
{
bgl->ratio.x = (cmd == CMD_LEVEL_FGLAYER ? 1.5 : 0.5);
}
if((GET_ARG(i + 3))[0] == 0)
{
bgl->ratio.z = (cmd == CMD_LEVEL_FGLAYER ? 1.5 : 0.5);
}
I should put this on the manual soon.