fglayer changer

mtrain

New member
Is it possible to change xratio of fglayer (bglayer) in level reaching a definite coordinate, and is it possible to add bglayer or remove it at the same way, for example, in level#.txt

fglremover "fgl1"
at 1600

fgladd "fgl2" {path} z {xratio} {zratio} {xposition} {zposition} {xspacing} {zspacing} {xrepeat} {zrepeat}{transp} {alpha}
at 2600

fglchange "fgl3" {path} z {xratio} {zratio} {xposition} {zposition} {xspacing} {zspacing} {xrepeat} {zrepeat}{transp} {alpha}
at 3600

So when player reach 1600, fgl1 removes, when 2600 fgl2 will appear with defined parameters, and when 3600 fgl3 parameters will become a new defined.

Thank you!
 
You don't need new command for this. fglayer is already limited by default IOW xrepeat parameter defines how many time it is displayed.

So if you want it to end at 1600, you have to measure its length and display it certain times so at 1600, it's no longer displayed
If you want fglayer to start at 2600, you need to set xposition to 2600, so does for one at 3600.

fglayer is completely different than frontpanel BTW.
 
So if you want it to end at 1600, you have to measure its length and display it certain times so at 1600, it's no longer displayed
If you want fglayer to start at 2600, you need to set xposition to 2600, so does for one at 3600.

I need a command or script that will instantly add or remove, or change the parameters of fglayer or bglayer. For example in water level i will set a starting speed of water bglayer with xratio, but in the middle i need to reduce or intense the speed of it, or instantly add a new layer with decoration, or remove existing, when, saying player reach a new area, maybe trees or rocks at the background, or when he enter a tunnel and after tunnel bg instantly changes. So with standard xposition i cant achieve that.

This feature and entity that checks 2 players, is 2 most important things for me now, because of them i must choose in which way i must draw some levels.
 
Level that will combine riding on bike (jetski) and regular walking. Like in Contra Hard Corps, when level starts from bike riding and then bike transforms into another vehicle. I already have all to make that, i have make tests so all works fine, except some problem that bring moment of 1p mode becoming 2p or 2p mode becoming 1p. But about them i have wrote in another topic. So here i want is to make a decorations changing. As i wrote imagine that players ride on a road and then enter a long tunnel, in this moment i need to instantly remove some bglayers or fglayers, and spawn another instead.
 
For transition from regular road to in tunnel, it's simple. Just use tunnel background spawner and have it spawn tunnel forever until it is turned off.

But for transition from pseudo travel to regular mode, that's tough. However, I'll be using background spawner as above for this.
 
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.
     
 
Back
Top Bottom