As you see in this grab, I use the move script to teleport the player to a new position.
It is very important to accompany the move script with antiall script to avoid errors.
anim grabforward
loop 0
delay 1
offset 82 177
bbox 0 0 0 0
attackone 0
sound data/chars/orchid/at0.wav
frame data/chars/orchid/grab.png
delay 4
@cmd slamstart
@cmd position 0 45 0 -1 0
frame data/chars/orchid/spawn11.png
@cmd dasher 4 0 0
@cmd position 0 45 0 -1 0
frame data/chars/orchid/spawn12.png
@cmd position 0 30 0 -1 0
frame data/chars/orchid/spawn13.png
@cmd position 0 15 0 -1 0
frame data/chars/orchid/spawn14.png
@cmd position 0 5 0 -1 0
frame data/chars/orchid/spawn15.png
@cmd position 0 -15 0 -1 0
frame data/chars/orchid/spawn16b.png
@cmd stop
@cmd position 0 -30 0 -1 0
frame data/chars/orchid/spawn17b.png
delay 1
@cmd move -11 0 0
@cmd antiwall -11 11 -1
@cmd position 0 -35 0 -1 -1
frame data/chars/orchid/backat12.png
delay 5
@cmd stop
@cmd position 0 -35 0 -1 -1
frame data/chars/orchid/backat12.png
frame data/chars/orchid/backat13.png
delay 12
@cmd position 0 -35 0 -1 -1
sound data/chars/orchid/at0.wav
frame data/chars/orchid/grabf01.png
sound data/sounds/beat.wav
@cmd hurt2 4
delay 16
@cmd position 0 -37 0 -1 -1
frame data/chars/orchid/grabf02.png
delay 12
@cmd position 0 -35 0 -1 -1
sound data/chars/orchid/at0.wav
frame data/chars/orchid/grabf01.png
sound data/sounds/beat.wav
@cmd hurt2 4
delay 16
@cmd position 0 -37 0 -1 -1
frame data/chars/orchid/grabf02.png
delay 12
@cmd position 0 -35 0 -1 -1
sound data/chars/orchid/at0.wav
frame data/chars/orchid/grabf01.png
sound data/sounds/beat.wav
@cmd hurt2 4
delay 16
@cmd position 0 -37 0 -1 -1
frame data/chars/orchid/grabf02.png
@cmd position 0 -35 0 -1 -1
sound data/chars/orchid/at0.wav
frame data/chars/orchid/grabf01.png
sound data/sounds/beat.wav
@cmd hurt2 4
delay 16
@cmd position 0 -37 0 -1 -1
frame data/chars/orchid/grabf02.png
delay 12
@cmd position 0 -35 0 -1 -1
sound data/chars/orchid/at0.wav
frame data/chars/orchid/grabf01.png
sound data/sounds/beat.wav
@cmd hurt2 4
delay 16
@cmd position 0 -37 0 -1 -1
frame data/chars/orchid/grabf02.png
delay 6
frame data/chars/orchid/backat12.png
delay 5
frame data/chars/orchid/backat13.png
delay 1
@cmd flip
@cmd position 0 37 0 -1 0
frame data/chars/orchid/grabat01.png
delay 4
sound data/chars/orchid/at3.wav
frame data/chars/orchid/grabat01.png
frame data/chars/orchid/grabat02.png
sound data/chars/orchid/at.wav
@cmd spawn01 "flash3" 20 100 1
frame data/chars/orchid/grabat03.png
delay 1
sound data/sounds/beat2.wav
@cmd depost 0
@cmd finish 15 1 2 2 0 1
frame data/chars/orchid/grabat03.png
delay 4
frame data/chars/orchid/grabat04.png
delay 20
frame data/chars/orchid/grabat05.png
delay 6
frame data/chars/orchid/grabat06.png
delay 4
frame data/chars/orchid/spawn12.png
frame data/chars/orchid/spawn11.png
frame data/chars/orchid/spawn10.png
frame data/chars/orchid/spawn9.png
frame data/chars/orchid/spawn8.png
An here the script move:
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
}
}
Antiwall scrit:
Code:
void antiwall(int Dist, int Move, int Distz)
{// Checks if there is wall at defined distance
// If there is wall, entity will be moved away with defined movement
void self = getlocalvar("self");
int Direction = getentityproperty(self, "direction");
int x = getentityproperty(self, "x");
int y = getentityproperty(self, "a");
int z = getentityproperty(self, "z");
float H;
float Hz;
float Hw;
if(Direction == 0){ //Is entity facing left?
Dist = -Dist; //Reverse Dist to match facing
Move = -Move; //Reverse Move to match facing
}
H = checkwall(x+Dist,z);
Hz = checkwall(x+Dist,z+Distz);
Hw = checkwall(x+Dist,z-Distz);
if(Hz > y && Hw <= y)
{
changeentityproperty(self, "position", x, z-Distz);
}
if(H > y)
{
changeentityproperty(self, "position", x+Move);
}
}