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...
As soon as the level starts? If so use
Code:
spawn emptyS
levelscript @script
void main()
{
int P1 = getplayerproperty(0, "entity");
int P2 = getplayerproperty(1, "entity");

if(P1){
changeentityproperty(P1, "position", -55,189, 0);
changeentityproperty(P1, "direction", 1); //Face right
changeentityproperty(P1, "animation", openborconstant("ANI_FOLLOW4"));
}


Change subject to screen if the animation starts outside of view.


If not Damons respawn at last location enables you to choose which animation

 
Last edited:
Thanks for trying to help, guys. I didn't realize I could do it with skipselect until I tried it. I should've specified certain characters in skipselect like this:

skipselect Billy Jimmy
or skipselect Cody Guy

What I should've mentioned about the real problem is this ... one of them starts the game and one of them joins in-game/level after starting the game. I tried it with what danno and O said/posted, using the script tag and changing the animation, it does work when you begin the game, but with the other player joining the game after, that's a different story. It depends if the other player has either anim spawn/respawn included or not. You just have to use spawn and/or respawn anim(s) in order to join the game. You cannot use any animation such as follow anims to join after the 1st player starts it.

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

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

I cannot use anim follow5 to substitute anim spawn/respawn every time player 2 joins in the level after player 1.
 
@maxman that code are meant for intros, not respawn. For respawn you need to use a code to identify the stage and change the animation accordinly (I've wrote a code for that, its here on the forum). Edit: here it is [SCRIPT] Identifying a stage

For intros, what I do is to lock all other players to join, so they won't break the animation.
The code above was taken from my Avengers game, but it isn't complete so here is the complete version:

C:
spawn   empty

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

    if(P1){
      changeopenborvariant("nojoin", 1);
      changeentityproperty(P1, "position", -490,189, 0);
      changeentityproperty(P1, "direction", 1); //Face right
      changeentityproperty(P1, "animation", openborconstant("ANI_FOLLOW60"));
    }

    if(P2){
      changeopenborvariant("nojoin", 1);
      changeentityproperty(P2, "position", -490,189, 0);
      changeentityproperty(P2, "direction", 1); //Face right
      changeentityproperty(P2, "animation", openborconstant("ANI_FOLLOW60"));
    }
}
@end_script
coords   180 189
at   0

See the "nojoin" line? this will prevent any other player to join. Pay attention that I am only targeting 2 players, but you can adapt for more.

At the end of the desired animation, you need to revert the "nojoin" to 0 again, or nobody will be able to join the game anymore (including you, if you die).
 
Last edited:
@maxman that code are meant for intros, not respawn. For respawn you need to use a code to identify the stage and change the animation accordinly (I've wrote a code for that, its here on the forum).

For intros, what I do is to lock all other players to join, so they won't break the animation.
The code above was taken from my Avengers game, but it isn't complete so here is the complete version:

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

    if(P1){
      changeopenborvariant("nojoin", 1);
      changeentityproperty(P1, "position", -490,189, 0);
      changeentityproperty(P1, "direction", 1); //Face right
      changeentityproperty(P1, "animation", openborconstant("ANI_FOLLOW60"));
    }
    if(P2){
      changeopenborvariant("nojoin", 1);
      changeentityproperty(P2, "position", -490,189, 0);
      changeentityproperty(P2, "direction", 1); //Face right
      changeentityproperty(P2, "animation", openborconstant("ANI_FOLLOW60"));
    }
}
@end_script
coords   180 189
at   0

See the "nojoin" line? this will prevent any other player to join. Pay attention that I am only targeting 2 players, but you can adapt for more.

At the end of the desired animation, you need to revert the "nojoin" to 0 again, or nobody will be able to join the game anymore (including you, if you die).

Now that I see what you guys are talking about, I would suggest this as a slightly more elegant solution. It's basically the same thing as @O Ilusionista's, but works no matter how many players are in game.

C:
spawn   empty
@script

void main()
{
    int player_max = openborvariant("maxplayers");
    int player_cursor = 0;
    void player_entity = NULL();

    /* 
    * Loop from 0 to the maximum allowed players in game.
    * We use the current cursor position in loop as a player index 
    * to do whatever work we need on player or player's entity.
    */

    for (player_cursor = 0; player_cursor < player_max; player_cursor++)
    {
        /*
        * Get player entity for current cursor. If
        * there is no entity, we skip this iteration
        * of the loop.
        */

        player_entity = getplayerproperty(player_cursor, "entity");
  
        if (!player_entity)
        {
            continue;
        }

        /*
        * If we found any player entity at
        * all, set no join.
        */

        changeopenborvariant("nojoin", 1);

        /* Apply our changes to player entity. */
  
        changeentityproperty(player_entity, "position", -490, 189, 0);
        changeentityproperty(player_entity, "direction", 1); // Face right
        changeentityproperty(player_entity, "animation", openborconstant("ANI_FOLLOW60"));
    }
}
@end_script

HTH,
DC
 
Last edited:

What I'm trying to do (for example) is to make Billy take his sunglasses off (instead of kicking) after starting the game with Jimmy. With Billy taking his shades off, Jimmy should bump his fists instead of brushing his hair.

Code:
clearbonus 160 30 20 80 100 80 190 80 260 80# clearbonus {x0} {y0} {x1} {y1} {x2} {y2} {x3} {y3} 

{x4} {y4}
loadingbg 1 4 220 310 130 200 3 #loading background 1=set for 
lbarsize   100 4 1 0 0 #lifebar size {w} {h} {noborder} {type} {orientation} {border} {shadow} 

{graph} {backfill}
mpbarsize  100 4 1 0 0 -9999 -9999 -9999 -9999 #like lifebar, mp bar size is like lifebar in how 

it's set, but it's for mp
#hiscorebg 1


p1life      20 -11 #Player #(1-4) life position
p1mp        20 115 #Player # mp position
p1namej     20 3  20 12  20 3 #Player # name
p1icon      2 5
p1lifen     132 -6
p1lifex     124 -13 #
p1score     20 3  45 -15  60 3
e1life      20 53
e1icon      2 23
e1name      20 25

p2life      190 -11
p2mp        190 -15
p2namej     190 3  190 12  190 3
p2icon      172 5
p2lifen     302 6
p2lifex     294 13
p2score     190 3  215 -15  230 3
e2life      190 33
e2icon      172 23
e2name      190 25

p3life      20 224
p3mp        20 228
p3namej     20 216  20 225  20 216
p3icon      2 218
p3lifen     132 219
p3lifex     124 226
p3score     20 216  45 500  60 216
e3life      20 208
e3icon      2 198
e3name      20 200

p4life      190 224
p4mp        190 228
p4namej     190 216  190 225  190 216
p4icon      172 218
p4lifen     302 219
p4lifex     294 226
p4score     190 216  215 500  230 216
e4life      190 208
e4icon      172 198
e4name      190 200


set    Testing
typemp    1
lives    5
credits    10
#nosame    1
disablehof 1
disablegameover 1
skipselect Billy Jimmy
z    160 230 220
file    data/levels/90210.txt

Billy:
Code:
name    Billy
type    player
gfxshadow 1
health    100
speed    10
running    19 4 2 1 1
turndelay  1
atchain    1 1 2 7
combostyle 1
mp         100
holdblock 1
palette    data/chars/billy/cvsmap.png
alternatepal data/chars/billy/idle01.png
projectilehit enemy

jumpheight 8
com d f a freespecial
com d b a freespecial2
animationscript data/scripts/script.c
com a2 freespecial3
com d u d u a freespecial9
#keyscript data/scripts/walljump.c
#script data/scripts/playerent.c
onmoveascript data/chars/platform/movea.c
onblockwscript data/chars/platform/wall.c
#ondrawscript data/scripts/DEBUG_GRAB.c

#=============

anim spawn # Stand up
@script
    void self = getlocalvar("self"); //Get calling entity
    int HP = getglobalvar("HP");
    int MP = getglobalvar("MP");
    int HPs = getglobalvar("HPs");
    int MPs = getglobalvar("MPs");
    int dir;

    if(HPs==NULL()){
      HPs = getentityproperty(self,"health") + HP;
    }

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

    if(frame==1){
      changeentityproperty(self,"maxhealth", 40 + HP);
      changeentityproperty(self,"health", HPs);
      changeentityproperty(self,"maxmp", 50 + MP);
      changeentityproperty(self,"mp", MPs);

      setglobalvar("HPs", NULL());
      setglobalvar("MPs", NULL());
    }
    if(frame == 4){
        dir = getentityproperty(self, "direction");
        if(dir == 1){
            changeentityproperty(self, "direction", 1);
        }else{
            changeentityproperty(self, "direction", 0);
        }
    }
@end_script
    offset    162 202
    delay    11
#    bbox    131 100 60 105
    @cmd    clearL
#    flipframe 2
    frame    data/chars/billy/crouch02.png
    frame    data/chars/billy/crouch01.png
    frame    data/chars/billy/42.png
    frame    data/chars/billy/40.png
    @cmd    changeopenborvariant "nojoin" 0
    frame    data/chars/billy/40.png


anim respawn # Kick
@script
    void self = getlocalvar("self"); //Get calling entity
    int HP = getglobalvar("HP");
    int MP = getglobalvar("MP");
    int HPs = getglobalvar("HPs");
    int MPs = getglobalvar("MPs");

    if(HPs==NULL()){
      HPs = getentityproperty(self,"health") + HP;
    }

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

    if(frame==1){
      changeentityproperty(self,"maxhealth", 40 + HP);
      changeentityproperty(self,"health", HPs);
      changeentityproperty(self,"maxmp", 50 + MP);
      changeentityproperty(self,"mp", MPs);

      setglobalvar("HPs", NULL());
      setglobalvar("MPs", NULL());
    }
@end_script
    offset    162 202
    delay    8
#    bbox    131 100 60 105
    @cmd    clearL
    frame    data/chars/billy/109.png
    frame    data/chars/billy/110.png
    frame    data/chars/billy/111.png
    frame    data/chars/billy/112.png
    frame    data/chars/billy/113.png
    @cmd    changeopenborvariant "nojoin" 0
    frame    data/chars/billy/114.png
  
anim follow5 # Taking off sunglasses

    offset 162 202
    delay 7
    frame data/chars/billy/intro01.png
    frame data/chars/billy/intro02.png
    frame data/chars/billy/intro03.png
    frame data/chars/billy/intro04.png
    frame data/chars/billy/intro05.png
    frame data/chars/billy/intro06.png
    frame data/chars/billy/intro07.png
    frame data/chars/billy/intro08.png
    frame data/chars/billy/intro09.png
    frame data/chars/billy/intro10.png
    @cmd changeopenborvariant "nojoin" 0
    frame data/chars/billy/intro11.png

Jimmy:
Code:
name    Jimmy
type    player
speed    10
health    100
facing  0
combostyle 1
gfxshadow 1
atchain 1 2 4 3
running    19 4 2 1 1
turndelay 50
jumpheight 4.25
palette    data/chars/jimmy/map01.png
alternatepal data/chars/jimmy/idle00.png

com d u j freespecial8
#com d u freespecial2
#com d f freespecial3

animationscript data/scripts/script.c
#keyscript data/scripts/jjkey.c
script data/scripts/superfjump.c


#======================

anim respawn # Brush hair

    offset    162 202
    delay    7
    frame    data/chars/jimmy/354.png
    frame    data/chars/jimmy/355.png
    frame    data/chars/jimmy/356.png
    frame    data/chars/jimmy/357.png
    frame    data/chars/jimmy/358.png
    frame    data/chars/jimmy/359.png
    frame    data/chars/jimmy/360.png
    frame    data/chars/jimmy/361.png
    frame    data/chars/jimmy/362.png
    frame    data/chars/jimmy/363.png
    @cmd    changeopenborvariant "nojoin" 0
    delay 20
    frame    data/chars/jimmy/364.png


anim spawn # "Hey come on!"

    offset    162 202
    delay    7
    frame    data/chars/jimmy/376.png
    frame    data/chars/jimmy/377.png
    frame    data/chars/jimmy/378.png
    frame    data/chars/jimmy/379.png
    frame    data/chars/jimmy/380.png
    @cmd    changeopenborvariant "nojoin" 0
    frame    data/chars/jimmy/381.png


anim follow5 # Fists bump

    offset    162 202
    delay    10
    frame    data/chars/jimmy/371.png
    frame    data/chars/jimmy/372.png
    frame    data/chars/jimmy/373.png
    frame    data/chars/jimmy/374.png
    frame    data/chars/jimmy/375.png
    @cmd    changeopenborvariant "nojoin" 0
    frame    data/chars/jimmy/374.png



Code:
# File modified by Level Editor on 3/27/2009
# File modified by Level Editor on 3/27/2009
# File modified by Level Editor on 3/21/2009
# File modified by Level Editor on 3/21/2009
# File modified by Level Editor on 3/19/2009
# File modified by Level Editor on 1/27/2009
# File modified by Level Editor on 11/27/2008

background    data/bgs/city/dark.gif
panel        data/bgs/city/street2.gif
order    a
settime 0
#allowselect billy jimmy lynn sonia
#basemap {x} {z} {xsize} {zsize} {amin} {amax}
#basemap 160 228 1 10 1 10
#basemap    160 218 1 10 11 20

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

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


#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

P.S. I'm gonna change the topic name because this sounds very misleading to users about what my attempt is.

EDIT: Topic changed.
 
Last edited:
I was going to suggest changing topic name because it seems more like you want to create dynamic character intros. I use a script Bloodbane created for character interaction in Night Slashers, I adapted it so it works for both directions in case the level scrolls from right to left.

C:
anim follow12 #Billys 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_FOLLOW1")){ //intro1
      int Disx = getRange(self, ally, "x", 0);
      int Disz = getRange(self, ally, "z", 0);
      int Ay = getentityproperty(ally, "y");
    
      if(Dir==1 && Disx <= 70 && Disz <= 10 && Ay > 20 && Ay < 70){
        performattack(ally, openborconstant("ANI_FREESPECIAL12")); //jimmy does stuff
        changeentityproperty(self, "direction", 1);
        performattack(self, openborconstant("ANI_FOLLOW6")); //billy does stuff
        } else {
        if(Dir==0 && Disx <= 70 && Disz <= 10 && Ay > 20 && Ay < 70){
        performattack(ally, openborconstant("ANI_FREESPECIAL12")); // same stuff but other direction
        changeentityproperty(self, "direction", 1);     
        performattack(self, openborconstant("ANI_FOLLOW6"));
        break;
         }
        }
       }
      if(AName=="Jimmy" && ADir==1 && AAni==openborconstant("ANI_FOLLOW1")){
      int Disx = getRange(self, ally, "x", 0);
      int Disz = getRange(self, ally, "z", 0);
      int Ay = getentityproperty(ally, "y");
    
      if(Dir==0 && Disx <= 70 && Disz <= 10 && Ay > 20 && Ay < 70){
        changeentityproperty(self, "direction", 0);
        performattack(ally, openborconstant("ANI_freespecial12"));
        performattack(self, openborconstant("ANI_FOLLOW6"));
        } else {
        if(Dir==1 && Disx <= 70 && Disz <= 10 && Ay > 20 && Ay < 70){
        performattack(ally, openborconstant("ANI_freespecial12"));
        changeentityproperty(self, "direction", 0);     
        performattack(self, openborconstant("ANI_FOLLOW6"));
        break;
            }
           }
          }
         }
