Solved Script to change altitude?

Question that is answered or resolved.

dantedevil

Well-known member
I have some change of animation in the weapon fatality, when the enemy appear with a certain altitude of the floor. I want set in the beginning of this animation an altitude 0.
I try with @cmd move 0 0 -10, but the frame shows wrong, below the floor line and then back to the correct position.
This look very bad :-\
 
Last edited:
Solution
Hmmm... why not use simple script like this:

Code:
@script
    if(frame==1){
      void self = getlocalvar("self");

      changeentityproperty(self, "position", NULL(), NULL(), 0);    
    }
@end_script

This script will put entity at y = 0 at frame 1
O Ilusionista said:
Isn't the last value of that function the z value? And as far as I know, openbor doesn't let you spawn an entity bellow the ground.

Code:
void move(int dx, int dz,int da)
{ // Moves entity freely and ignores obstacles
    void self = getlocalvar("self");
    int x = getentityproperty(self,"x"); //Get character's x coordinate
    int z = getentityproperty(self,"z"); //Get character's z coordinate
    int a = getentityproperty(self,"a"); //Get character's a coordinate
    int dir = getentityproperty(self,"direction"); //Get character's facing direction

     if(dir==0){ // Facing left?
      changeentityproperty(self, "position", x-dx, z+dz, a+da); //Move
     }
     else if(dir==1){ // Facing right?
      changeentityproperty(self, "position", x+dx, z+dz, a+da); //Move
     }
}

O only want change the altitud of the animation to 0.
 
Unless the floor has hole, you can place the platform entity below 0 altitude with the link below. OTOH If you want to set the entity below the floor but retain his/her own altitude position of 0, you can set the entity's base to below 0 with a set of -99999.

http://www.chronocrash.com/forum/index.php?topic=2906.msg40862#msg40862

Otherwise, you could immune the entity's "base" by setting -99999 in script in the first frame. Then you can make it normal in the last frame.

Code:
anim follow43 #Lifted up from elevator
@script
void self = getlocalvar("self");
if(frame == 0){
    changeentityproperty(self, "base", -99999);
    changeentityproperty(self, "no_adjust_base", 1);
    changeentityproperty(self, "subject_to_gravity", 0);
}
if(frame == 6){
    changeentityproperty(self, "base", 0);
    changeentityproperty(self, "no_adjust_base", 0);
    changeentityproperty(self, "subject_to_gravity", 1);
}
@end_script
delay 25
offset 65 122
frame data/chars/stone/stand1.png
frame data/chars/stone/stand2.png
frame data/chars/stone/stand3.png
frame data/chars/stone/walk06.png
frame data/chars/stone/atk1-4.png
frame data/chars/stone/pain4.png
delay 2
frame data/chars/stone/pain4.png

I'm not sure if it works but you can try. If not, try this without no_adjust_base.

Code:
@script
void self = getlocalvar("self");
if(frame == 0){
    changeentityproperty(self, "base", -99999);
    changeentityproperty(self, "subject_to_gravity", 0);
}
if(frame == 6){
    changeentityproperty(self, "base", 0);
    changeentityproperty(self, "subject_to_gravity", 1);
}
@end_script
 
Hmmm... why not use simple script like this:

Code:
@script
    if(frame==1){
      void self = getlocalvar("self");

      changeentityproperty(self, "position", NULL(), NULL(), 0);    
    }
@end_script

This script will put entity at y = 0 at frame 1
 
Solution
Thanks both for the help my friend!

I finally decided to use Bloodbane's suggestion, but I converted the script to use it inline.
Code:
void altitude0()
{// change altitude to 0
    void self = getlocalvar("self");

      changeentityproperty(self, "position", NULL(), NULL(), 0);   
}

Thanks!
 
Back
Top Bottom