@name Robotboy655's Hunter Owner Sounds
@inputs 
@outputs
@persist Time Dead OldHealth Cmd:string Args:array Player:entity IdleTime
@trigger 

interval(10)
runOnChat(1)

Player = owner()
Args = lastSaid():explode(" ")
Cmd = Args:string(1):lower()
Args:remove(1)
if(first())
{
    OldHealth = Player:health()
}

if(lastSpoke() == Player & lastSaidWhen() == curtime() & Player:isAlive())
{
    if(Cmd == "!idle")
    {
        hideChat(1)
        Player:soundPlay("idle",0,"npc/ministrider/hunter_idle" + round(random(1,3)) + ".wav")
    }
    if(Cmd == "!scan")
    {
        hideChat(1)
        Player:soundPlay("scan",0,"npc/ministrider/hunter_scan" + round(random(1,4)) + ".wav")
    }
    if(Cmd == "!laugh")
    {
        hideChat(1)
        Player:soundPlay("laugh",0,"npc/ministrider/hunter_laugh" + round(random(1,5)) + ".wav")
    }
    if(Cmd == "!alert")
    {
        hideChat(1)
        Player:soundPlay("alert",0,"npc/ministrider/hunter_alert" + round(random(1,3)) + ".wav")
    }
    if(Cmd == "!angry")
    {
        hideChat(1)
        Player:soundPlay("angry",0,"npc/ministrider/hunter_angry" + round(random(1,3)) + ".wav")
    }
    if(Cmd == "!charge")
    {
        hideChat(1)
        Player:soundPlay("charge",0,"npc/ministrider/hunter_charge" + round(random(3,4)) + ".wav")
    }
    if(Cmd == "!defendstrider")
    {
        hideChat(1)
        Player:soundPlay("defendstrider",0,"npc/ministrider/hunter_defendstrider" + round(random(1,3)) + ".wav")
    }
    if(Cmd == "!foundenemy")
    {
        hideChat(1)
        Player:soundPlay("foundenemy",0,"npc/ministrider/hunter_foundenemy" + round(random(1,3)) + ".wav")
    }
    if(Cmd == "!foundenemy_ack")
    {
        hideChat(1)
        Player:soundPlay("foundenemy_ack",0,"npc/ministrider/hunter_foundenemy_ack" + round(random(1,3)) + ".wav")
    }
    if(Cmd == "!flank_announce")
    {
        hideChat(1)
        Player:soundPlay("flank_announce",0,"npc/ministrider/hunter_flank_announce" + round(random(1,2)) + ".wav")
    }
}

if(owner():vel():length() < 200 & owner():vel():length() > 100 & Time < curtime() & Player:isAlive() & Player:isOnGround())
{
    Player:soundPlay("footstep",0,"npc/ministrider/ministrider_footstep" + round(random(1,5)) + ".wav")
    Time = curtime() + 0.4
}
elseif(owner():vel():length() < 300 & owner():vel():length() > 200 & Time < curtime() & Player:isAlive() & Player:isOnGround())
{
    Player:soundPlay("footstep",0,"npc/ministrider/ministrider_footstep" + round(random(1,5)) + ".wav")
    Time = curtime() + 0.3
}
elseif(owner():vel():length() < 550 & owner():vel():length() > 450 & Time < curtime() & Player:isAlive() & Player:isOnGround())
{
    Player:soundPlay("footstep",0,"npc/ministrider/ministrider_footstep" + round(random(1,5)) + ".wav")
    Time = curtime() + 0.2
}

if(Time < curtime() & owner():vel():length() > 10 & Player:isAlive() & Player:isOnGround())
{
    #Player:soundPlay("footstep",0,"npc/ministrider/ministrider_footstep" + round(random(1,5)) + ".wav")
    Time = curtime() + (owner():vel():length() / 250) * 0.3
}

if(Player:isAlive() == 0 & Dead == 0)
{
    Dead = 1
    Player:soundPlay("die",0,"npc/ministrider/hunter_die" + round(random(2,3)) + ".wav")
}
elseif(Player:isAlive() == 1)
{
    Dead = 0
}

if(Player:health() < OldHealth)
{
    OldHealth = Player:health()
    Rand = round(random(2,4))
    if(Rand == 3){Rand = 2}
    if(Dead == 0){Player:soundPlay("pain",0,"npc/ministrider/hunter_pain" + Rand + ".wav")}
}

if(IdleTime < curtime())
{
    IdleTime = curtime() + random(20,60)
    if(random(100) > 50)
    {
        Player:soundPlay("idle",0,"npc/ministrider/hunter_idle" + round(random(1,3)) + ".wav")
    }
    else
    {
        Player:soundPlay("scan",0,"npc/ministrider/hunter_scan" + round(random(1,4)) + ".wav")
    }
}
