This works now and is based off triggers. the two scripts are pretty simple to use and you will need a ai script for the zombies that are in the area you will need them.
the safe zone script
-- LUA Script - precede every function and global member with lowercase name of script + '_main'
-- Player Enters Zone
safe_zone = false
function plrinzone_init(e)
end
function plrinzone_main(e)
if g_Entity[e]['plrinzone']==1 then
PlaySound(e,0)
safe_zone = true
elseif pdist > 80 then
safe_zone = false
end
end
the zombies script
--[[
This is the safe zone script!
--]]
attackstart = {}
attackend = {}
damageframestart = {}
damageframeend = {}
lastroar = {}
lastswipe = {}
function ai_zombiewalk_init(e)
ai_soldier_state[e] = "idle"
CharacterControlLimbo(e)
SetAnimationFrames(210,234)
LoopAnimation(e)
ModulateSpeed(e,1.0)
SetAnimationSpeed(e,0.1)
attackstart[e]=683
attackend[e]=722
damageframestart[e]=695
damageframeend[e]=715
lastroar[e]=0
lastswipe[e]=0
end
function ai_zombiewalk_main(e)
PlayerDist = GetPlayerDistance(e)
EntObjNo = g_Entity[e]['obj']
if (PlayerDist < 1000 and ai_soldier_state[e] == "idle" and g_Entity[e]['plrvisible'] == 1) or (PlayerDist < 100 and ai_soldier_state[e] == "idle") then
RotateToPlayer(e)
if GetTimer(e) > lastroar[e] then
lastroar[e]=GetTimer(e)+5000
PlaySound(e,0)
end
end
if PlayerDist < 600 and g_Entity[e]['plrvisible']==1 then
RotateToPlayer(e)
if PlayerDist < 60 and g_Entity[e]['plrvisible']==1 then
if ai_soldier_state[e]~="attack" then
SetAnimationSpeed(e,1.75)
if GetAnimationFrame(e)<attackstart[e] or GetAnimationFrame(e)>attackend[e] then
AIEntityStop(EntObjNo)
ai_soldier_state[e] = "attack"
CharacterControlLimbo(e)
SetAnimationFrames(attackstart[e],attackend[e])
PlayAnimation(e)
g_Entity[e]['animating'] = 1
end
else
if ai_soldier_state[e]=="attack" then
if GetAnimationFrame(e)>damageframestart[e] and GetAnimationFrame(e)<damageframeend[e] then
if GetPlayerDistance(e)<60 then
if GetTimer(e) > lastswipe[e] then
lastswipe[e]= GetTimer(e)+1000
PlaySound(e,1)
if safe_zone == true then
HurtPlayer(e,randomdamage)
randomdamage=0
elseif safe_zone == false then
randomdamage=math.random(20,50)
HurtPlayer(e,randomdamage)
end
--HurtPlayer(e,randomdamage)
end
end
end
if g_Entity[e]['animating']==0 then
ai_soldier_state[e] = "idle"
CharacterControlLimbo(e)
SetAnimationFrames(210,234)
PlayAnimation(e)
RotateToPlayer(e)
end
end
end
else
if ai_soldier_state[e]~="roam" then
ai_soldier_state[e] = "roam"
CharacterControlUnarmed(e)
ModulateSpeed(e,1.0)
SetAnimationSpeed(e,1.5)
SetCharacterToWalk(e)
end
rndx=math.random(1,360)
rndz=math.random(1,360)
rndx2=math.sin(rndx)*30
rndz2=math.cos(rndz)*30
AIEntityGoToPosition(EntObjNo,g_PlayerPosX+rndx2,g_PlayerPosZ+rndz2)
end
else
if PlayerDist >= 600 and ai_soldier_state[e] ~= "idle" then
ai_soldier_state[e] = "idle"
CharacterControlLimbo(e)
SetAnimationFrames(210,234)
LoopAnimation(e)
ModulateSpeed(e,1.0)
SetAnimationSpeed(e,1.0)
end
end
if string.find(string.lower(g_Entity[e]['limbhit']), "head") ~= nil then
SetEntityHealth(e,0)
ResetLimbHit(e)
end
--PromptLocal(e,"ZOMBIEWALK : Dist=" .. PlayerDist .. " State=" .. ai_soldier_state[e] .. " Vis=" .. g_Entity[e]['plrvisible'] .. " Frm=" .. GetAnimationFrame(e) )
end
function ai_zombiewalk_exit(e)
PlayCharacterSound(e,"onDeath")
CollisionOff(e)
end
the zombie ai shouldnt do any damage to you, if safe_zone is true.
Markchapman10 is my Skype let's have some dev talk.