@name Robotboy655's Pet Zombie.. lol
@persist B [T P]:entity

interval(100)

#ifdef holoAnim(number,number)
    if(first())
    {
        holoCreate(1)
        holoModel(1,"models/Zombie/Classic.mdl")
        holoParent(1,entity())
        holoAnim(1,26)
    }
    if(B == 0)
    {
        findIncludeClass("npc*")
        #findIncludeClass("player")
        findInSphere(entity():pos(),100)
        T = findResult(1)
        if(T)
        {
            holoAnim(1,27)
            timer("hax",3500)
            holoEntity(1):soundPlay(0,0,"npc/zombie/zombie_alert"+randint(1,3) + ".wav")
            B = 1
        }
    }
    if(clk("hax"))
    {
        B = 2
        holoAnim(1,1)
        holoEntity(1):soundPlay(1,0,"npc/zombie/moan_loop" + randint(1,4) + ".wav")
    }
    if(B == 2)
    {
        Dir = (holoEntity(1):pos() - T:pos())
        Ang = Dir:toAngle():setPitch(0)
        holoPos(1,holoEntity(1):pos() - Dir:normalized() * 5)
        holoAng(1,Ang:setYaw(Ang:yaw() - 180))
    }
    if(holoEntity(1):pos():distance(T:pos()) > 50 & B == 3)
    {
        B = 2
        holoAnim(1,1)
        stoptimer("newatc")
        stoptimer("idle")
    }
    elseif(holoEntity(1):pos():distance(T:pos()) < 50 & (B == 2 | B == 4))
    {
        B = 3
        
        holoEntity(1):soundPlay(2,0,"npc/zombie/zo_attack"+randint(1,2)+".wav")
    
        holoAnim(1,randint(8,11))

    
        #P = propSpawn("models/Roller.mdl",T:pos() + T:up() * 100,0)
        #P:setAlpha(0)
        #P:applyForce(vec(0,0,-1000000))

        timer("idle",holoAnimLength(1) * 1000)
    }
    if(clk("idle"))
    {
        holoAnim(1,0)
        timer("newatc",2000)
        #if(P)
        #{
        ##    P:propDelete()
        #}
    }
    
    if(clk("newatc"))
    {
        B = 4
    }
    
    if(!T)
    {
        findIncludeClass("npc*")
        #findIncludeClass("player")
        findInSphere(holoEntity(1):pos(),1000)
        findSortByDistance(holoEntity(1):pos())
        T = findResult(1)
    }
#else
    hint("Robotboy655: HoloAnim is not installed!",5)
    selfDestruct() 
#endif
