OpCode 8

  • Thread starter Thread starter Goliath
  • Start date Start date
G

Goliath

Guest
Someone knows what this error means

Code:
Function need a valid entity handle, the other 2 integer parameters are optional: performattack(entity, int anim, int resetable)
Script function 'performattack' returned an exception, check the manual for details.

OpCode: 8

OpCode: 8

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

There's an exception while executing script 'animationscript' data/chars/marco/marcomove.txt

Can´t use performattack in any function  :(
 
It also says you forgot some parameters. It might be one of them is an empty value. We need to see your calling script to help.

DC
 
Can you tel me what´s the diference between those lines:

Code:
changeentityproperty(self, "animation", openborconstant(Ani));

performattack(self, openborconstant(Ani));

Here are the scripts i use that has pertformattack parameter on them, i dont know which is causing the error.

Code:
void rangeAnim(int RxMin, int RxMax, int Ry,void PAni)
{// Attack interruption if nearby opponent is in range
// RxMin : Minimum x range
// RxMax : Maximum x range
// Ry : Altitude difference
// Rz : Z range
// PAni : Player´s animation to change to
    void self = getlocalvar("self");
	void target = findtarget(self); //Get nearest opponent
    float x = getentityproperty(self, "x");
    float y = getentityproperty(self, "a");
    int dir = getentityproperty(self, "direction");

    if(target!=NULL()) {
      float Tx = getentityproperty(target, "x");
      float Ty = getentityproperty(target, "a");
      float Disx = Tx - x;
      float Disy = Ty - y;

      if(Disy < 0){
        Disy = -Disy;
      }
	  
      if( Disx >= RxMin && Disx <= RxMax && Disy <= Ry){
        performattack(self, openborconstant(PAni)); //Change the animation
      } else if( Disx >= -RxMax && Disx <= -RxMin && Disy <= Ry){
        performattack(self, openborconstant(PAni)); //Change the animation
      }
    }
}

void basechange(void Ani)
{// Check altitude. If bomb is on base, change animation!

    void self = getlocalvar("self");
    int y = getentityproperty(self,"a"); //Get bomb's altitude
    int b = getentityproperty(self, "base"); //Get base

    if( y <= 1+b ){ // On base?
      performattack(self, openborconstant(Ani)); //Change the animation
    }
}

void fallchange(void Ani)
{// Check altitude. If entity is not on base, change animation!

    void self = getlocalvar("self");
    int y = getentityproperty(self,"a"); //Get entity altitude
    int b = getentityproperty(self, "base"); //Get base

    if( y > 1+b ){ // Not on base?
      performattack(self, openborconstant(Ani)); //Change the animation
    }
}

void altitudchange(void Ani)
{// Check altitude. If bomb is allmost on base, change animation!

    void self = getlocalvar("self");
    int y = getentityproperty(self,"a"); //Get bomb's altitude
    int b = getentityproperty(self, "base"); //Get base

    if( y <= 100+b ){ // Allmost On base?
      performattack(self, openborconstant(Ani)); //Change the animation
    }
}

void keyint2(void Ani, int Frame, void Key, int Hflag, int Vx)
{// Change current animation if proper key is pressed or released
// Animation is changed to attack mode

    void self = getlocalvar("self");
    int Dir = getentityproperty(self, "direction");
    int iPIndex = getentityproperty(self,"playerindex"); //Get player index
    void iRKey;

      if (Key=="U"){ //Up Required?
        iRKey = playerkeys(iPIndex, 0, "moveup"); // "Up"
      }
	  
	  if (Key=="UA"){ //Up and attack Required?
        iRKey = playerkeys(iPIndex, 0, "moveup", "attack"); // "Up" "Attack"
      }

      if (Key=="D"){ //Down Required?
        iRKey = playerkeys(iPIndex, 0, "movedown"); // "Down"
      }

      if (Key=="L"){ //Left Required?
        iRKey = playerkeys(iPIndex, 0, "moveleft"); // "Left"
      }

      if (Key=="R"){ //Right Required?
        iRKey = playerkeys(iPIndex, 0, "moveright"); // "Right"
      }

      if (Key=="F"){ //Forward Required?
        if (Dir == 0){ // Facing Left?
          iRKey = playerkeys(iPIndex, 0, "moveleft"); // "Left"
        } else { // Facing Right
          iRKey = playerkeys(iPIndex, 0, "moveright"); // "Right"
        }
      }
	  
	  if (Key=="UF"){ //Forward Required?
        if (Dir == 0){ // Facing Left?
          iRKey = playerkeys(iPIndex, 0, "moveup", "moveleft"); // "Up" "Left"
        } else { // Facing Right
          iRKey = playerkeys(iPIndex, 0, "moveup", "moveright"); // "Up" "Right"
        }
      }

      if (Key=="B"){ //Backward Required?
        if (Dir == 1){ // Facing Right?
          iRKey = playerkeys(iPIndex, 0, "moveleft"); // "Left"
        } else { // Facing Left
          iRKey = playerkeys(iPIndex, 0, "moveright"); // "Right"
        }
      }

      if (Key=="J"){ //Jump Required?
        iRKey = playerkeys(iPIndex, 0, "jump"); // "Jump"
      }

      if (Key=="A"){ //Attack Required?
        iRKey = playerkeys(iPIndex, 0, "attack"); // "Attack"
      }

      if (Key=="S"){ //Special Required?
        iRKey = playerkeys(iPIndex, 0, "special"); // "Special"
      }
	  
	  if (Key=="A2"){ //Special Required?
        iRKey = playerkeys(iPIndex, 0, "attack2"); // "Special"
      }
	  
	  if (Key=="DJ"){
		iRKey = playerkeys(iPIndex, 0, "movedown", "jump");
	  }
	  
	  if (Key=="DA"){
		iRKey = playerkeys(iPIndex, 0, "movedown", "attack");
	  }
	  
	   if (Key=="DA2"){
		iRKey = playerkeys(iPIndex, 0, "movedown", "attack2");
	  }
	  
	  if (Key=="DF"){ //Forward Required?
        if (Dir == 0){ // Facing Left?
          iRKey = playerkeys(iPIndex, 0, "movedown", "moveleft"); // "Down" "Left"
        } else { // Facing Right
          iRKey = playerkeys(iPIndex, 0, "movedown", "moveright"); // "Down" "Right"
        }
      }
		
      if (Hflag==1){ //Not holding the button case?
        iRKey = !iRKey; //Take the opposite condition
      }

      if (iRKey){
        dasher( Vx, 0, 0 ); //Move!
        if (Ani=="ANI_IDLE"){ // Going idle?
          setidle(self, openborconstant("ANI_IDLE")); //Be idle!
        } else {
          performattack(self, openborconstant(Ani)); //Change the animation
        }
//        updateframe(self, Frame); //Change frame
          changeentityproperty(self, "animpos", Frame); //Change frame
      }
}
 
changeentityproperty(self, "animation", openborconstant(Ani));
performattack(self, openborconstant(Ani));

I know this one:
They do exactly as their name says, but they aren't the same and there are specific cases to use each one.

Changeentityproperty will JUST CHANGE the current animation to another one. But there several internal flags that won't be set if you do this and may lead to bugs. For example, if you change to a ATTACK, the engine doesn't knows that you are, in fact, attacking. The attack will occur, but many of the flags will be missing. I remember that if you use this for animations with jumpframe, it sets your x-velocity to zero or you can't jump at all (I can't remember right now).

