Solved Player join interaction

Question that is answered or resolved.

maxman

Well-known member
While using skipselect in the levels.txt with a player character, how can I make it play a different spawn animation instead of just using anim spawn? For instance, the player Cody is in skipselect as player 1. I know he can perform anim spawn or anim respawn in levels every time he has it. But what about changing it to one of the different (re)spawning animation(s) such as anim follow1?
 
Solution
Just figured out and started adding levels and set(s), as well as a few #defines (in case (for myself) of avoiding redundancy). I set certain custom intros in certain levels. (You really don't have to add #defines though, but it's your choice.) It works really great. I don't have to add a level spawn script tag in the level txt unless I use skipselect to the select screen or go without skipselect, or there is something necessary to do with it.

Code:
#define RESPAWN openborconstant("ANI_RESPAWN") //#define {any_name_for_the_value} {value}
#define SPAWN openborconstant("ANI_SPAWN")

void main(){
    void self = getlocalvar("self");
    void aniID = getentityproperty(self, "animationid");
    int set = openborvariant("current_set");
    int...
Just figured out and started adding levels and set(s), as well as a few #defines (in case (for myself) of avoiding redundancy). I set certain custom intros in certain levels. (You really don't have to add #defines though, but it's your choice.) It works really great. I don't have to add a level spawn script tag in the level txt unless I use skipselect to the select screen or go without skipselect, or there is something necessary to do with it.

Code:
#define RESPAWN openborconstant("ANI_RESPAWN") //#define {any_name_for_the_value} {value}
#define SPAWN openborconstant("ANI_SPAWN")

void main(){
    void self = getlocalvar("self");
    void aniID = getentityproperty(self, "animationid");
    int set = openborvariant("current_set");
    int level = openborvariant("current_level");

    if(level == 1){ // First level of first set
        if(aniID == RESPAWN){
            performattack(self, openborconstant("ANI_FOLLOW5")); // Different intro animation in the first level
        }if(aniID == SPAWN){
            performattack(self, openborconstant("ANI_FOLLOW5"));
        }
    }
    if(level == 2){ // Second level of first set
        if(aniID == RESPAWN){
            performattack(self, openborconstant("ANI_FOLLOW12")); // Another intro animation in the second level
        }if(aniID == SPAWN){
            performattack(self, openborconstant("ANI_FOLLOW12"));
        }
    }
    if(set == 1){ // Second set
        if(aniID == RESPAWN){
            performattack(self, openborconstant("ANI_ATTACK6")); // Another certain intro in the first level but in second mode
        }if(aniID == SPAWN){
            performattack(self, openborconstant("ANI_ATTACK6"));
        }
    }
}

levels.txt:
Code:
set    Testing # Set 0 = first mode
typemp    1
lives    5
credits    10
#nosame    1
disablehof 1
disablegameover 1
skipselect Billy Jimmy

z    160 740 190
file    data/levels/screwit.txt
z    160 230 220
file    data/levels/90210.txt


set Van # Set 1 = second mode
musicoverlap 1
skipselect Billy Jimmy
z    210 310 255
#nosave 1
file    data/levels/ufc.txt

set Kirihs # set 2 = 3rd mode
z 20 880 400
skipselect
select data/select.txt
file data/levels/ngreece-ramp.txt

Level example without level spawn script tag after creating an onspawnscript:
Code:
background    data/bgs/city/dark.gif
panel        data/bgs/city/street2.gif
order    a
settime 0

#levelscript @script
void main(){
    clearlocalvar();
}
@end_script


#music        data/music/stg1-1.bor 1668425.90
#at 0

wait
at    0

group    1 1
at    0

spawn    Dummy
coords    -30 230
at    0

spawn arrowR
coords 240 180 0
at 0

Thank you so much, danno!

Edit: I just don't know which one I should mark as solution, either mine or danno's. Otherwise I let DC or any staff to choose.

Edit 2: First level of third set shown in the video:

Code:
panel            data/bgs/greece/cave_test.gif

#fglayer         data/bgs/overlay/dark.gif 0 0 0 0 0 0 0 -1 -1 1 3 0 0 0 0 0
cameratype 1
scrollspeed 2
direction both
settime         0
notime          1

type                1 2 0
order    a

spawn1 40 100 300
spawn2 60 120 300

#basemap 289 1021 980 295 0 969
#back
#wall -39 146 33 -126 2428 2562 214 6000
#wall 0 808 0 0 50 50 4 1
#wall 0 807 0 0 50 50 4 2
#wall 0 806 0 0 50 50 4 3
#wall 0 805 0 0 50 50 4 4
#wall 0 804 0 0 50 50 4 5
#wall 0 803 0 0 50 50 4 6
#wall 0 802 0 0 50 50 4 7
#wall 0 801 0 0 50 50 4 8
#wall 0 792 0 0 100 100 10 8

#hole 508 883 771 0 3000 3000 775


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

    if(P1){
        //changeentityproperty(P1, "position", 166, 190, 0);
        performattack(P1, openborconstant("ANI_FOLLOW27"));
    }if(P2){
    //changeentityproperty(P2, "position", 208, 190, 0);
        performattack(P2, openborconstant("ANI_FOLLOW27"));
    }
}
@end_script
coords 18 180
at 0

