Bugs in build 3849

Bloodbane

Well-known member
I discovered 2 bugs with build 3849:

1. Modders can't declare multiple spawnscripts now. Previously they are accepted
2. This function:
Code:
void looper(int Frame, int Limit)
{// Loops current animation
    void self = getlocalvar("self");
    void loop = getlocalvar("Loop" + self);

    if(loop==NULL()){ // Localvar empty?
      setlocalvar("Loop" + self, 0);
      loop = 0;
    } 
   
    if(loop < Limit){ // loops reach limit?
      updateframe(self, Frame); //Change frame
      setlocalvar("Loop" + self, loop+1); // Increment number of loops
    } else if(loop==Limit){ // loops reach limit?
      setlocalvar("Loop" + self, NULL());
    }
}

is broken in build 3849 while it works fine in older build (3805 for instance).
What I mean with broken is this looper function loops certain frames endlessly while it's supposed to loop only couple times (defined by Limit).
 
Yeah, multiple script support was removed. Now you can use #import plus inline script tags @script

See an example here:
http://www.chronocrash.com/forum/index.php?topic=305.msg2289#msg2289

Basically you can now use @script or a single spawnscript command or both.

spawn name
@script
// write whatever you want here
void main()
{

}
@end_script
coords 100 100
at 0


As for the second problem,  there's a hot fix you can do:

      updateframe(self, Frame); //Change frame
      setlocalvar("Loop" + self, loop+1); // Increment number of loops

To

      setlocalvar("Loop" + self, loop+1); // Increment number of loops
      updateframe(self, Frame); //Change frame

 
Ah so that's why looper function broke. I have to do some work to fix then.

Yeah, multiple script support was removed.

So are you saying, latest OpenBoR is not compatible with mods using multiple spawnscripts anymore?
 
Yeah.

And now for animation script, by default if you change animation (use damageentity against self, use updateframe, call performattack, or change animation using changeentityproperty), the animation script will be reset so lines behind them are not executed. Before that the result is kinda unpredictable when its animation script is called again before the previous one is done.
 
i need help to fix this script using the new rules

in this freespecial spiderman do  some kind of a human catapult  with his body
the first script part he should play the cant animation if dont have enouth energy to do the move
but with the new script rules, he is not recovering the energy when perform the cant animation

the other script problem here is he is not stoping on the last catapult frame and keeps looping while i hold attack button
i dont know how to fix  i need help
:)


anim freespecial8
@script

void vSelf = getlocalvar("self");
int iMP = getentityproperty(vSelf, "mp");
if ( getentityproperty(vSelf,"mp") < 20 )
  {
        //then play can't animation
        performattack(vSelf, openborconstant("ANI_CANT"), 0);
        changeentityproperty(vSelf, "mp", iMP + 20);
  }


@end_script
delay 7
offset 74 70
bbox 30 9 58 65
energycost 20 1
frame data/chars/ch2/swait01.pcx
offset 74 56
sound data/chars/ch2/teia2.wav
frame data/chars/ch2/swait02.pcx
offset 74 57
sound data/chars/ch2/estica.wav
frame data/chars/ch2/swait03.pcx
offset 74 57
frame data/chars/ch2/swait04.pcx
offset 75 70
frame data/chars/ch2/swait05.pcx
offset 83 55
frame data/chars/ch2/swait06.pcx
offset 99 48
delay 7
@cmd keyflip
@cmd keyint "ANI_CHARGEATTACK" 0 "U" 0 0
@cmd keyint "ANI_FREESPECIAL8" 5 "A" 0 0
sound data/chars/ch2/CHARGE.wav
frame data/chars/ch2/swait07.pcx
offset 28 51
hitflash bflash
seta 1
sound data/chars/ch2/runa.wav
hitfx data/sounds/beat2.wav
frame data/chars/ch2/j0.pcx
offset 41 85
@cmd velo001 12 0 2
bbox 16 15 66 46
sound data/chars/ch2/solta.wav
frame data/chars/ch2/swait08.pcx
offset 72 85
delay 35
fastattack 1
attack 63 29 115 42 30 2 0 0 25 0
bbox 15 9 89 52
frame data/chars/ch2/swait09.pcx
offset 43 101
delay 6
attack 0 0 0 0 0 0 0 0 0 0
bbox 21 10 53 68
frame data/chars/ch2/ra3.pcx
@cmd velo001 0.8 0 0.4
offset 43 85
frame data/chars/ch2/ra3.pcx
delay 8
SOUND data/sounds/get.wav
@cmd velo001 0.4 0 -2
offset 28 51
bbox 15 9 52 40
frame data/chars/ch2/j0.pcx
 