Perform attack will change the animation too, but will set all the required flags, like "attacking", "jumping", "running", "idling" and so on. I remember MatMan (and DC too) saying that you should ALWAYS use performattack, thanks to those flags.

(correct me if I am wrong)

For example, I have anichange function and I made a anichangeattack function to make it easier

Code:
void anichangeattack(void Ani)
{// Animation changer
    void self = getlocalvar("self");

    performattack(self, openborconstant(Ani)); //Change the animation
}

Usage is:
@cmd anichangeattack "ANI_ATTACK3"
(all caps)
 
So performattack sets the flags automatically depending at which animation the player is switching, it does not matter that it is a jump, or attack. While changeentityproperty just switches the anim.

But my problems begins when i set performattack to idle and walk anims, tryed to do it whith both lines.

Performattack switches the anim but crashes randomly.
changeentityproperty does nothin on those anims, player tries to switch but dont do it.

Did you try performattack on idle and walks anims?
 
Goliath said:
So performattack sets the flags automatically depending at which animation the player is switching, it does not matter that it is a jump, or attack. While changeentityproperty just switches the anim.

No, it just sets it as if it will be an attack - which 90% of the time is what you want. For custom jumps and other occasional oddball things you are still better off to use changentityproperty() and configure the flags yourself.

DC
 
