@name Flaming Death
@inputs 
@outputs Name:string Target:entity On E:entity Fire Mode Vehicle Speed
@persist Words:array Name:string Target:entity On Speed Mode Fire
@persist Fire1 E:entity
@trigger 
#runOnTick(1)
Time=30/1000
interval(Time*1000)
#E=entity():isConstrainedTo()

#To use say FD get<"name fragment"  and then FD attack
O=owner()
runOnChat(1)
K=chatClk()
Chat=O:lastSaid()
if(duped()){reset()}
if(first()){
    E=ranger(-100):entity()
    Speed=2000
    On=1
    E:setAlpha(0)
    entity():setAlpha(0)
    Words=array()
    Words:pushString("FD") #Com 1
    Words:pushString("<") #Break 2
    Words:pushString("get") #target 3
    
    Words:pushString("attack") #get him 4
    Words:pushString("stop")  #stop attacking 5
    Words:pushString("car") #attack if he's in a car 6
    
    Words:pushString("any") #attack at any time 7
    Words:pushString("foot") #attack anytime he's on foot
    
}
if(!E){
    E=entity() 
    Speed=5
}else{Speed=100}

Fire1=Fire
Fire=E:isOnFire()
Tags=array()
for(C=1,Words:count()){
    Tags[C,number]=Chat:find(Words[C,string])
}

if(K&Tags[1,number]){
    if(Tags[2,number]&Tags[3,number]){
    Dump=Chat:explode(Words[2,string])
        Name=Dump[2,string]
        Warn=1
    }
    #if he says car
    if(Tags[6,number]){
        Mode=1
        print("Master I shall wait till he is in a vehicle to strike!")
    }
    if(Tags[7,number]){
        Mode=0
        print("Master, he shall not escape my flames no matter where he goes!")
    }
    if(Tags[8,number]){
        Mode=2
        print("Master, he shall die only when he's on foot!")
    }
    #if he says attack
    if(Tags[4,number]){
        On=1
    }
    #if he says stop
    if(Tags[5,number]){
        On=0
    }
}
Home=O:pos()+vec(0,0,E:radius()+70)
if(Name&findCanQuery()){

   Target=findPlayerByName(Name)
}
if(Warn&!clk()){
    if(Target){
        print("At once Master! "+Target:name()+" shall be fired!")
        if(!Fire){print("Ignite me and I shall slay them at once!")}
    }else{print("Can't find target!") XYZ=Home}
}
Vehicle=Target:inVehicle()
if(Mode){
    if(Vehicle){
        if(Mode==1){On=1}else{On=0}
    }elseif(Mode==2&!Vehicle){On=1}else{On=0}
}else{On=1}
if(On){
    if(Target:pos()){
        if(Fire){
            #XYZ=Target:pos()+vec(0,0,5)+Target:vel()*Time#+vec(0,0,Target:height()/2)
            XYZ=Target:toWorld(vec(0,0,5))
        }else{
            XYZ=XYZ=Home
            if(changed(Fire)|Fire!=Fire1){print("Master! I require flame!")}
        }
        
    }else{
        XYZ=Home
    }


}else{XYZ=Home}
    #E:applyForce((Speed*E:mass()/4)*(XYZ-E:pos())-(E:vel()/2)*(E:mass()+entity():mass()))
    E:applyForce(((XYZ-E:pos())*15-E:vel()/2)*E:mass())
