move script help

Gurtag

Active member
hey guys i have been using script to replace move command as it is unreliable at the times.. but say script lacks some control.. wantedt to ask how can i mod it so it afects more than one frame at the time and also set at what frame stop if needed.....

this is the code..

Code:
void mover(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
     }
}

currently i use it like this

Code:
anim    pain5
    loop    0
    delay    8
    @cmd    mover -6 0 0
    bbox    12 1 35 111
    offset    31 129
    frame    data/chars/monk3/5000-20.gif
    @cmd    mover -6 0 0
    frame    data/chars/monk3/5000-20.gif
    @cmd    mover -6 0 0
    offset    29 136
    frame    data/chars/monk3/5000-0.gif
    @cmd    mover -6 0 0
    frame    data/chars/monk3/5000-0.gif

have to put it in every frame i want to move wich is a pita in larger animations...
 
hey guys i have been using script to replace move command as it is unreliable at the times.. but say script lacks some control.. wantedt to ask how can i mod it so it afects more than one frame at the time and also set at what frame stop if needed.....

this is the code..

Code:
void mover(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
     }
}

currently i use it like this

Code:
anim    pain5
    loop    0
    delay    8
    @cmd    mover -6 0 0
    bbox    12 1 35 111
    offset    31 129
    frame    data/chars/monk3/5000-20.gif
    @cmd    mover -6 0 0
    frame    data/chars/monk3/5000-20.gif
    @cmd    mover -6 0 0
    offset    29 136
    frame    data/chars/monk3/5000-0.gif
    @cmd    mover -6 0 0
    frame    data/chars/monk3/5000-0.gif

have to put it in every frame i want to move wich is a pita in larger animations...
If you want the entire animation to take effect, try adding it to the character's file like this. However, make sure to link the script to the correct file path.
1788598732839.png
 
Last edited:
If you want the entire animation to take effect, try adding it to the character's file like this. However, make sure to link the script to the correct file path.
View attachment 15907
never try that thanks for the tip man...


Why not declare it like this:
C:
anim    pain5
@script
  mover(-6, 0, 0);
@end_script
...

The mover function will be run at each frame.
hey man, i use that one too but it lacks the option to stop at say frame in same animation..
 
Back
Top Bottom