package.path = "scriptbank/?.lua;" require('ai_zombiewalk') --name of AI script to use (no .lua needed) --57 ~ 2 = fat & clown zombie local trigger_range = 600 -- when zombie begins to stand up local delay = 0.1 --if animation is too fast increase delay here local min_frame = 2 --dead frame local max_frame = 57 --standing up frame local speed = 3 --how many frames to change in 1 step local current_frame = {} local state = {} function ai_fake_dead_init(e) state[e] = "wait" current_frame[e] = max_frame SetAnimationFrame(e,max_frame) end function ai_fake_dead_main(e) if state[e] == "wait" then StartTimer(e) if g_Entity[e]['animating'] == 0 then SetAnimationFrames(current_frame[e],current_frame[e]) PlayAnimation(e) g_Entity[e]['animating'] = 1 end --SetAnimationFrame(e,max_frame) if GetPlayerDistance(e) < trigger_range then ai_soldier_state[e] = "patrol" SetAnimationFrame(e,57) --radarFoundEnemies = 0 enemyCount = enemyCount + 1 radarEnemies[enemyCount] = e radarEnemySprites[enemyCount] = CreateSprite( radarImageRed ) SetSpriteOffset ( radarEnemySprites[enemyCount] , 0.25 , -1 ) SetSpriteSize ( radarEnemySprites[enemyCount] , 0.5 , -1 ) SetSpritePosition ( radarEnemySprites[enemyCount] , 200 , 200 ) state[e] = "get up" PlaySound(e,1) end elseif state[e] == "get up" then if current_frame[e] > min_frame then if GetTimer(e) > delay then StartTimer(e) if current_frame[e] < 40 and current_frame[e] > 30 then current_frame[e] = 30 end if g_Entity[e]['animating'] == 0 then SetAnimationFrames(current_frame[e],current_frame[e]) PlayAnimation(e) g_Entity[e]['animating'] = 1 current_frame[e] = current_frame[e] - speed end end else ai_zombiewalk_init(e) RotateToPlayer(e) AIEntityGoToPosition(g_Entity[e]['obj'],g_PlayerPosX,g_PlayerPosZ) state[e] = "alive" end elseif state[e] == "alive" then ai_zombiewalk_main(e) end --state --Prompt(GetAnimationFrame(e)) end function ai_fake_dead_exit(e) ai_zombiewalk_exit(e) end