[DECORATE] Enemies falling back from last direction shot?
- FranckyFox2468
- Forum Regular
- Posts: 180
- Joined: Sat May 07, 2016 8:30 pm
[DECORATE] Enemies falling back from last direction shot?
Is there a way to make an enemy being pushed back from the last direction they were shot for a pain/death animation? Some would say to use a_facetarget but it acts really oddly in multiplayer as the monster falls back from the last player its facing and no not the projectile/hitscan it got shot by
[DECORATE] Re: Enemies falling back from last direction shot?
You have to calculate the angle that'd make the monster face the target (the guy who shot the monster, in your case) then apply a force in the opposite direction of it.FranckyFox2468 wrote:Is there a way to make an enemy being pushed back from the last direction they were shot for a pain/death animation? Some would say to use a_facetarget but it acts really oddly in multiplayer as the monster falls back from the last player its facing and no not the projectile/hitscan it got shot by
=== RAGNAROK DM ON ... uh... dead forever? ===
=== ALWAYS BET ON ... uh... dead forever? ===
=== Who wanta sum wang? ===
=== Death and Decay - A new Monster/Weapon replacer ===
=== ALWAYS BET ON ... uh... dead forever? ===
=== Who wanta sum wang? ===
=== Death and Decay - A new Monster/Weapon replacer ===
- FranckyFox2468
- Forum Regular
- Posts: 180
- Joined: Sat May 07, 2016 8:30 pm
[DECORATE] Re: Enemies falling back from last direction shot?
...How exactly do i do that?
[DECORATE] Re: Enemies falling back from last direction shot?
FranckyFox2468 wrote:...How exactly do i do that?
Code: Select all
// returns fixed distance
function int AproxDistance (int dx, int dy) {
dx = abs(dx);
dy = abs(dy);
if (dx < dy)
return dx + dy - (dx >> 1);
return dx + dy - (dy >> 1);
}
function void FaceActor(int m1, int m2) {
int xdiff = GetActorX(m2) - GetActorX(m1);
int ydiff = GetActorY(m2) - GetActorY(m1);
int zdiff = (GetActorZ(m2) + GetActorProperty(m2, APROP_HEIGHT)) - (GetActorZ(m1) + GetActorProperty(m1, APROP_HEIGHT));
int dist = AproxDistance(xdiff, ydiff);
SetActorAngle(m1, VectorAngle(xdiff, ydiff));
dist = FixedDiv(dist, 256.0);
zdiff = FixedDiv(zdiff, 256.0);
int tpitch = -VectorAngle(dist, zdiff);
SetActorPitch(m1, tpitch);
}
=== RAGNAROK DM ON ... uh... dead forever? ===
=== ALWAYS BET ON ... uh... dead forever? ===
=== Who wanta sum wang? ===
=== Death and Decay - A new Monster/Weapon replacer ===
=== ALWAYS BET ON ... uh... dead forever? ===
=== Who wanta sum wang? ===
=== Death and Decay - A new Monster/Weapon replacer ===
- FranckyFox2468
- Forum Regular
- Posts: 180
- Joined: Sat May 07, 2016 8:30 pm
[DECORATE] Re: Enemies falling back from last direction shot?
I was rather looking for something that works in decorate but if there is nothing else...