Handling 3/4players screen boundary bug??

White Dragon

New member
How can I set the screen boundaries without bugs?
2 players are handled fine by OpenBOR but when there are 3 or 4 players on screen, if two players go forward and the other players (3p and 4p) are left behind, they come out of the screen ... How to set good screen boundaries?
immaginervp.png
 
Not much you can do to the engine itself (though apparently we need to look into it). OTH, you clearly know some script, so you could go that route. One trick might be to check stop movement progress if any two players separation > screen size.

DC
 
Would be nice if that movement stop would be hardcoded, i think it was forgotten.When playing 2 player game then you cant go forward if player 2 is not moving, same should be with all 4 players.Now player 3 and 4 behave like NPC's in this situation.
 
bWWd said:
Would be nice if that movement stop would be hardcoded, i think it was forgotten.When playing 2 player game then you cant go forward if player 2 is not moving, same should be with all 4 players.Now player 3 and 4 behave like NPC's in this situation.

I think that is the problem because the engine actually calculates more than 2 players.  ;)

It should calculate only 2 players when there are more than 2, the left most one and the right most one.

 
Here's how I solved:

Put 2 scripts:
script data/scripts/player_script.c
onblocksscript data/scripts/screen_boundary.c

so in script data/scripts/player_script.c cast this function:
Code:
int check_zmax_distance(void self) {

    if ( openborvariant("in_level") ) {
        int zmax = openborvariant("vresolution")-140;
        int z = getentityproperty(self, "z");

        // Cerchiamo la distanza minima in z
        int zmin = NULL(), p;
        for (p = 0; p < 4; ++p) {
            void partner = getplayerproperty(p, "entity");

            if ( getentityproperty(partner, "exists") && partner != self ) {
                if ( zmin == NULL() ) zmin = getentityproperty(partner, "z");
                else if ( zmin < getentityproperty(partner, "z") ) zmin = getentityproperty(partner, "z");
            } else continue;
        }

        if ( zmin != NULL() ) {
            int pindex = getentityproperty(self, "playerindex");
            if ( z-zmin > zmax && playerkeys(pindex,0,"movedown") == 32 ) { // Se la distanza tra il player corrente e quello che sta più su è maggiore di...
                int x = getentityproperty(self, "x");
                int a = getentityproperty(self, "a");
                changeentityproperty(self, "position", x, zmin+zmax, a);
            } else if ( zmin-z > zmax && playerkeys(pindex,0,"moveup") == 16 ) {
                int x = getentityproperty(self, "x");
                int a = getentityproperty(self, "a");
                changeentityproperty(self, "position", x, zmin-zmax, a);
            }
        }

    } // fine if in_level

}

and in onblocksscript data/scripts/screen_boundary.c put:
Code:
void main() {
    changelevelproperty("cameraxoffset", getlevelproperty("cameraxoffset") );
}

It seems to work well...
 
Back
Top Bottom