Solved A parrow question.

Question that is answered or resolved.

kdo

Member
Hi guys, is there any way to force the player's parrow to always appear constantly?

Its always appears on respawn, but i need this all the time in the game.
 
The spawnbind function can detects if the player is 1,2,3, or 4? The parrow I need to use is precisely to say who each player is like in Smash Bros.
 
spawnbind function couldn't detect whom the entity to bind to is, however you could code another function which detects who that entity is. This function will decide which parrow to bind to the player.
 
You could use this function:
C:
void spawnBindPlayer(void Ent, float dx, float dy, float dz, int Dir, int Flag)
{// Spawnbinds an entity then apply aggression based on player index
    void self = getlocalvar("self");
    int Index = getentityproperty(self,"playerindex") + 1; //Get player index + 1
    void Spawn = spawn01(Ent, dx, dy, dz);

    changeentityproperty(Spawn, "aggression", Index);
    bindentity(Spawn, self, dx, dz, dy, Dir, Flag);
}

Declare it like this:
Code:
anim    spawn
    delay    2
    offset    30 60
    frame    data/chars/hero/idle1.png
    @cmd    spawnBindPlayer "PArrow" 0 60 0 2 0
    frame    data/chars/hero/idle1.png

PArrow holds all Parrow for 4 players. Its aggression (set by the above function) defines which player it is for.
Code:
name        Parrow
type        none
alpha        6
aggression    1
setlayer    200
subject_to_wall 0
subject_to_gravity 0
subject_to_obstacle 0
palette        none


anim    follow1
    loop    1
    delay    5
    offset    15 26
    frame    data/chars/effects/par1.png
    frame    data/chars/effects/par1.png
    frame    data/chars/effects/par1.png

anim    follow2
    loop    1
    delay    5
    offset    15 26
    frame    data/chars/effects/par2.png
    frame    data/chars/effects/par2.png
    frame    data/chars/effects/par2.png

anim    follow3
    loop    1
    delay    5
    offset    15 26
    frame    data/chars/effects/par3.png
    frame    data/chars/effects/par3.png
    frame    data/chars/effects/par3.png

anim    follow4
    loop    1
    delay    5
    offset    15 26
    frame    data/chars/effects/par4.png
    frame    data/chars/effects/par4.png
    frame    data/chars/effects/par4.png

anim    idle
@script
  if(frame == 2){
    void self = getlocalvar("self");
    int Aggro = getentityproperty(self,"aggression");
    int CodAt;

    if(Aggro == 4){
      CodAt = openborconstant("ANI_FOLLOW4");
    } else if(Aggro == 3){
      CodAt = openborconstant("ANI_FOLLOW3");
    } else if(Aggro == 2){
      CodAt = openborconstant("ANI_FOLLOW2");
    } else {
      CodAt = openborconstant("ANI_FOLLOW1");
    }

    performattack(self, CodAt);
  }
@end_script
    delay    5
    offset    15 26
    frame    data/chars/misc/empty.png
    frame    data/chars/misc/empty.png
    frame    data/chars/misc/empty.png

HTH
 
Thank you very much for your help! It worked perfectly, it's exactly what I need :giggle: . But I noticed something strange, my stage has holes, each player has 3 lives, each time the player dies falling into the hole the parrow stays in the place as if indicating the place where the player died. If the player dies 3 times and in different positions in the level, in each of them there is a Parrow of the player. Other than that it worked perfectly.
Can you fix this bug? Thank youuuuuuu!!!!
 
getlocalvar("Parrow")
Umm... since you're using inline script/code, there's no way you can use variables in single inline scripts. Just use getlocalvar("self") to kill itself.

Why not this one for your parrow entity like this one for killing itself?
Code:
anim idle
offset ..
delay ..
frame ..
frame ..
@cmd killentity getlocalvar("self")
frame ..

Or you can use this to kill the spawned entity with the use from a parent entity.

Code:
anim    freespecial16 #Shoryuken HP
    offset    336 292
    delay    8
    loop    1 9 11
    landframe    11
    #jumpframe    4 4 1 0
    @cmd    spawnBind "fsrk1" 0 2 2 0 0 #spawnBind {name} {x} {y} {z} {dir} {flag}
    bbox 318 233 48 61
    sound data/chars/ken/kshoryu.wav
    hitflash specflash
    frame    data/chars/ken/cvs2_ken_427.png #8
    bbox 328 214 46 77
    frame    data/chars/ken/cvs2_ken_428.png #16
    @cmd spawnBind "shoryukenh" 0 1 1 0 0
    bbox 332 191 38 100
    attack23 351 205 31 38 11 1 0 0 0 0
    frame    data/chars/ken/cvs2_ken_429.png #24
    delay 1
    attack23 0
    frame    data/chars/ken/cvs2_ken_429.png #25
    delay 8
    @cmd leaper 1 4 0
    @cmd    spawnBind "fsrk2" 0 2 2 0 0 #spawnBind {name} {x} {y} {z} {dir} {flag}
    attack23 345 144 31 78 11 18 0 0 0 0
    bbox 332 173 31 111
    frame    data/chars/ken/cvs2_ken_430.png #33
    attack23 0
    bbox 329 173 35 111
    frame    data/chars/ken/cvs2_ken_431.png #41
    bbox 327 173 35 111
    frame    data/chars/ken/cvs2_ken_432.png
    frame    data/chars/ken/cvs2_ken_433.png #49
    bbox 323 176 37 111
    frame    data/chars/ken/cvs2_ken_434.png #57
    frame    data/chars/ken/cvs2_ken_435.png #65
    frame    data/chars/ken/cvs2_ken_436.png #73
    bbox 323 192 37 103
    frame    data/chars/ken/cvs2_ken_437.png #81

