Convert inline to @cmd

xyz555

Member
please tell me thank you

I have a script here

It allows the entity to be between certain frames and can reach the position coordinates I need
it works perfectly

But I don't know how can I convert it into @cmd way to use
please all help :):):)

@script
if (frame==7){
void self = getlocalvar("self");
float Tx = getentityproperty(self, "x");
float Tz = getentityproperty(self, "z");
int Dir = getentityproperty(self, "direction");
float Tz1 = Tz+1;
float Tx1 = Tx+1;
if(Dir==1){
changeentityproperty(self, "position", Tx-68, Tz1, 0);
} else if (Dir==0){
changeentityproperty(self, "position", Tx+68, Tz1, 0);
}
} else if (frame==8){
void self = getlocalvar("self");
float Tx = getentityproperty(self, "x");
float Tz = getentityproperty(self, "z");
int Dir = getentityproperty(self, "direction");
float Tz1 = Tz+1;
float Tx1 = Tx+1;
if(Dir==1){
changeentityproperty(self, "position", Tx-24, Tz1, 0);
} else if (Dir==0){
changeentityproperty(self, "position", Tx+24, Tz1, 0);
}
} else if (frame==14){
void self = getlocalvar("self");
float Tx = getentityproperty(self, "x");
float Tz = getentityproperty(self, "z");
int Dir = getentityproperty(self, "direction");
float Tz1 = Tz+1;
float Tx1 = Tx+1;
if(Dir==1){
changeentityproperty(self, "position", Tx-34, Tz1, 0);
} else if (Dir==0){
changeentityproperty(self, "position", Tx+34, Tz1, 0);
}
}
@end_script

I am very thank you all !!
 
Some lines look strange while other look redundant :unsure:. But I can find pattern 😎 there so my suggested function is this:
C:
void Posisi(int dx, int dy, int dz)
{
    void self = getlocalvar("self");
    float x = getentityproperty(self, "x");
    float z = getentityproperty(self, "z");
    int Dir = getentityproperty(self, "direction");

    if(Dir==1){
      changeentityproperty(self, "position", x-dx, z + dz, dy);
    } else if (Dir==0){
      changeentityproperty(self, "position", x+dx, z + dz, dy);
    }
}

Copy and paste that into your animation script :).
Usage example (based on above script):
Code:
 frame    ...
 frame    ...
 frame    ...
 frame    ...
 frame    ...
 frame    ...
 frame    ...
 @cmd    Posisi 68 0 1
 frame    ...
 @cmd    Posisi 24 0 1
 frame    ...
 frame    ...
 frame    ...
 frame    ...
 frame    ...
 frame    ...
 @cmd    Posisi 34 0 1
 frame    ...

HTH
 
Some lines look strange while other look redundant :unsure:. But I can find pattern 😎 there so my suggested function is this:
C:
void Posisi(int dx, int dy, int dz)
{
    void self = getlocalvar("self");
    float x = getentityproperty(self, "x");
    float z = getentityproperty(self, "z");
    int Dir = getentityproperty(self, "direction");

    if(Dir==1){
      changeentityproperty(self, "position", x-dx, z + dz, dy);
    } else if (Dir==0){
      changeentityproperty(self, "position", x+dx, z + dz, dy);
    }
}

Copy and paste that into your animation script :).
Usage example (based on above script):
Code:
 frame    ...
 frame    ...
 frame    ...
 frame    ...
 frame    ...
 frame    ...
 frame    ...
 @cmd    Posisi 68 0 1
 frame    ...
 @cmd    Posisi 24 0 1
 frame    ...
 frame    ...
 frame    ...
 frame    ...
 frame    ...
 frame    ...
 @cmd    Posisi 34 0 1
 frame    ...

HTH
Once again, thank you very much Bloodbane sir for coming out to help me every time I am in trouble
I must thank you from the bottom of my heart


But a certain effect of the game I made
It is indeed necessary to use this method
I'll show you the situation
 
Because of this, he must be holding the enemy, and the coordinates are moving forward
I can't use any move commands here
Because the desired effect is more difficult to grasp

anigif.gif


This coordinates of the main pictures are the same
I have tried using the move command
But the effect is not ideal
So I use a script to achieve its effect
the result is perfect

Maybe my production level is not enough
But anyway I am very grateful for your help
I wish you a happy life and good health, thank you!!!:giggle::giggle::giggle:
 
Back
Top Bottom