Billy:
Code:
anim follow27 #Billy's intro
@script
  void self = getlocalvar("self");
  int iMax = openborvariant("count_entities");
  int Dir = getentityproperty(self, "direction");
  int i;

  for(i=0; i<iMax; i++){
    void ally = getentity(i);
    char AName = getentityproperty(ally, "name");
    void AAni = getentityproperty(ally, "animationID");
    int ADir = getentityproperty(ally, "direction");

    if(AName=="Jimmy" && ADir==0 && AAni==openborconstant("ANI_FOLLOW27")){ //intro1
      int Disx = getRange(self, ally, "x", 0);
      int Disz = getRange(self, ally, "z", 0);
      int Ay = getentityproperty(ally, "y");
      
      if(Dir==1 && Disx <= 270 && Disz <= 90 && Ay >= 0 && Ay < 470){
        performattack(ally, openborconstant("ANI_ATTACK8")); //jimmy does stuff
        changeentityproperty(self, "direction", 1);
        performattack(self, openborconstant("ANI_ATTACK7")); //billy does stuff
        } else {
        if(Dir==0 && Disx <= 270 && Disz <= 90 && Ay >= 0 && Ay < 470){
        performattack(ally, openborconstant("ANI_ATTACK8")); // same stuff but other direction
        changeentityproperty(self, "direction", 1);       
        performattack(self, openborconstant("ANI_ATTACK7"));
        break;
         }
        }
       }
      if(AName=="Jimmy" && ADir==1 && AAni==openborconstant("ANI_FOLLOW27")){
      int Disx = getRange(self, ally, "x", 0);
      int Disz = getRange(self, ally, "z", 0);
      int Ay = getentityproperty(ally, "y");
      
      if(Dir==0 && Disx <= 270 && Disz <= 90 && Ay >= 0 && Ay < 470){
        changeentityproperty(self, "direction", 0);
        performattack(ally, openborconstant("ANI_ATTACK8"));
        performattack(self, openborconstant("ANI_ATTACK7"));
        } else {
        if(Dir==1 && Disx <= 270 && Disz <= 90 && Ay >= 0 && Ay < 470){
        performattack(ally, openborconstant("ANI_ATTACK8"));
        changeentityproperty(self, "direction", 0);       
        performattack(self, openborconstant("ANI_ATTACK7"));
        break;
            }
           }
          }
         }
@end_script
    offset    162 202
    delay    17
    frame    data/chars/billy/109.png
    frame    data/chars/billy/108.png
    frame    data/chars/billy/paina01.png
    frame    data/chars/billy/turn01.png