Entities to be killed/removed.
Code:
name fsrk1
type none
hostile player enemy
candamage enemy player
health  1
speed   10
alpha 1
animationscript data/scripts/script.c

anim    idle
    offset    336 292
    delay    5
    frame    data/chars/misc/kenf/cvs2_ken_0.png #5
    frame    data/chars/misc/kenf/cvs2_ken_1.png #10
    frame    data/chars/misc/kenf/cvs2_ken_2.png #15
    frame    data/chars/misc/kenf/cvs2_ken_3.png #20
    frame    data/chars/misc/kenf/cvs2_ken_4.png #25
    frame    data/chars/misc/kenf/cvs2_ken_5.png #30
    frame    data/chars/misc/kenf/cvs2_ken_6.png #35
    frame    data/chars/misc/kenf/cvs2_ken_7.png #40
    frame    data/chars/misc/kenf/cvs2_ken_8.png #45
    frame    data/chars/misc/kenf/cvs2_ken_9.png #50
    frame    data/chars/misc/kenf/cvs2_ken_10.png #55
    frame    data/chars/misc/kenf/cvs2_ken_11.png #60
    frame    data/chars/misc/kenf/cvs2_ken_12.png #65
    frame    data/chars/misc/kenf/cvs2_ken_13.png #70
    frame    data/chars/misc/kenf/cvs2_ken_14.png #75
    frame    data/chars/misc/kenf/cvs2_ken_15.png #80
    @cmd    suicide
    frame    data/chars/misc/kenf/cvs2_ken_15.png #85

Code:
name  fsrk2
type none
hostile player enemy
candamage enemy player
health  1
speed   10
alpha 1
animationscript data/scripts/script.c


anim    idle
    offset    336 292
    delay    1
    frame    data/chars/misc/kenf/cvs2_ken_16.png
    frame    data/chars/misc/kenf/cvs2_ken_17.png
    frame    data/chars/misc/kenf/cvs2_ken_18.png
    frame    data/chars/misc/kenf/cvs2_ken_19.png
    frame    data/chars/misc/kenf/cvs2_ken_20.png
    frame    data/chars/misc/kenf/cvs2_ken_21.png
    frame    data/chars/misc/kenf/cvs2_ken_22.png
    frame    data/chars/misc/kenf/cvs2_ken_23.png
    frame    data/chars/misc/kenf/cvs2_ken_24.png
    frame    data/chars/misc/kenf/cvs2_ken_25.png
    frame    data/chars/misc/kenf/cvs2_ken_26.png
    frame    data/chars/misc/kenf/cvs2_ken_27.png
    frame    data/chars/misc/kenf/cvs2_ken_28.png
    frame    data/chars/misc/kenf/cvs2_ken_29.png
    frame    data/chars/misc/kenf/cvs2_ken_30.png
    frame    data/chars/misc/kenf/cvs2_ken_31.png
    frame    data/chars/misc/kenf/cvs2_ken_32.png
    frame    data/chars/misc/kenf/cvs2_ken_33.png
    frame    data/chars/misc/kenf/cvs2_ken_34.png
    frame    data/chars/misc/kenf/cvs2_ken_35.png
    frame    data/chars/misc/kenf/cvs2_ken_36.png
    frame    data/chars/misc/kenf/cvs2_ken_37.png
    frame    data/chars/misc/kenf/cvs2_ken_38.png
    @cmd    suicide
    frame    data/chars/misc/kenf/cvs2_ken_38.png

Code:
name shoryukenh
type none
health  1
speed   10
animationscript data/scripts/script.c

anim    idle
    offset    336 292
    delay    9
    frame    data/chars/ken/cvs2_ken_438.png
    delay    8
    frame    data/chars/ken/cvs2_ken_439.png
    frame    data/chars/ken/cvs2_ken_440.png
    @cmd    suicide
    frame    data/chars/ken/cvs2_ken_440.png