@end_script
 
Last edited:
@danno: Where does getRange come from anyway? Is it from animationscript for your NS mod? It doesn't read where getRange comes from and I don't have it.

Code:
Total Ram: 4168376320 Bytes
 Free Ram: 432541696 Bytes
 Used Ram: 3739648 Bytes

debug:nativeWidth, nativeHeight, bpp, Hz  1366, 768, 24, 60

1 joystick(s) found!
OpenBoR v3.0 Build , Compile Date: Dec 22 2016

Game Selected: ./Paks/mybor.pak

FileCaching System Init......    Disabled
Initializing video............
Reading video settings from 'data/video.txt'.
Initialized video.............    320x240 (Mode: 0, Depth: 32 Bit)

Loading menu.txt.............    Done!
Loading fonts................    1 2 3 4 7 Done!
Timer init...................    Done!
Initialize Sound..............   
Loading sprites..............    Done!
Loading level order..........    Done!
Loading model constants......    Done!
Loading script settings......    Done!
Loading scripts..............    Done!
Loading models...............

Cacheing 'Flash' from data/chars/misc/flash.txt
Cacheing 'VF' from data/sprites/VF.txt
Cacheing 'Billy' from data/chars/billy/billy.txt
Cacheing 'Jimmy' from data/chars/jimmy/jimmy.txt
Cacheing 'Lynn' from data/chars/lynn/lynn.txt
Cacheing 'gill' from data/chars/gill/gill.txt
Cacheing 'Ren' from data/chars/renidagawa/renidagawa.txt
Cacheing 'marth' from data/chars/marth/marth.txt
Cacheing 'Mpack' from data/chars/misc/mpack.txt
Cacheing '1up' from data/chars/misc/1up.txt
Cacheing 'hamburger' from data/chars/misc/hambur.txt
Cacheing 'Money' from data/chars/misc/money.txt
Cacheing 'Meat' from data/chars/misc/meat.txt
Cacheing 'Knife' from data/chars/misc/knife.txt
Cacheing 'Box' from data/chars/misc/box.txt
Cacheing 'Buntaro' from data/chars/buntaro/buntaro.txt
Cacheing 'Shintaro' from data/chars/shintaro/shintaro.txt
Cacheing 'Jack' from data/chars/jack/jack.txt
Cacheing 'Chinnen' from data/chars/chinnen/chinnen.txt
Cacheing 'Olof' from data/chars/olof/olof.txt
Cacheing 'Flogger' from data/chars/flogger/flogger.txt
Cacheing 'Empty' from data/chars/misc/empty.txt
Cacheing 'Wong' from data/chars/cheng/cheng.txt
Cacheing 'Kulio' from data/chars/yun/yun.txt
Cacheing 'Dingo' from data/chars/dingo/dingo.txt
Cacheing 'Iggy' from data/chars/iggy/iggy.txt
Cacheing 'Eagle' from data/chars/eagle/eagle.txt
Cacheing 'Duck' from data/chars/duck/duck.txt
Cacheing 'Abubo' from data/chars/abubo/abubo.txt
Cacheing 'Burnov' from data/chars/burnov/burnov.txt
Cacheing 'Sonia' from Data/Chars/Sonia/Sonia.txt
Cacheing 'Sonia2' from Data/chars/Sonia/Sonia2.txt
Cacheing 'Captain_Commando' from Data/chars/capcom/CapCom.txt
Cacheing 'Baby_Head' from Data/chars/BabyCommando/babyhead.txt
Cacheing 'cvsryu' from data/chars/cvsryu/cvsryu.txt
Cacheing 'Shadow_Stg3' from data/chars/misc/shdwstg3.txt
Cacheing 'Eliza' from data/chars/Eliza/Eliza.txt
Cacheing 'Ralf' from data/chars/ralf/ralf.txt
Cacheing 'Kula' from data/chars/kula/kula.txt
Cacheing 'Lesus' from data/chars/lesus/lesus.txt
Cacheing 'Gale' from data/chars/lesus/lesus2.txt
Cacheing 'Thunder' from data/chars/lesus/lesus3.txt
Cacheing 'Petir' from data/chars/lesus/lesuss.txt
Cacheing 'Bao' from data/chars/bao/bao.txt
Cacheing 'Maxima' from data/chars/maxima/maxima.txt
Cacheing 'Athena' from data/chars/athena/athena.txt
Cacheing 'zedd' from data/chars/zedd/zedd.txt
Cacheing 'fadeoutwhite' from data/chars/misc/fade/fadeoutwhite.txt
Cacheing 'idlezedd1' from data/chars/misc/idlezedd1.txt
Cacheing 'idlezedd2' from data/chars/misc/idlezedd2.txt
Cacheing 'lightning' from data/chars/misc/lightning/lightning.txt
Cacheing 'Jimmy-E' from data/chars/jimmy/jimmye.txt
Cacheing 'EMPTY_WEAP' from data/chars/misc/empty_weap.txt
Cacheing 'endlevel_empty' from data/chars/misc/endlevel_empty.txt
Cacheing 'lenny' from data/chars/lenny/lenny.txt
Cacheing '1spawn' from data/chars/misc/1spawn.txt
Cacheing 'wsample' from Data/chars/Misc/wsample.txt
Cacheing 'wsample2' from data/chars/misc/wsample2.txt
Cacheing 'wsample1' from data/chars/misc/wsample1.txt
Cacheing 'wsample3' from data/chars/misc/wsample3.txt
Cacheing 'fronside' from data/chars/misc/fronside.txt
Cacheing 'wsample4' from data/chars/misc/wsample4.txt
Cacheing 'wsample5' from data/chars/misc/wsample5.txt
Cacheing 'wsample6' from data/chars/misc/wsample6.txt
Cacheing 'sideway' from data/chars/misc/sideway.txt
Cacheing 'halfplat' from data/chars/misc/halfplat.txt
Cacheing 'plat1' from data/chars/misc/plat1.txt
Cacheing '25plat' from data/chars/misc/25plat.txt
Cacheing 'plathalf' from data/chars/misc/plathalf.txt
Cacheing 'plata' from Data/chars/Misc/plata/plata.txt
Cacheing 'hplat1' from data/chars/misc/plata/hplat1.txt
Cacheing 'hplat2' from data/chars/misc/plata/hplat2.txt
Cacheing 'Q-None' from Data/chars/Misc/Q/Q-None.txt
Cacheing 'plataforma' from data/chars/misc/plataforma.txt
Cacheing 'rmat1' from data/sprites/rmat1.txt
Cacheing 'camaxis' from data/chars/misc/camaxis.txt
Cacheing 'axel' from Data/chars/axel/axel.txt
Cacheing 'dummy' from data/chars/misc/dummy/dummy.txt
Cacheing 'head' from data/chars/misc/dummy/head.txt
Cacheing 'music' from data/chars/music/music.txt
Cacheing 'floor' from data/chars/platform/floor.txt
Cacheing 'slope' from data/bgs/1/slope.txt
Cacheing 'arrowR' from data/chars/misc/arrowR.txt
Cacheing 'arrowL' from data/chars/misc/arrowL.txt
Cacheing 'arrowU' from data/chars/misc/arrowU.txt
Cacheing 'arrowD' from data/chars/misc/arrowD.txt

