This works great, but the NPCs stop to attack, so unless you fight them in a small enclosed space, they're useless. So, seeing as this is within state code, I added a MoveToward function just before the delay so they would run after their target while attacking. Problem is, they don't seem to be able to execute any code under the MoveToward line until they get to their destination. And if you stand still, they never get to their destination, and just run around you until they give up and finish the attack.
- Code: Select all
if(RandInt <= 2) //NORMAL ATTACK
{
PlayAnimPivot('Attack',,0.1);
MoveToward(Enemy, GroundSpeed); //Nothing after this line gets called until finished!
Sleep(0.4); //Wait for the animation
if(VSize(Location-Enemy.Location) < 130)
{
Enemy.TakeDamage(6+RandInt, Self, Enemy.Location, vect(0,0,0), 'Shot');
DeusExPlayer(Enemy).ShakeView(0.8, 15.0, 30.0);
}
PlayRunning();
}
I tried MoveTo(Enemy.Location) as well, which is a little better than standing still, but has the same problem if the player stands still.
Basically, I need a way to leave the MoveToward() as soon as the Sleep() is finished. If anyone can help, I'd appreciate it, plus the mod would be significantly better.