C:
void suicide(){
    void self = getlocalvar("self");
    killentity(self);
}

I'm not asking you to copy and paste examples from mine, but I'm showing you the reference for what you have there.
 
Can you fix this bug? Thank youuuuuuu!!!!

I'm working on it. It wasn't as simple as I've thought.
Anyways, this is the updated function:
C:
void spawnBindPlayer(void Ent, float dx, float dy, float dz, int Dir, int Flag, void Store)
{// Spawnbinds an entity then apply aggression based on player index
    void self = getlocalvar("self");
    int Index = getentityproperty(self,"playerindex") + 1; //Get player index + 1
    void Spawn = spawn01(Ent, dx, dy, dz);

    changeentityproperty(Spawn, "aggression", Index);
    bindentity(Spawn, self, dx, dz, dy, Dir, Flag);
    setentityvar(Spawn, Store, self);
}

Declare it like before except with added parameter:
Code:
anim    spawn
    delay    2
    offset    30 60
    frame    data/chars/hero/idle1.png
    @cmd    spawnBindPlayer "PArrow" 0 60 0 2 0 "Par"
    frame    data/chars/hero/idle1.png

This is the updated Parrow:
Code:
name        Parrow
type        none
alpha        6
aggression    1
setlayer    200
subject_to_wall 0
subject_to_gravity 0
subject_to_obstacle 0
palette        none


anim    follow1
@script
  if(frame>=1){
    void self = getlocalvar("self");
    int P = getentityvar(self, "Par");
    int PHP = getentityproperty(P,"health");
    int y = getentityproperty(self,"y");

    if(PHP<=0 || y < -20){
      killentity(self); //Suicide!
    }
  }
@end_script
    loop    1
    delay    5
    offset    15 26
    frame    data/chars/effects/par1.png
    frame    data/chars/effects/par1.png
    frame    data/chars/effects/par1.png
    frame    data/chars/effects/par1.png
    frame    data/chars/effects/par1.png

anim    follow2
@script
  if(frame>=1){
    void self = getlocalvar("self");
    int P = getentityvar(self, "Par");
    int PHP = getentityproperty(P,"health");
    int y = getentityproperty(self,"y");

    if(PHP<=0 || y < -20){
      killentity(self); //Suicide!
    }
  }
@end_script
    loop    1
    delay    5
    offset    15 26
    frame    data/chars/effects/par2.png
    frame    data/chars/effects/par2.png
    frame    data/chars/effects/par2.png
    frame    data/chars/effects/par2.png
    frame    data/chars/effects/par2.png

anim    follow3
@script
  if(frame>=1){
    void self = getlocalvar("self");
    int P = getentityvar(self, "Par");
    int PHP = getentityproperty(P,"health");
    int y = getentityproperty(self,"y");

    if(PHP<=0 || y < -20){
      killentity(self); //Suicide!
    }
  }
@end_script
    loop    1
    delay    5
    offset    15 26
    frame    data/chars/effects/par3.png
    frame    data/chars/effects/par3.png
    frame    data/chars/effects/par3.png
    frame    data/chars/effects/par3.png
    frame    data/chars/effects/par3.png

anim    follow4
@script
  if(frame>=1){
    void self = getlocalvar("self");
    int P = getentityvar(self, "Par");
    int PHP = getentityproperty(P,"health");
    int y = getentityproperty(self,"y");

    if(PHP<=0 || y < -20){
      killentity(self); //Suicide!
    }
  }
@end_script
    loop    1
    delay    5
    offset    15 26
    frame    data/chars/effects/par4.png
    frame    data/chars/effects/par4.png
    frame    data/chars/effects/par4.png
    frame    data/chars/effects/par4.png
    frame    data/chars/effects/par4.png

anim    idle
@script
  if(frame == 2){
    void self = getlocalvar("self");
    int Aggro = getentityproperty(self,"aggression");
    int CodAt;

    if(Aggro == 4){
      CodAt = openborconstant("ANI_FOLLOW4");
    } else if(Aggro == 3){
      CodAt = openborconstant("ANI_FOLLOW3");
    } else if(Aggro == 2){
      CodAt = openborconstant("ANI_FOLLOW2");
    } else {
      CodAt = openborconstant("ANI_FOLLOW1");
    }

    performattack(self, CodAt);
  }
@end_script
    delay    5
    offset    15 26
    frame    data/chars/misc/empty.png
    frame    data/chars/misc/empty.png
    frame    data/chars/misc/empty.png

HTH
 
Wow! Thanks again for the help! It worked perfectly, but I noticed a bug.
If the players choose different characters everything works fine, but if they choose the same character the problem persists, every time the character dies the arrow stays in the position where the character died and when he respawns he comes with another arrow like the previous one, this repeats until all lives are gone, so every time the character dies an arrow remains on the screen.
 
Back
Top Bottom