Good News
I think aigotoentity was bugging script (seems ai related commands bug scripts), so I changed it to MoveForward(e,v) and few other calls. Made multiple animation-based scripts for the zombies and placed em in a map I have alot of trees and models, scripts running, audio and more, and all zombies worked 100%. I forgot to set Anim Speed and Speed of some, and player distance condition too, that why few zombies takes a lil to react in the video.
Video below:
Script below (mine + AmenMoses combined):
g_new_ai_zombie_state = {}
function new_ai_zombie_init( e )
g_new_ai_zombie_state[ e ] = 0
CharacterControlLimbo( e )
SetAnimationFrames( 493, 494 )
PlayAnimation( e )
end
function new_ai_zombie_main( e )
local Ent = g_Entity[ e ]
local playerDist = GetPlayerDistance( e )
if playerDist < 500 and g_new_ai_zombie_state[ e ] == 0 then -- Starting Animation (Zombie rises)
SetAnimationFrames( 495, 522)
SetAnimationSpeed( e, 1 )
PlayAnimation( e )
g_new_ai_zombie_state[ e ] = 'rising'
PlaySound(e,0)
elseif
g_new_ai_zombie_state[ e ] == 'rising' and
GetAnimationFrame( e ) >= 520 then -- Preparing Second Animation (Run To Player)
g_new_ai_zombie_state[ e ] = 'runtoplayer'
elseif
g_new_ai_zombie_state[ e ] == 'attack' then -- Zombie Attack Player
CharacterControlLimbo( e )
SetAnimationSpeed( e, 2 )
SetAnimationFrames( 2981, 3034 )
LoopAnimation( e )
PlaySound(e,1)
g_new_ai_zombie_state[ e ] = 'attacking'
elseif
g_new_ai_zombie_state[ e ] == 'attacking' and playerDist >= 100 then -- If player get out of range, zombie chases again
g_new_ai_zombie_state[ e ] = 'runtoplayer'
elseif
GetAnimationFrame( e ) >= 3010 and GetAnimationFrame(e) <= 3034 and playerDist <= 100 then -- If player is in range while Zombie is at specific frame animation (Claws near), player got damaged
HurtPlayer( e, 2 )
end
if g_new_ai_zombie_state[ e ] == 'running' and playerDist < 100 then -- Preparing Attack
g_new_ai_zombie_state[ e ] = 'attack'
end
if g_new_ai_zombie_state[ e ] == 'runtoplayer' then -- Zombie runs to Player
SetAnimationFrames( 300, 318)
SetAnimationSpeed( e, 1 )
LoopAnimation( e )
g_new_ai_zombie_state [ e ] = 'running'
end
if g_new_ai_zombie_state [ e ] == 'running' then
RotateToPlayer(e)
MoveForward(e,200)
end
end
Guess that's the solution for now for gg zombie AI, lemme know guys if you could test it and confirm.