Thank you. I'm not very good at writing scripts, so I'll try to solve it slowly.Aa i said already, the only stable way to do as you ask is to script bind the grab just like a slam.
DC
I want to make it so that the position of the enemy caught by the player is the same, but the player's height is different, so I want to make it so that it is caught and lifted.For the normal grab, I would make it to grab the enemy on the ground, on the same position for everyone. It would be simpler that way.
This would save you work and you can let this for the other moves, like grab forward or backward
Yes, I got it. I am just trying to make your life easierI want to make it so that the position of the enemy caught by the player is the same, but the player's height is different, so I want to make it so that it is caught and lifted.
void checkHeight()
{//Changes animation according to opponent height
void self = getlocalvar("self");
void target = getentityproperty(self, "opponent");
if(target != NULL()){
int height = getentityproperty(target, "height");
if(height >= 70 && height < 80){
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW1"));
}else
if(height >= 80 && height < 90){
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW2"));
}
}
}
anim grabbed
loop 0
delay 8
offset 141 172 # GROUND
bbox 130 113 26 61
@cmd checkHeight
frame data/chars/enemies/galsia/sor2/grabbed00.png
anim follow1
loop 0
delay 8
offset 141 182 # HEIGHT 70-79
bbox 130 113 26 61
frame data/chars/enemies/galsia/sor2/grabbed00.png
anim follow2
loop 0
delay 8
offset 141 192 # HEIGHT 80-89
bbox 130 113 26 61
frame data/chars/enemies/galsia/sor2/grabbed00.png
@DD Tokki I was doing some tests found a way to simulate it by detecting the opponent height and changing between animations with different offsets.
Code:void checkHeight() {//Changes animation according to opponent height void self = getlocalvar("self"); void target = getentityproperty(self, "opponent"); if(target != NULL()){ int height = getentityproperty(target, "height"); if(height >= 70 && height < 79){ changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW1")); }else if(height >= 80 && height < 89){ changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW2")); } } }
Code:anim grabbed loop 0 delay 8 offset 141 172 # GROUND bbox 130 113 26 61 @cmd checkHeight frame data/chars/enemies/galsia/sor2/grabbed00.png anim follow1 loop 0 delay 8 offset 141 182 # HEIGHT 70-79 bbox 130 113 26 61 frame data/chars/enemies/galsia/sor2/grabbed00.png anim follow2 loop 0 delay 8 offset 141 192 # HEIGHT 80-89 bbox 130 113 26 61 frame data/chars/enemies/galsia/sor2/grabbed00.png
anim grab (player)
loop 0
cancel 0 1 0 u a2 freespecial6
cancel 0 1 0 d a2 freespecial8
cancel 0 1 0 f a2 freespecial7
cancel 0 1 0 b a2 freespecial7
cancel 0 1 0 a2 freespecial5
cancel 0 1 0 a3 freespecial10
delay 1
offset 38 107
bbox 17 0 45 103
attack 0 0 0 0 0 0 0 0 0 0
@cmd degravity -0.5
frame data/sprites/sprite/chara/01r/grab.gif
anim grabbed (enemy)
loop 0
delay 100
offset 22 75
bbox -3 0 50 76
@cmd degravity -0.5
@cmd nograb 0
@cmd depost 0
@cmd finishP 0 1 2 2 0 1
@cmd checkHeight
@cmd clearL
movez -1
frame data/sprites/sprite/chara/e01tn/pain-b03.gif
movez 0
frame data/sprites/sprite/chara/e01tn/pain-b03.gif
You need to define the height in each character header, like the image below. Usually I define the value based on the idle sprite size.
View attachment 8923
View attachment 8922
void checkHeight()
{//Changes animation according to opponent height
void self = getlocalvar("self");
void target = getentityproperty(self, "opponent");
if(target != NULL()){
int height = getentityproperty(target, "height");
if(height >= 70 && height < 79){
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW200"));
}else
if(height >= 80 && height < 89){
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW201"));
}else
if(height >= 90 && height < 99){
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW202"));
}else
if(height >= 100 && height < 109){
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW203"));
}else
if(height >= 110 && height < 119){
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW204"));
}else
if(height >= 120 && height < 129){
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW205"));
}else
if(height >= 130 && height < 139){
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW206"));
}else
if(height >= 140 && height < 149){
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW207"));
}else
if(height >= 150 && height < 159){
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW208"));
}else
if(height >= 160 && height < 169){
changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW209"));
}
}
}
height >= 70 && height < 79
<
symbol means one value is smaller than that particular value. If you were to put height 79 in the character header of the player, the enemy will only default to play its anim grabbed instead of anim follow200 from your code.<
, try to add less than or equal to symbol <=
like this.height >= 70 && height <= 79
height >= 70 && height < 80
There are many mistakes in the test. I will correct the numbers.I don't wanna sound mad or harsh, but why is this part only less than 79?
You're telling it to detect its height numbers between 70 and 78, not 79. You're just leaving 79 out of it. This less than<
symbol means one value is smaller than that particular value. If you were to put height 79 in the character header of the player, the enemy will only default to play its anim grabbed instead of anim follow200 from your code.
Example:
One less than two. (e.g. 1 < 2) One is smaller than two. It cannot be two less than two because they are the same numbers. (e.g. 2 < 2)
The better way to do this, since you only added it less than<
, try to add less than or equal to symbol<=
like this.
Example:
The less than or equal to symbol is what can equal the same number OR have one number smaller than the other since it has two conditions. Less than or equal to.
That way, you can detect it with a given number there. Just be careful with the symbols.
Otherwise, you can copy one example from @Kratus which he put < 80 above. This one here reads from 70-79 below.
Can you tell the difference?
for Robert and Yuri, I would use this on his header:
For your case, here's a basic difference between < and <=.Available operators:
- +
- -
- *
- /
- %
- =
- +=
- -=
- /=
- *=
- %=
- ! (it works for constants too from r4340+)
- ==
- ||
- &&
- !=
- >
- <
- >=
- <=
- ~ (from r4316+)
- ^
- |
- &
- <<
- >>
- <<= (from r4316+)
- >>= (from r4316+)
- &= (from r4316+)
- |= (from r4316+)
- ^= (from r4316+)