Loading 'Flash' from data/chars/misc/flash.txt
Loading 'VF' from data/sprites/VF.txt
Command 'if(frame' not understood in file 'data/chars/billy/billy.txt'!
Command 'void' not understood in file 'data/chars/billy/billy.txt'!
Command 'set(data,' not understood in file 'data/chars/billy/billy.txt'!
Command 'addcancel(data,' not understood in file 'data/chars/billy/billy.txt'!
Command 'addcancel(data,' not understood in file 'data/chars/billy/billy.txt'!
Command 'addcancel(data,' not understood in file 'data/chars/billy/billy.txt'!
Command '}' not understood in file 'data/chars/billy/billy.txt'!
Command 'if(frame' not understood in file 'data/chars/billy/billy.txt'!
Command 'void' not understood in file 'data/chars/billy/billy.txt'!
Command 'set(data,' not understood in file 'data/chars/billy/billy.txt'!
Command 'addcancel(data,' not understood in file 'data/chars/billy/billy.txt'!
Command 'addcancel(data,' not understood in file 'data/chars/billy/billy.txt'!
Command '}' not understood in file 'data/chars/billy/billy.txt'!
Command '@end_script' not understood in file 'data/chars/billy/billy.txt'!
Command 'void' not understood in file 'data/chars/billy/billy.txt'!
Command 'int' not understood in file 'data/chars/billy/billy.txt'!
Command 'int' not understood in file 'data/chars/billy/billy.txt'!
Command 'if(frame' not understood in file 'data/chars/billy/billy.txt'!
Command 'if(attack2){' not understood in file 'data/chars/billy/billy.txt'!
Command 'changeentityproperty(self,' not understood in file 'data/chars/billy/billy.txt'!
Command '}' not understood in file 'data/chars/billy/billy.txt'!
Command '}' not understood in file 'data/chars/billy/billy.txt'!
Command '@end_script' not understood in file 'data/chars/billy/billy.txt'!
Command 'int' not understood in file 'data/chars/billy/billy.txt'!
Command 'int' not understood in file 'data/chars/billy/billy.txt'!
Command 'int' not understood in file 'data/chars/billy/billy.txt'!
Command 'if(frame' not understood in file 'data/chars/billy/billy.txt'!
Command 'if(attack2){' not understood in file 'data/chars/billy/billy.txt'!
Command 'performattack(self,' not understood in file 'data/chars/billy/billy.txt'!
Command '}' not understood in file 'data/chars/billy/billy.txt'!
Command '}' not understood in file 'data/chars/billy/billy.txt'!
Command '@end_script' not understood in file 'data/chars/billy/billy.txt'!
Command 'void' not understood in file 'data/chars/billy/billy.txt'!
Command 'int' not understood in file 'data/chars/billy/billy.txt'!
Command 'int' not understood in file 'data/chars/billy/billy.txt'!
Command 'int' not understood in file 'data/chars/billy/billy.txt'!
Command 'for(i=0;' not understood in file 'data/chars/billy/billy.txt'!
Command 'void' not understood in file 'data/chars/billy/billy.txt'!
Command 'char' not understood in file 'data/chars/billy/billy.txt'!
Command 'void' not understood in file 'data/chars/billy/billy.txt'!
Command 'int' not understood in file 'data/chars/billy/billy.txt'!
Command 'if(aname=="jimmy"' not understood in file 'data/chars/billy/billy.txt'!
Command 'int' not understood in file 'data/chars/billy/billy.txt'!
Command 'int' not understood in file 'data/chars/billy/billy.txt'!
Command 'int' not understood in file 'data/chars/billy/billy.txt'!
Command 'if(dir==1' not understood in file 'data/chars/billy/billy.txt'!
Command 'performattack(ally,' not understood in file 'data/chars/billy/billy.txt'!
Command 'changeentityproperty(self,' not understood in file 'data/chars/billy/billy.txt'!
Command 'performattack(self,' not understood in file 'data/chars/billy/billy.txt'!
Command '}' not understood in file 'data/chars/billy/billy.txt'!
Command 'if(dir==0' not understood in file 'data/chars/billy/billy.txt'!
Command 'performattack(ally,' not understood in file 'data/chars/billy/billy.txt'!
Command 'changeentityproperty(self,' not understood in file 'data/chars/billy/billy.txt'!
Command 'performattack(self,' not understood in file 'data/chars/billy/billy.txt'!
Command 'break;' not understood in file 'data/chars/billy/billy.txt'!
Command '}' not understood in file 'data/chars/billy/billy.txt'!
Command '}' not understood in file 'data/chars/billy/billy.txt'!
Command '}' not understood in file 'data/chars/billy/billy.txt'!
Command 'if(aname=="jimmy"' not understood in file 'data/chars/billy/billy.txt'!
Command 'int' not understood in file 'data/chars/billy/billy.txt'!
Command 'int' not understood in file 'data/chars/billy/billy.txt'!
Command 'int' not understood in file 'data/chars/billy/billy.txt'!
Command 'if(dir==0' not understood in file 'data/chars/billy/billy.txt'!
Command 'changeentityproperty(self,' not understood in file 'data/chars/billy/billy.txt'!
Command 'performattack(ally,' not understood in file 'data/chars/billy/billy.txt'!
Command 'performattack(self,' not understood in file 'data/chars/billy/billy.txt'!
Command '}' not understood in file 'data/chars/billy/billy.txt'!
Command 'if(dir==1' not understood in file 'data/chars/billy/billy.txt'!
Command 'performattack(ally,' not understood in file 'data/chars/billy/billy.txt'!
Command 'changeentityproperty(self,' not understood in file 'data/chars/billy/billy.txt'!
Command 'performattack(self,' not understood in file 'data/chars/billy/billy.txt'!
Command 'break;' not understood in file 'data/chars/billy/billy.txt'!
Command '}' not understood in file 'data/chars/billy/billy.txt'!
Command '}' not understood in file 'data/chars/billy/billy.txt'!
Command '}' not understood in file 'data/chars/billy/billy.txt'!
Command '}' not understood in file 'data/chars/billy/billy.txt'!
Command '@end_script' not understood in file 'data/chars/billy/billy.txt'!
Loading 'Billy' from data/chars/billy/billy.txt
Script compile error: can't find function 'getRange'

