Solved Multiple landframe

Question that is answered or resolved.

dantedevil

Well-known member
I'm working to adapt my mod with the new system courtesy of msmalik681.
So now I have multiple deaths in the same animation, here the problem when find more than one death with landframe.
So I think to solve this need a landframe via scripts, to use more than one in the same animation.
 
Solution
My suggestion to replicate landframe with script is this:

anim fall
@script
    if(frame == 3){
      void self = getlocalvar("self");
      int y = getentityproperty(self,"y"); //Get character's y coordinate
      int b = getentityproperty(self,"base"); //Get character's base

      if(y > b){
        updateframe(self, 2);
      }
    }
@end_script
frame  data/chars/bee/fall1.png
frame  data/chars/bee/fall2.png
delay 1
frame  data/chars/bee/fall3.png
frame  data/chars/bee/fall3.png
delay 12
sound data/sounds/fall1.wav
frame data/chars/bee/fall4.png

The script compares altitude and base at 4th frame. If entity is above base IOW not landed, go back to 3rd frame and repeat. When entity lands the script won't go back...
I found a way to make this possible.
The idea is use an script to check altitude, then if if the altitude if the same of the check, the script perform the updateframe. So this way you can set the altitud and the specific frame to change.

I try with some scripts, but not work.

Here my try, one for use inline, and the other with complete script.
Code:
void AltiFrame(int Alti, int frame)
{
void self = getlocalvar("self"); //Caller.
      int Alti = getentityproperty(self, "a"); //get altitude
if(Alti==check){updateframe(self, frame);}
}

Code:
@script
    if(frame == 0){
      void self = getlocalvar("self");
      int Alti = getentityproperty(self, "a");

      if(Alti > 1){
        updateframe(self, "frame", frame5));
      }

    }
    @end_script

I prefer the first option, the Inline script.
 
O Ilusionista said:
If i am not wrong, you will need to check both y ("a" is deprecated) and "base".

Also, your code will work only on the first frame.

Sorry my friend, but my knowledge about script does not go further.
If you can help me correct, I will appreciate it very much.

I think the best option if this script check the altitude and if ok, jump to the next frame.
That's enough, because the next frame always have the lying enemy.

Example:
frame  data/chars/bee/fall1.png
frame  data/chars/bee/fall2.png
@cmd  AltiFrame 1
delay 999
frame  data/chars/bee/fall3.png
delay 12
sound data/sounds/fall1.wav
frame data/chars/bee/fall4.png

So if the script check the altitude of the red frame and is 1, then change to the next (blue) frame.
That's the behaviour I think is the best for this.
 
very good script you made but due to animpos there is no need for any input just use @cmd land in the frame before you want entity to land. this should work but is untested.

Code:
void Land()
{//scripted landframe by msmalik681
void self = getlocalvar("self"); //Caller.
int height = getentityproperty(self, "y"); //get altitude
int base = getentityproperty(self, "base"); //get base altitude
int frame = getentityproperty(self,"animpos"); //current animation frame


  if(height==base){ //if you hit the ground
  updateframe(self, frame+1); //update no next frame
  }
}
 
My suggestion to replicate landframe with script is this:

anim fall
@script
    if(frame == 3){
      void self = getlocalvar("self");
      int y = getentityproperty(self,"y"); //Get character's y coordinate
      int b = getentityproperty(self,"base"); //Get character's base

      if(y > b){
        updateframe(self, 2);
      }
    }
@end_script
frame  data/chars/bee/fall1.png
frame  data/chars/bee/fall2.png
delay 1
frame  data/chars/bee/fall3.png
frame  data/chars/bee/fall3.png
delay 12
sound data/sounds/fall1.wav
frame data/chars/bee/fall4.png

The script compares altitude and base at 4th frame. If entity is above base IOW not landed, go back to 3rd frame and repeat. When entity lands the script won't go back to 3rd frame and continues playing to 5th frame

This script can be multiplied to create multiple landframes in an animation

I have tested the multiple landframe script and it works :)
 
Solution
Back
Top Bottom