Double super special (SOLVED)

brodock101

New member
Hello everyone. Can I do the following in OpenBOR?
There are two characters (NPCs) at the level, and when they come close to each other, face to face, they get the opportunity to carry out a super attack of a special type, for example: Chun Li and Cammy hit the same opponent while being opposite each other at a short distance, and if they have enough MP, they perform a specially written animation of a joint super attack.
 
Both Chun Li and Cammy have animations with the same names, in the thinkscript of the NPC Chun Li thinkscript I put
the code :
void main()
{
void self = getlocalvar("self");
int mp = getentityproperty(self, "mp");
int dir = getentityproperty(self, "direction");
void target = getentityproperty(self, "opponent");
float x = getentityproperty(self, "x");
float z = getentityproperty(self, "z");
if(getentityproperty(target, "exists")==1){
float Tx = getentityproperty(target, "x");
float Disx = Tx - x;
int i;
for (i=0; i<(openborvariant("count_npcs")); i++){
void ally = getentity(i);
if ((self=="Chun_Li_NPC")&&(ally=="Cammy_NPC")){
float Ax = getentityproperty(ally, "x");
float Az = getentityproperty(ally, "z");
int Allymp = getentityproperty(ally, "mp");
float ADisx = Ax - x;
float ADisz = Az - z;
int Adir = getentityproperty(ally, "direction");
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW91"));
changeentityproperty(ally, "animation", openborconstant("ANI_FOLLOW91"));
}
}
}
}

I removed all checks except the one to find a specific NPC Cammy, but nothing happens, where is my mistake?
 
Hello brodock  8)

From examining the script, I've found two problems. 1st see this line:
Code:
      if ((self=="Chun_Li_NPC")&&(ally=="Cammy_NPC")){

I can see that you want to check if the entity is Chun Li NPC and the other NPC is Cammy NPC. However those two are names which you can't acquire with just these:
Code:
  void self = getlocalvar("self");
  void ally = getentity(i);

self and ally (if there's a valid one) will be in form of numbers. Damon Caskey can explain further but those numbers aren't names. You have to acquire name with these lines:
Code:
  char Name = getentityproperty(self, "name");
      char AName = getentityproperty(ally, "name");

then change name check above with this:
Code:
      if((Name=="Chun_Li_NPC")&&(AName=="Cammy_NPC")){

There might be more issues than just that.
 
Back
Top Bottom