tunnel level problem

jonsilva

New member
hello
iam trying to make a 2d level like the contra levels
the panel has a 2300 x 2500
the level Z is 3323 3323


level.jpg


i wanted to spawn the player in altitude on top of a wall
then seperate the rest of the level with walls
making the player move on top of the walls through the end of the level

iam having trouble spawning the player at the begining of the level
then i dont know if i can use walls to seperate the level area
making him move back / foward and fall down

Is it possible to make this kind of level in OpenBOR ?

 
If utunnels don't update walls, your only choice is platform cause that's the only way to make floating blocking area. Walls can't be floating.

Anyways, this kind of level is possible in OpenBoR BUT there are couple aspects you must decide:
1. How to end level
Almost every platformer I played ends the level by touching exit. I hope you have set this exit cause you can't force player to defeat every single enemy in this level. There is always possibility of skipping certain enemy in this level
2. Respawn point
Where would player be respawned if player is killed in certain point? yes, it's a question you have to answer
I have script in player's RESPAWN in Contra mod to control where player would be respawned. I set different "answer" to that question in different vertical level.
TBH I'm still thinking best way to answer that question when 2 players are playing
If you don't answer this question, player might ended up respawning in wrong place.

iam having trouble spawning the player at the begining of the level

Set this:
spawn empty
@script
void main()
{
    int P1 = getplayerproperty(0, "entity");
    int P2 = getplayerproperty(1, "entity");

    if(P1){
      changeentityproperty(P1, "position", 40, 3323, 2000);
    }
    if(P2){
      changeentityproperty(P2, "position", 40, 3323, 2000);
    }
}
@end_script
coords 660 3323
at 0

This script changed where player 1 & 2 would start, to be exact, it will put both players at x = 40, y = 2000 and z = 3323. You need to adjust x and y again but z is correct.
This script only works for players who have joined the game however. It doesn't work for players who join later.

We need to discuss this further
 
thanks bloodbane the spawn script worked for plr1

i got the level working by spawning platforms
with the follow animation
spawn  ventplats
@script void main() {
  performattack(getlocalvar("self"), openborconstant("ANI_FOLLOW4"));
} @end_script
coords  100 3323 440
at      0


spawn  ventplats
@script void main() {
  performattack(getlocalvar("self"), openborconstant("ANI_FOLLOW5"));
} @end_script
coords  -40 3323 455
at      0

spawn  ventplats
@script void main() {
  performattack(getlocalvar("self"), openborconstant("ANI_FOLLOW4"));
} @end_script
coords  2200 3323 200
at      0



spawn  ventplats
@script void main() {
  performattack(getlocalvar("self"), openborconstant("ANI_FOLLOW5"));
} @end_script
coords  880 3323 268
at      0

-----ventplats-----//-----
name ventplats
type none
shadow 0
nolife 1
facing 1
nomove 1 1
subject_to_wall 0
subject_to_platform 0
subject_to_gravity 0
offscreenkill         9000

anim fall
offset 110 275
bbox 0 0 0 0
frame data/bgs/56lvl/bck/empty.gif

anim follow1
loop 0
delay 1000
offset 100 55
bbox 0 0 0 0
platform -70 60 60 60 270 270 20 30
frame data/bgs/56lvl/bck/empty.gif

anim follow2
loop 0
delay 1000
offset 300 55
bbox 0 0 0 0
platform -10 60 60 60 550 550 20 30
frame data/bgs/56lvl/bck/empty.gif

anim follow3
loop 0
delay 1000
offset 300 55
bbox 0 0 0 0
platform -10 60 -110 -110 1800 1800 20 30
frame data/bgs/56lvl/bck/empty.gif

anim follow4
loop 0
delay 1000
offset 25 315
bbox 0 0 0 0
platform 0 330 0 0 50 50 30 310
frame data/bgs/56lvl/bck/empty.gif




anim follow5
loop 0
delay 1000
offset 300 55
bbox 0 0 0 0
platform -10 60 -110 -110 2400 2400 20 30
frame data/bgs/56lvl/bck/empty.gif







anim idle
loop 0
delay 5
offset 25 315
bbox 0 0 0 0
platform 0 330 0 0 50 50 30 310
frame data/bgs/56lvl/bck/empty.gif

anim spawn
loop 0
delay 1
offset 100 55
bbox 0 0 0 0
platform -70 60 60 60 270 270 20 30
frame data/bgs/56lvl/bck/empty.gif

#|edited by openBor Stats v 0.53


This script only works for players who have joined the game however. It doesn't work for players who join later.

yes the plr2 spawns offscreen i think hes spawning in the upper corner were plr1 spawned but when i reach the bottom z (3323) of the level
he spawns there...

ive checked the contra respawn
anim respawn
@script
    void self = getlocalvar("self");
    int x = getindexedvar(0); //Get respawn x coordinate
    int z = getentityproperty(self,"z"); //Get character's z coordinate
    int a = getindexedvar(1); //Get respawn a coordinate

    if(x==NULL()){
      x = getentityproperty(self, "x");
    }

    setentityvar(self, 7, NULL());
    if(a!=NULL()){
      if(frame > 0){
        changeentityproperty(self, "position", x, z, a);
      }
    }
@end_script
delay  1
jumpframe 1 1 0 0
offset  47 69
frame data/chars/bill/drop.png
delay  40
sound data/chars/bill/ready.wav
frame data/chars/bill/drop.png

-------------//------------

name Respawn
type none
shadow 0
antigravity 100