I´m setting the flags on keyscript, but i don´t know if its the correct form to set them, at first it was all smooth but now i´m getting some crashes.

Is this form to set flags correct in OpenBor?

Code:
void main()
{
	void self = getlocalvar("self"); // Get self
	int iPlIndex = getlocalvar("self"); //Get calling player
    void vSelf = getplayerproperty(iPlIndex , "entity"); //Get calling entity
    void vAniID = getentityproperty(vSelf,"animationID"); //Get current animation ID
    void vAniPos = getentityproperty(vSelf, "animpos"); //Get current animation frame
    int iDir = getentityproperty(vSelf, "direction");  //Get current facing direction

    void iUp = playerkeys(iPlIndex, 1, "moveup"); // New key status of "Up"
    void iDown = playerkeys(iPlIndex, 1, "movedown"); // New key status of "Down"
    void iLeft = playerkeys(iPlIndex, 1, "moveleft"); // New key status of "Left"
    void iRight = playerkeys(iPlIndex, 1, "moveright"); // New key status of "Right"
    void iJump = playerkeys(iPlIndex, 1, "jump"); //New key status of "Jump"
    void iSpecial = playerkeys(iPlIndex, 1, "Special"); //New key status of "Special"
    void iAttack = playerkeys(iPlIndex, 1, "attack"); //New key status of "Attack"
    void iAttack2 = playerkeys(iPlIndex, 1, "attack2"); // New key status of "Attack 2"
    void iAttack3 = playerkeys(iPlIndex, 1, "attack3"); // New key status of "Attack 3"
    void iAttack4 = playerkeys(iPlIndex, 1, "attack4"); // New key status of "Attack 4"

	void iUpR = playerkeys(iPlIndex, 2, "moveup"); // Release status of "moveup"
	void iDownR = playerkeys(iPlIndex, 2, "movedown"); // Release status of "movedown"
    void iLeftR = playerkeys(iPlIndex, 2, "moveleft"); // Release status of "Left"
    void iRightR = playerkeys(iPlIndex, 2, "moveright"); // Release status of "Right"
	void iJumpR = playerkeys(iPlIndex, 2, "jump"); // Release status of "Jump"
	void iSpecialR = playerkeys(iPlIndex, 2, "Special"); // Release status of "Special"
	void iAttackR = playerkeys(iPlIndex, 2, "attack"); //Release status of "Attack"
	void iAttack2R = playerkeys(iPlIndex, 2, "attack2"); // Release status of "Attack 2"
	void iAttack3R = playerkeys(iPlIndex, 2, "attack3"); // Release status of "Attack 3"
	void iAttack4R = playerkeys(iPlIndex, 2, "attack4"); // Release status of "Attack 4"

	if(vAniID == openborconstant("ANI_SPAWN"))
	{ //Spawn anim?
		if (iJump)
		{ //New jump key press?
			changeentityproperty(vSelf, "animation", openborconstant("ANI_FOLLOW11"));
			// Switch to PARACHUTE LANDING anim
		}
	}
	if(vAniID == openborconstant("ANI_FOLLOW15"))
	{ // Duck2 anim?
		if(iDownR)
		{ // Down key relesed?
			changeentityproperty(vSelf, "animation", openborconstant("ANI_IDLE"));
			// Change to IDLE anim
			changeentityproperty(vSelf, "velocity", 0, 0, 0);
			// Set velocity
			changeentityproperty(vSelf, "aiflag", "idling", 1);
			// Change to idle status
		}
		else if (vAniPos == 3 || vAniPos == 4 || vAniPos == 5 || vAniPos == 6 || vAniPos == 7 || vAniPos == 8 || vAniPos == 9 || vAniPos == 10)
		{ // Select frames
			if(iAttack)
			{ // Attack key press
				changeentityproperty(vSelf, "animation", openborconstant("ANI_DUCKATTACK"));
				// Change to Duckattack anim
			}
			else if(iRight)
			{ // Right key press
				changeentityproperty(vSelf, "animation", openborconstant("ANI_FOLLOW10"));
				// Change to Duck Walk
				changeentityproperty(self, "direction", 1);
				// Change to right facing
				changeentityproperty(self, "velocity", 0.5, 0, 0);
				// Set velocity
			}
			else if(iLeft)
			{ // Left key press
				changeentityproperty(vSelf, "animation", openborconstant("ANI_FOLLOW10"));
				// Change to Duck Walk
				changeentityproperty(self, "direction", 0);
				// Change to left facing
				changeentityproperty(self, "velocity", -0.5, 0, 0);
				// Set velocity
			}
			else if(iJump)
			{ // Jump key pressed?
				changeentityproperty(vSelf, "animation", openborconstant("ANI_JUMP"));
				// Change to jump anim
				changeentityproperty(vSelf, "aiflag", "idling", 0);
				// Set idling status off
				changeentityproperty(vSelf, "aiflag", "jumping", 1);
				// Set jump status on
				changeentityproperty(vSelf, "takeaction", "common_jump");
				// Set jump status on
				tossentity(vSelf, 3.5, 0, 0); // Jump
			}
			else if(iAttack)
			{ // Attack key press
				changeentityproperty(vSelf, "animation", openborconstant("ANI_DUCKATTACK"));
				// Change to Duckattack anim
			}
		}
	}
...
 
I dont know, as i told you i write some lines and then test the char to check that everything works, but that´s on a test level, when switch to the main game is when i get this error.

But the last think i did was "true key capture". I set the player with your contra mod system keys, keint, I think, and know i´m changing it to true keys capture.

The game starts but crashes randomly

Here is a video with the crash:

http://youtu.be/OXohzP_uSTI

This is the error log:

Code:
Function need a valid entity handle, the other 2 integer parameters are optional: performattack(entity, int anim, int resetable)
Script function 'performattack' returned an exception, check the manual for details.

OpCode: 8

OpCode: 8

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

There's an exception while executing script 'animationscript' data/chars/marco/marcomove.txtTotal Ram: 2147483647 Bytes
 Free Ram: 2061864960 Bytes
 Used Ram: 57782272 Bytes

And these are the calls:

anim duckattack
delay 1
offset 49 83
bbox 40 60 19 24
frame data/chars/marco/dckat00.png
delay 6
@cmd rangeAnim 0 35 34 "ANI_ATTACK4"
frame data/chars/marco/dckat00.png
@cmd shooter "Bullet" 32 16 3 0
frame data/chars/marco/dckat01.png
frame data/chars/marco/dckat02.png
frame data/chars/marco/dckat03.png
frame data/chars/marco/dckat04.png
frame data/chars/marco/dckat05.png
frame data/chars/marco/dckat06.png
frame data/chars/marco/dckat07.png
frame data/chars/marco/dckat08.png
@cmd aniframe "ANI_DUCK" 4
frame data/chars/marco/dckat09.png

anim attack1
delay 1
offset 49 83
bbox 42 48 17 36
frame data/chars/marco/at10.png
delay 5
@cmd rangeAnim -10 34 55 "ANI_ATTACK2"
frame data/chars/marco/at10.png
frame data/chars/marco/at11.png
@cmd shooter "Bullet" 34 26 3 0
frame data/chars/marco/at12.png
frame data/chars/marco/at13.png
frame data/chars/marco/at14.png
@cmd keyjump 3.5
frame data/chars/marco/at15.png
@cmd keyjump 3.5
frame data/chars/marco/at16.png
@cmd keyjump 3.5
frame data/chars/marco/at17.png
@cmd keyjump 3.5
frame data/chars/marco/at18.png
@cmd keyjump 3.5
@cmd anirand "ANI_FOLLOW8"
frame data/chars/marco/at19.png

anim follow2
delay 6
offset 49 83
bbox 41 46 17 38
@cmd rangeAnim -10 34 55 "ANI_ATTACK2"
frame data/chars/marco/sup00.png
@cmd shooter "Bltup" 0 66 0 5
frame data/chars/marco/sup01.png
frame data/chars/marco/sup02.png
frame data/chars/marco/sup03.png
frame data/chars/marco/sup04.png
frame data/chars/marco/sup05.png
frame data/chars/marco/sup06.png
frame data/chars/marco/sup07.png
frame data/chars/marco/sup08.png
frame data/chars/marco/sup09.png

#-------SHOOT & WALK
anim follow4
delay 1
offset 49 83
bbox 42 44 18 40
frame data/chars/marco/stwk00.png
@cmd keyjump 3.5
@cmd spawnbind "legs" 0 0 0 1 4
@cmd rangeAnim -10 34 55 "ANI_ATTACK2"
frame data/chars/marco/stwk00.png
delay 4
@cmd walkoff "ANI_FOLLOW7"
frame data/chars/marco/stwk00.png
delay 6
@cmd shooter "Bullet" 33 30 3 0
frame data/chars/marco/stwk01.png
frame data/chars/marco/stwk02.png
frame data/chars/marco/stwk03.png
@cmd walkoff "ANI_FOLLOW7"
frame data/chars/marco/stwk04.png
frame data/chars/marco/stwk05.png
frame data/chars/marco/stwk06.png
@cmd walkoff "ANI_FOLLOW7"
frame data/chars/marco/stwk07.png
frame data/chars/marco/stwk08.png
frame data/chars/marco/stwk09.png
@cmd walkoff "ANI_FOLLOW7"
@cmd anirand "FOLLOW8"
frame data/chars/marco/stwk10.png

#-------PARACHUTE FLYING
anim spawn
loop 1 2
delay 9
offset 79 83
bbox 70 50 16 37
@cmd degravity 0.97
@cmd flags 0 1 1 0 0
frame data/chars/marco/spw00.png
@cmd degravity 0.97
@cmd altitudchange "ANI_FOLLOW11"
frame data/chars/marco/spw00.png

anim idle
loop 1
delay 10
offset 49 83
bbox 42 47 17 37
@cmd clearL
@cmd flags 1 0 0 0 0
@cmd keyint2 "ANI_FOLLOW1" 0 "U" 0 0
frame data/chars/marco/idle00.png
@cmd keyint2 "ANI_FOLLOW1" 0 "U" 0 0
frame data/chars/marco/idle01.png
@cmd keyint2 "ANI_FOLLOW1" 0 "U" 0 0
frame data/chars/marco/idle02.png
@cmd keyint2 "ANI_FOLLOW1" 0 "U" 0 0
frame data/chars/marco/idle03.png
@cmd keyint2 "ANI_FOLLOW1" 0 "U" 0 0
frame data/chars/marco/idle02.png
@cmd keyint2 "ANI_FOLLOW1" 0 "U" 0 0
frame data/chars/marco/idle01.png
@cmd keyint2 "ANI_FOLLOW1" 0 "U" 0 0
frame data/chars/marco/idle00.png

anim walk
loop 1 6
delay 6
offset 49 83
bbox 41 44 18 40
@cmd keyint2 "ANI_FOLLOW5" 0 "F" 0 1
frame data/chars/marco/wlk00.png
@cmd walkoff "ANI_FOLLOW7"
frame data/chars/marco/wlk01.png
frame data/chars/marco/wlk02.png
frame data/chars/marco/wlk03.png
@cmd walkoff "ANI_FOLLOW7"
frame data/chars/marco/wlk04.png
frame data/chars/marco/wlk05.png
frame data/chars/marco/wlk06.png
@cmd walkoff "ANI_FOLLOW7"
frame data/chars/marco/wlk07.png
frame data/chars/marco/wlk08.png
frame data/chars/marco/wlk09.png
@cmd walkoff "ANI_FOLLOW7"
frame data/chars/marco/wlk10.png
frame data/chars/marco/wlk11.png
frame data/chars/marco/wlk12.png
@cmd walkoff "ANI_FOLLOW7"
frame data/chars/marco/wlk13.png
frame data/chars/marco/wlk14.png
frame data/chars/marco/wlk15.png

I don´t use performattack on key.c just getentityproperty
 
O Ilusionista said:
hum, what is the problem with the shadows at 0:33?

I dont know, but suppose the engine draws the shadow based on z coords defined on level. So if there is a platform you need to tell him that changes the z coords, someway.
 
Back
Top Bottom