Code:
anim    attack7
    bbox    156 101 49 104
    offset    162 202
    delay    6
    frame    data/chars/billy/181.png
    attack    187 114 21 70 5 0 0 1 0 0
    bbox    150 106 40 99
    frame    data/chars/billy/182.png
    attack    187 78 39 110 5 0 1 0 0 0
    bbox    151 104 41 101
    frame    data/chars/billy/183.png
    bbox    148 104 43 101
    frame    data/chars/billy/184.png
    bbox    147 104 43 101
    frame    data/chars/billy/185.png
    bbox    148 104 43 101
    frame    data/chars/billy/186.png
    attack    187 81 44 68 5 0 1 0 0 0
    bbox    153 104 41 101
    frame    data/chars/billy/187.png
    bbox    161 112 41 93
    frame    data/chars/billy/188.png
    frame    data/chars/billy/189.png
    frame    data/chars/billy/190.png
    bbox    149 103 44 102
    frame    data/chars/billy/191.png

Jimmy:
Code:
anim follow27 #Jimmy's intro
@script
  void self = getlocalvar("self");
  int iMax = openborvariant("count_entities");
  int Dir = getentityproperty(self, "direction");
  int i;

  for(i=0; i<iMax; i++){
    void ally = getentity(i);
    char AName = getentityproperty(ally, "name");
    void AAni = getentityproperty(ally, "animationID");
    int ADir = getentityproperty(ally, "direction");

    if(AName=="Billy" && ADir==0 && AAni==openborconstant("ANI_FOLLOW27")){ //intro1
      int Disx = getRange(self, ally, "x", 0);
      int Disz = getRange(self, ally, "z", 0);
      int Ay = getentityproperty(ally, "y");
      
      if(Dir==1 && Disx <= 270 && Disz <= 90 && Ay >= 0 && Ay < 470){
        performattack(ally, openborconstant("ANI_ATTACK7")); //billy does stuff
        changeentityproperty(self, "direction", 1);
        performattack(self, openborconstant("ANI_ATTACK8")); //jimmy does stuff
        } else {
        if(Dir==0 && Disx <= 270 && Disz <= 90 && Ay >= 0 && Ay < 470){
        performattack(ally, openborconstant("ANI_ATTACK7")); // same stuff but other direction
        changeentityproperty(self, "direction", 1);       
        performattack(self, openborconstant("ANI_ATTACK8"));
        break;
         }
        }
       }
      if(AName=="Billy" && ADir==1 && AAni==openborconstant("ANI_FOLLOW27")){
      int Disx = getRange(self, ally, "x", 0);
      int Disz = getRange(self, ally, "z", 0);
      int Ay = getentityproperty(ally, "y");
      
      if(Dir==0 && Disx <= 270 && Disz <= 90 && Ay >= 0 && Ay < 470){
        changeentityproperty(self, "direction", 0);
        performattack(ally, openborconstant("ANI_ATTACK7"));
        performattack(self, openborconstant("ANI_ATTACK8"));
        } else {
        if(Dir==1 && Disx <= 270 && Disz <= 90 && Ay >= 0 && Ay < 470){
        performattack(ally, openborconstant("ANI_ATTACK7"));
        changeentityproperty(self, "direction", 0);       
        performattack(self, openborconstant("ANI_ATTACK8"));
        break;
            }
           }
          }
         }
@end_script
    offset    162 202
    delay    17
    frame    data/chars/jimmy/109.png
    frame    data/chars/jimmy/108.png
    frame    data/chars/jimmy/pain1-1.png
    frame    data/chars/jimmy/turn1.png

Code:
anim    attack8
    bbox    132 106 70 99
    offset    162 202
    delay    6
    frame    data/chars/jimmy/115.png
    bbox    161 100 35 93
    frame    data/chars/jimmy/116.png
    bbox    155 101 29 84
    frame    data/chars/jimmy/117.png
    frame    data/chars/jimmy/118.png
    attack    170 129 79 50 10 1 1 0 0 0
    bbox    153 98 29 84
    frame    data/chars/jimmy/119.png
    frame    data/chars/jimmy/120.png
    frame    data/chars/jimmy/121.png
    bbox    149 101 29 84
    attack    0 0 0 0 0 0 0 0 0 0
    frame    data/chars/jimmy/122.png

 
Last edited:
Solution
Back
Top Bottom