@name RoboCop
@model models/hunter/plates/plate1x1.mdl
@persist Target:entity Wanted:array Sa Bail Run Chatter:array Numbers:array
runOnTick(1)
runOnChat(1)
entity():setAlpha(0)
if (first()) {
    #Target=owner()
    Bail=100 #Bail Price
    holoCreate(1)
    holoModel(1,"models/Police.mdl")
    holoPos(1,entity():pos()-vec(0,0,-1.3))
    holoParent(1,entity())
    holoAnim(1,94)
    holoCreate(2)
    holoModel(2,"models/Weapons/w_stunbaton.mdl")
    holoPos(2,holoEntity(1):attachmentPos("RHand")+vec(0.5,0.6,7))
    holoAng(2,ang(90,0,0))
    holoParentAttachment(2,holoEntity(1),"RHand")
    holoCreate(3)
    holoPos(3,holoEntity(1):attachmentPos("head"))
    holoParentAttachment(3,holoEntity(1),"head")
    holoAlpha(3,0)
    Chatter=array(
        "/npc/combine_soldier/vo/prison_soldier_boomersinbound.wav",
        "/npc/combine_soldier/vo/prison_soldier_bunker1.wav",
        "/npc/combine_soldier/vo/prison_soldier_bunker2.wav",
        "/npc/combine_soldier/vo/prison_soldier_bunker3.wav",
        "/npc/combine_soldier/vo/prison_soldier_containd8.wav",
        "/npc/combine_soldier/vo/prison_soldier_fallback_b4.wav",
        "/npc/combine_soldier/vo/prison_soldier_freeman_antlions.wav",
        "/npc/combine_soldier/vo/prison_soldier_fullbioticoverrun.wav",
        "/npc/combine_soldier/vo/prison_soldier_leader9dead.wav",
        "/npc/combine_soldier/vo/prison_soldier_negativecontainment.wav",
        "/npc/combine_soldier/vo/prison_soldier_prosecuted7.wav",
        "/npc/combine_soldier/vo/prison_soldier_sundown3dead.wav",
        "/npc/combine_soldier/vo/prison_soldier_tohighpoints.wav",
        "/npc/combine_soldier/vo/prison_soldier_visceratorsa5.wav"
        )
    Numbers=array(
        3="/npc/combine_soldier/vo/three.wav",
        2="/npc/combine_soldier/vo/two.wav",
        10="/npc/combine_soldier/vo/ten.wav",
        300="/npc/combine_soldier/vo/threehundred.wav", #wtf
        13="/npc/combine_soldier/vo/thirteen.wav",
        1="/npc/combine_soldier/vo/one.wav",
        6="/npc/combine_soldier/vo/six.wav",
        16="/npc/combine_soldier/vo/sixteen.wav",
        60="/npc/combine_soldier/vo/sixty.wav",
        30="/npc/combine_soldier/vo/thirty.wav",
        20="/npc/combine_soldier/vo/twenty.wav",
        300="/npc/combine_soldier/vo/threehundred.wav", #wtf
        19="/npc/combine_soldier/vo/nineteen.wav",
        90="/npc/combine_soldier/vo/ninety.wav",
        8="/npc/combine_soldier/vo/eight.wav",
        18="/npc/combine_soldier/vo/eighteen.wav",
        80="/npc/combine_soldier/vo/eighty.wav"
        )
        
    timer("chatter",1000)
    entity():setMass(50000)
    Speed=2
    function entity:goto(Vector:vector){ This:applyForce(((Vector-This:pos())*Speed-This:vel())*This:mass())   }
    function number high(V:vector) {
        Out=0
        if (V:x()>Out) {Out=V:x()}
        if (V:y()>Out) {Out=V:y()}
        if (V:z()>Out) {Out=V:z()}
        return Out
    }
    function sound(S:string) {
        Sa++
        if (Sa>8) {Sa=0}
        holoEntity(1):soundPlay(Sa,0,S)
        
    }
    
}

 Req=entity():angles():roll()
 #print(_HUD_PRINTCENTER,toString(round(Req)))
 if (Req<-40) {
    entity():propFreeze(1)
    entity():setAng(entity():angles()*ang(0,1,0))
} elseif (changed(Req)) {entity():propFreeze(0)}
    
if (Target) {
    entity():goto(Target:pos())
    holoMaterial(2,"models/shiny")
    holoColor(2,vec(255,0,0))
} else {
    holoMaterial(2,"models/shiny")
    holoColor(2,vec(0,0,255))
}
if (high(entity():vel())>10 & !Target) {
    Run=1
} else {
    Run=0
}
if (changed(Run)) {
    if (Run | Target) {
        holoAnim(1,94)

    } else {
        holoAnim(1,8)
    }
}
if (changed(Target) & Target | (Target & first())) {
    sound("/npc/combine_soldier/vo/contactconfirmprosecuting.wav")
}

#8 idle
#10 weaponhold
#13 lookaround
#15 pick up the can
#21-22 move
#25 dance
#32 push
#51-52 shotgunfire
#60 crouch
#82-83 stunstick
 #82 hit
 #83 stab
#94 walkstunstick
#106 run
if (clk("chatter")) {#radio chatter
    sound(Chatter[randint(1,Chatter:count()),string])
    #print("Chattering")
    timer("chatter",randint(20000,25000))
}