...
        changeentityproperty(vSelf, "mp", iMP + 20);
        performattack(vSelf, openborconstant("ANI_CANT"), 0);

...



This will fix mp.

As for the second, I don't quite understand. Doesn't @cmd  keyint "ANI_FREESPECIAL8" 5 "A" 0 0 mean go back to frame 5 until A button is released?




Edit*

Never mind, they seem to be the same issue.
 
As for the second, I don't quite understand. Doesn't @cmd  keyint "ANI_FREESPECIAL8" 5 "A" 0 0 mean go back to frame 5 until A button is released?

yes but instead to stop at this frame until i release the button its looping from 0 to 5 until i release the button
 
void keyint(void Ani, int Frame, void Key, int Hflag, int Limit)
{// Change current animation if proper key is pressed or released provided HP is more than limit
    void self = getlocalvar("self");
    void Health = getentityproperty(self,"health");   
    int iPIndex = getentityproperty(self,"playerindex"); //Get player index
    void iRKey;

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

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

      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"){ //Attack2 Required?
        iRKey = playerkeys(iPIndex, 0, "attack2"); // "Attack2"
}

      if (Key=="UJ"){ //Up and Jump Required?
        iRKey = playerkeys(iPIndex, 0, "moveup", "jump"); // "Up" + "Jump"
}

      if (Hflag==1){ //Not holding the button case?
        iRKey = !iRKey; //Take the opposite condition
}

      if ((Health > Limit)&&iRKey){
        changeentityproperty(self, "animation", openborconstant(Ani)); //Change the animation
        changeentityproperty(self, "animpos", Frame);

        if (Key=="UJ"){
          // This is copy of dethrown
          changeentityproperty(self, "attacking", 0);
          changeentityproperty(self, "damage_on_landing", 0);
          changeentityproperty(self, "projectile", 0);
        }
      }
}
 
This should fix your problem temporarily.
But that's right, the new system seems to be flawed to handle multpel frame/animation changes. Let me see if there's something I can do to get around this.


void keyint(void Ani, int Frame, void Key, int Hflag, int Limit)
{// Change current animation if proper key is pressed or released provided HP is more than limit
    void self = getlocalvar("self");
    void Health = getentityproperty(self,"health");   
    int iPIndex = getentityproperty(self,"playerindex"); //Get player index
    void iRKey;

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

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

      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"){ //Attack2 Required?
        iRKey = playerkeys(iPIndex, 0, "attack2"); // "Attack2"
  }

      if (Key=="UJ"){ //Up and Jump Required?
        iRKey = playerkeys(iPIndex, 0, "moveup", "jump"); // "Up" + "Jump"
  }

      if (Hflag==1){ //Not holding the button case?
        iRKey = !iRKey; //Take the opposite condition
  }

      if ((Health > Limit)&&iRKey){

        if (Key=="UJ"){
          // This is copy of dethrown
          changeentityproperty(self, "attacking", 0);
          changeentityproperty(self, "damage_on_landing", 0);
          changeentityproperty(self, "projectile", 0);
        }

        changeentityproperty(self, "animation", openborconstant(Ani), 0); //Change the animation
        changeentityproperty(self, "animpos", Frame);
      }
}
 
http://www.chronocrash.com/forum/index.php?topic=512.0

Or you can check the lastest build here: OpenBOR-win-latest.7z

changeentityproperty(self, "animation", openborconstant(Ani), 2) should do an animation change without invoking another animation script.

changeentityproperty(self, "animation", openborconstant(Ani), 2)

//other code here

updateframe(self, Frame); //when we are done update frame

// or changeentityproperty(self, "animpos", Frame); if you don't want to invoke animation script
 
i have used the first fix you made without the 2 new lines and it working right again

i dont know where i need to put the new 2 lines but it is working again

thnx for support  :P
 
Ah glad someone posted this, I discovered similar problem yesterday and I'm puzzled on how to solve it. I'm downloading this new build and see if it solves this problem.

BTW
changeentityproperty(self, "animation", openborconstant(Ani), 2)

I see there's another parameter for this. Aside of 2, what other accepted values here and what does each value do?

While I'm here, what's the difference in using
changeentityproperty and updateframe to change frame?
 
Change frame using changeentityproperty (or animation using that extra parameter 2) doesn't actually update the frame.

That is, something like jumpframe, throwframe, or animation script will not be invoked, so you can call updateframe manually later to make sure something is not updated multiple times (for example, throw multiple daggers, summon two entities, spawn two dusts).


 
It's only for that newest build I gave in previous link.

Sorry I have problem uploading here so just grab one from the dropbox link.

 
Back
Top Bottom