Script compile error in 'Jimmy': getRange line 870, column 17

********** An Error Occurred **********
*            Shutting Down            *

Can't compile script 'Jimmy' data/chars/jimmy/jimmy.txt
Total Ram: 4168376320 Bytes
 Free Ram: 403836928 Bytes
 Used Ram: 28524544 Bytes

Release level data...........
Done!

Release graphics data........    Done!
Release game data............


Release game data............    Done!
Release timer................    Done!
Release input hardware.......    Done!
Release sound system.........    Done!
Release FileCaching System...    Done!

**************** Done *****************

Can't compile script 'Jimmy' data/chars/jimmy/jimmy.txt

I was using this with getRange included but got crash 'cause there's no identifier for that function. I only see getRange(self, ally, "x", 0) or getRange(self, ally, "z", 0) in there.
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_FOLLOW5")){ //intro1
      int Disx = getRange(self, ally, "x", 0);
      int Disz = getRange(self, ally, "z", 0);
      int Ay = getentityproperty(ally, "y");
      
      if(Dir==1 && Disx <= 70 && Disz <= 10 && Ay > 20 && Ay < 70){
        performattack(ally, openborconstant("ANI_ATTACK7")); //billy does stuff
        changeentityproperty(self, "direction", 1);
        performattack(self, openborconstant("ANI_FOLLOW5")); //jimmy does stuff
        } else {
        if(Dir==0 && Disx <= 70 && Disz <= 10 && Ay > 20 && Ay < 70){
        performattack(ally, openborconstant("ANI_ATTACK7")); // same stuff but other direction
        changeentityproperty(self, "direction", 1);       
        performattack(self, openborconstant("ANI_FOLLOW5"));
        break;
         }
        }
       }
      if(AName=="Billy" && ADir==1 && AAni==openborconstant("ANI_FOLLOW5")){
      int Disx = getRange(self, ally, "x", 0);
      int Disz = getRange(self, ally, "z", 0);
      int Ay = getentityproperty(ally, "y");
      
      if(Dir==0 && Disx <= 70 && Disz <= 10 && Ay > 20 && Ay < 70){
        changeentityproperty(self, "direction", 0);
        performattack(ally, openborconstant("ANI_ATTACK7"));
        performattack(self, openborconstant("ANI_FOLLOW5"));
        } else {
        if(Dir==1 && Disx <= 70 && Disz <= 10 && Ay > 20 && Ay < 70){
        performattack(ally, openborconstant("ANI_ATTACK7"));
        changeentityproperty(self, "direction", 0);       
        performattack(self, openborconstant("ANI_FOLLOW5"));
        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

Instead, I'm using this intro right here:
Code:
anim follow12 #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" && AAni==openborconstant("ANI_FOLLOW5")){ //intro1
        performattack(ally, openborconstant("ANI_ATTACK7")); //billy does stuff
        changeentityproperty(self, "direction", 1);
        performattack(self, openborconstant("ANI_FOLLOW5")); //jimmy does stuff
        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

Billy's intro:
Code:
anim follow12 #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" && AAni==openborconstant("ANI_FOLLOW5")){ //intro1
        performattack(ally, openborconstant("ANI_ATTACK8")); //jimmy does stuff
        changeentityproperty(self, "direction", 1);
        performattack(self, openborconstant("ANI_FOLLOW5")); //billy does stuff
        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:
spawn empty
@script
void main(){
    int P1 = getplayerproperty(0, "entity");
    int P2 = getplayerproperty(1, "entity");

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

I tried it, but it is still the same result, with follow12 anim playing. The partner doesn't perform any animation it should.

I must be doing something wrong. How do you do something better with that?
 
Sorry I forgot to add that

Code:
void getRange(void Ent1, void Ent2, int T, int Flag)
{// Acquires distance between two entities
    float x1 = getentityproperty(Ent1, "x");
    float z1 = getentityproperty(Ent1, "z");
    float x2 = getentityproperty(Ent2, "x");
    float z2 = getentityproperty(Ent2, "z");
    float Disx = x2 - x1;
    float Disz = z2 - z1;

    if(Flag != 1){
      if(Disx < 0){
        Disx = -Disx;
      }
    }

    if(Disz < 0){
      Disz = -Disz;
    }

    if(T == "x"){
      return Disx;
    }
    if(T == "z"){
      return Disz;
    }
}
 
Thanks danno for the animation script! ;D I changed the animation to follow27 in the level, as well with the script, but it still plays anim respawn. I don't know what I'm doing wrong.

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 as Billy's partner/ally in the animation script:

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

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

Level:
Code:
spawn empty
@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

If I have a big problem with this, I'm gonna send this to you. (I also changed the range for players.)
 
Last edited:
do Billy and Jimmy have anim spawn animations also? I remember o'ilu telling me you need anim spawn to work with the level script not just anim respawn.
 
It does work so I'm not sure what you're doing wrong


level intros are anim follows individually and together they perform anim freespecials which I use as escape moves (didn't have time to create new animations) but the theory checks out ok.
 
skipselect with no player name, along with select, is not what I am using. I don't want to use it because I know it works well when it comes to having 2 players at the same time. The video you posted has skipselect {no player} with select {path}. Skipping to select screen is no problem at all.

Code:
skipselect
select data/{wherever_the_select_text_is.txt}

The main point comes with only this kind of skipselect (without skipping to select screen):

Code:
skipselect Billy Jimmy
file data/{wherever_the_level_text_is.txt}

Can you please suggest/help me what topic name I should change to match the point of this topic? I don't know what topic name I should change about using skipselect with partners in levels, not skipping to select screen. The staff here can help with the topic name change.
 
Last edited:
O.k I think I understand what you mean, skipselect into game, and when another player joins they do a joint animation together to celebrate like "hey dude glad you joined"

:unsure: over riding spawn/respawn is going to be difficult, In theory you'd need onjoin/onspawnscript to function on 1st spawn and every respawn after that works as normal
 
Last edited:
The player that starts first will perform anim follow5 (take off sunglasses or bump fists) and the other player joining will start with anim follow5 as well. Character interactions, later, but thanks for putting it up.

Thank you for changing the topic name, danno. Much appreciated. I'll try out onspawnscript.
 
Thanks danno. Using onspawnscript works like a charm. :) I made a simple spawn script and it does force spawn and/or respawn animations into whatever animations I want. So it works well.

Code:
void main(){
    void self = getlocalvar("self");
    void aniID = getentityproperty(self, "animationid");

    if(aniID == openborconstant("ANI_RESPAWN")){
        performattack(self, openborconstant("ANI_FOLLOW5"));
    }if(aniID == openborconstant("ANI_SPAWN")){
        performattack(self, openborconstant("ANI_FOLLOW5"));
    }
}

Right now, I need a little expansion. I need to call on certain levels with entity's onspawnscript(s) like level 1 and level 2. How can I call levels 1 and 2 or whatever? Do I need to use "current_level" or "current_stage"? "current_set" maybe?

EDIT:

I tried using levelscript for forcing spawn and respawn animations to different ones in the level, but it cannot change players' spawn animations. With player's onspawnscript activated, the player's spawning animations cannot be changed from follow5 to follow27.

I tried these:

Code:
levelscript @script
void main(){
    int P1 = getplayerproperty(0, "entity");
    int P2 = getplayerproperty(1, "entity");
    void aniID1 = getentityproperty(P1, "animationid");
    void aniID2 = getentityproperty(P2, "animationid");

    if(P1){
        if(aniID1 == openborconstant("ANI_RESPAWN")){
            performattack(P1, openborconstant("ANI_FOLLOW27"));
        }if(aniID1 == openborconstant("ANI_SPAWN")){
            performattack(P1, openborconstant("ANI_FOLLOW27"));
        }
    }
    if(P2){
        if(aniID2 == openborconstant("ANI_RESPAWN")){
            performattack(P2, openborconstant("ANI_FOLLOW27"));
        }if(aniID2 == openborconstant("ANI_SPAWN")){
            performattack(P2, openborconstant("ANI_FOLLOW27"));
        }
    }
}
@end_script

Code:
levelscript @script
void main(){
    int index = getlocalvar("player");
    void target = getplayerproperty(index, "entity");
    void aniID = getentityproperty(target, "animationid");

    if(aniID == openborconstant("ANI_RESPAWN")){
        performattack(P1, openborconstant("ANI_FOLLOW27"));
    }
    if(aniID == openborconstant("ANI_SPAWN")){
        performattack(P1, openborconstant("ANI_FOLLOW27"));
    }
}
@end_script

Need to give certain spawning animations differently in different stages/levels.
 
Last edited:
How about you use levelscript just for custom stage player intro. onspawnscript to check which current level player is in and spawn which ever way you want.
 
Back
Top Bottom