@name Zombie (by Shoffing)
@persist Base:vector Delay
@trigger all
interval(10)

E = entity():isWeldedTo()
O = owner()
E:setMass(100)

#Sets up parts we're gonna use
RH = E:bone(7) #Right hand
LH = E:bone(5) #Left hand
Head = E:bone(10)
LF = E:bone(13) #Left foot
RF = E:bone(14) #Right Foot

if(E:pos():distance(O:shootPos()) < 100 & !Delay) {
   soundPurge()
   timer("delay",750)
   Force = 999999999
   soundPlay(0,100,"npc/zombie/zo_attack2.wav")
   E:applyForce(Force * (O:shootPos() - E:pos()))
   Delay = 1
} else {
   Force = 3
   E:applyForce(E:vel() * -7)
}

if(clk("delay")) { Delay = 0 }

#Extends teh arms
RH:applyForce(Force*(O:shootPos() - RH:pos()))
LH:applyForce(Force*(O:shootPos() - LH:pos()))

#To make it stand up, I pushed the feet down and the head up.
Base = vec(0,0,150)
LF:applyForce(Base*-1)
RF:applyForce(Base*-1)
Head:applyForce(Base*10)