anim idle
@script
    void self = getlocalvar("self");
    int x = getentityproperty(self,"x");
    int a = getentityproperty(self,"a");

    setindexedvar(0, x);
    setindexedvar(1, a);
    killentity(self);
@end_script
loop 1
delay 5
offset 1 1
frame data/chars/misc/empty.gif

i still havent made enemies for this level to figure out the respawn...
can you tell me how the respawn is working ?
does the player respawns in the nearest respawn entity..?
 
can you tell me how the respawn is working ?
does the player respawns in the nearest respawn entity..?

The answer to 2nd question is no.
For 1st question, Respawn entity defines respawn coordinates for certain player i.e respawn1 for player1 and respawn2 for player2.
They define respawn coordinates once so if another respawn entities were spawned, previous coords will be overriden.
Respawn entities simply take their coordinates and store them in global variable (for storing respawn coordinates).

Just to let you know, respawn entities are obsolete by ability to write script directly in level.

For descending levels like your, I have checkpoint entity which sets respawn coords if touched by player. This checkpoint entity is placed in certain altitudes
 
thanks the checkpoint is working great

iam using this attack script for all entities in the level its the same than @cmd attack1 but it checks altitude instead
but i think theres one altitude value that is not working very well

@cmd attack2
void attack2(int RxMin, int RxMax, int RaMin, int RaMax, void Ani)
{// Attack interruption with range check
    void self = getlocalvar("self");
    void target = findtarget(self); //Get nearest player
    float x = getentityproperty(self, "x");
    float a = getentityproperty(self, "a");
    int dir = getentityproperty(self, "direction");

    if(target!=NULL()){
      float Tx = getentityproperty(target, "x");
      float Ta = getentityproperty(target, "a");
      float Disx = Tx - x;
      float Disz = Ta - a;



      if( Disx >= RxMin && Disx <= RxMax && Disz >= RaMin && Disz <= RaMax && dir == 1) // Target within range on right facing?
      {
        performattack(self, openborconstant(Ani)); //Change the animation
      } else if( Disx >= -RxMax && Disx <= -RxMin && Disz >= -RaMin && Disz <= -RaMax && dir == 0) // Target within range on left facing?
      {
        performattack(self, openborconstant(Ani)); //Change the animation
      }
    }
}

i still cant figure a way to solve the plr2 spawning in level after the beginning...
could it be done by adding script to the spawn anim like the respawn anim for the checkpoint ?
i have the level set to (setweap  10) so i wont affect the original character
 
...else if( Disx >= -RxMax && Disx <= -RxMin && Disz >= -RaMin && Disz <= -RaMax && dir == 0) // Target within range on left facing?
      {...

You have to remove the minuses (marked by red).

i still cant figure a way to solve the plr2 spawning in level after the beginning...

I'm not sure about that myself but I think that you need to take camera's position and adjust it with some formula before using the value for respawn point.
 
thanks

ive removed the (-) from the else if but i think... there is still one (a) value he doesnt detect

checkpoint detects player up
@cmd attack2 -130 130 -50 50 "ANI_FOLLOW1"

grenade spawner detects player down
@cmd attack2 -250 250 -220 0 "ANI_FOLLOW1"

i have one checkpoint in the level that doesnt disapears when the player falls down and touchs it... also it doesnt disapears when the player is below it....
iam pretty confused so i cant explain very well....


the level spawning point is a bit diferent from the drawing above

exempl.jpg



i couldnt make a platform in that angle so ive made a move in player spawn anim so he could move and fall down

anim spawn
loop 0
delay 200
offset 121 165
bbox 0 0 0 0
landframe 1
frame data/chars/1ryo/de05.gif
delay 10
@cmd dasher 1.4 0 0
frame data/chars/1ryo/ju02.gif
frame data/chars/1ryo/ju03.gif
frame data/chars/1ryo/ju04.gif
frame data/chars/1ryo/ju05.gif
frame data/chars/1ryo/ju06.gif
frame data/chars/1ryo/ju03.gif
frame data/chars/1ryo/ju04.gif
frame data/chars/1ryo/ju05.gif
frame data/chars/1ryo/ju06.gif
delay 230
frame data/chars/1ryo/th02.gif

anim walkoff
loop 0
delay 12
offset 121 201
bbox 101 111 39 84
@cmd stop
frame data/chars/1ryo/ju07.gif

i think the way of making the PLR2 spawn i simple have to add the respawn script to spawn anim
anim respawn
@script
    void self = getlocalvar("self");
    int x = getindexedvar(0); //Get respawn x coordinate
    int z = getentityproperty(self,"z"); //Get character's z coordinate
    int a = getindexedvar(1); //Get respawn a coordinate

    if(x==NULL()){
      x = getentityproperty(self, "x");
    }

    setentityvar(self, 7, NULL());
    if(a!=NULL()){
      if(frame > 0){
        changeentityproperty(self, "position", x, z, a);
      }
    }
@end_script
delay  1
offset 121 201
bbox 0 0 0 0
frame data/chars/1ryo/de06.gif
delay  40
frame data/chars/1ryo/de06.gif


but add a line of code that detects if the player joins the level and changes the spawn anim to respawn anim so it doesnt make that fall move in the benning of the level...

the PLR1 touches the checpoint right after spawnning in the level.... so PLR2 would spawn there with respawn anim if he joins the level...
if PLR2 is already entering the level from previous level he would make spawn anim with the fall move....
is it possible to make it like this...??
or is there a better way...? 
 
Back
Top Bottom