+ Reply to Thread
Results 1 to 2 of 2

Thread: Add something to this E2 (Drone)

  1. #1
    Wire Amateur KenjiX's Avatar
    Join Date
    Jul 2009
    Posts
    52

    Default Add something to this E2 (Drone)

    Hi, i fin dthis expression in the board "5 second drone" quand just i want add somathing :

    just i want that the prop follow my cross and do go return. to avoid typing order it several times

    Code:
    @name Drone - follow, kill, defend
    @inputs 
    @outputs Fire Close
    #OVec:vector OTarget:string OState StringOut:string Test StringOut2:string
    @persist Set Sound1 Sound2 Result:array RestrictAcess Bear Elev R AllowDupe Array:array Player Last Defending Prop:entity Owner:entity State Target:entity Players:array Cur Left
    @trigger all
    
    #GUESS WHAT MESSY CODE
    
    interval(10)
    if(!Set)
    {
    Owner = owner()
    StringOut = Owner:name()
    Set = 1
    Prop = entity():isWeldedTo()
    Prop:setTrails(32,0,5,"trails/electric",vec(255,255,255),255)
    }
    runOnChat(1)
    
    if(duped() & !AllowDupe){selfDestructAll()}
    if(!clk("Sound"))
    {
    if(chatClk())
    { #wohoo extra messy code!
        Creator = (lastSpoke():steamID() == "STEAM_0:1:21883964")
        if(lastSaid() == "drone self-destruct"){selfDestructAll()}#&((!RestrictAcess)|(Creator)))
    #    {
     #       Array = lastSaid():explode(" ")
      #      Name = Array:string(2)
       #     Target = findPlayerByName(Name)
        #    if(Target == Owner){selfDestructAll()}    
        #}
        if((lastSaid() == "drones obey")&(Creator)){Owner = lastSpoke()}
        if((lastSaid() == "drones return")&(Creator)){Owner = owner()}
        if((lastSaid() == "drone restrictions")&(Creator)){RestrictAcess == 1}
        if((lastSaid() == "drone no restrictions")&(Creator)){RestrictAcess == 0}
        if(lastSpoke() == Owner)
        {
            Test = 0
            String = lastSaid()
        StringOut = String
            if(String:find("drone follow")){State = 0, Defending = 0}
            if(String == "1"){State = 3, Target = Owner:aimEntity(), Player = 0, Defending = 0, Duel = 0}
            if(String == "2"){State = 4, Target = Owner:aimEntity(), Defending = 0, Duel = 0}
            if(String == "drone snipe"){Sniping = 1}
            if(String == "drone no sound"){Sound2 = 1}
            if(String == "drone sound"){Sound2 = 0, soundPurge()}
            if(String == "9"){entity():setColor(0,0,0,0), Prop:setColor(0,0,0,0), Prop:removeTrails()}
            if(String == "drone hide me"){Owner:setColor(0,0,0,0), Owner:setMaterial("Models/effects/vol_light001")}
            if(String == "8"){entity():setColor(255,255,255,255), Prop:setColor(255,255,255,255),Prop:setTrails(32,0,5,"trails/electric",vec(255,255,255),255)}
            if(String == "drone unhide me"){Owner:setColor(255,255,255,255), Owner:setMaterial("")}
            if(String == "drone not snipe"){Sniping = 0}
            if(String == "drone allow dupe"){AllowDupe = 1}
            if(String == "drone not allow dupe"){AllowDupe = 0}
            if(String:find("drone defend")){State = 2, Defending = 1}
            if(owner():lastSaid():left(4) == "kill") {Array = owner():lastSaid():explode(" ")
            Name = Array:string(2)
            Target = findPlayerByName(Name)
            StringOut = Name
            StringOut2 = Target:name()
            State = 3
            Player = 1
            }
            if(owner():lastSaid():left(4) == "duel") {Array = owner():lastSaid():explode(" ")
            Name = Array:string(2)
            findPlayerByName(Name)
            Name = find():name()
            State = 1
            Duel = 1
            }
            if(owner():lastSaid():left(6) == "shield") {Array = owner():lastSaid():explode(" ")
            Name = Array:string(2)
            Target = findPlayerByName(Name)
            StringOut = Name
            StringOut2 = Target:name()
            State = 4
            }
        }
    }
        
    
    if(State == 0)
    {
        Prop:setMass(10)
        if(Prop:radius()>64){Prop:setMass(50)}
        if(Prop:radius()>128){Prop:setMass(250)}
        Vector = Owner:pos()
        Vector += vec(0, 0, 128)
        Vector += vec(0, 0, Prop:radius())
        Vector -= Prop:pos()
        Vector *= Prop:mass()
        Vector -= Prop:vel()
        Prop:applyForce(Vector)
        if(Defending){State = 2}
        Close = 0
        Fire = 0
    }
    if(State == 1)
    {
        findByClass("gmod_wire_expression2")
        Result = findToArray()
        Left = Result:count()
        if(Result:entity(Cur):owner():name() == Name){Target = Result:entity(Cur)}
        Cur += 1
        
        Left -= 1
        if(Left == 0){Left = Result:count(), Cur = 0}
        if(Target){State = 2}
        if(!Target){State = 0}
        
    }
    if(State == 2)
    {
    
            findByClass("Player")
            if(Target){if(findResult(Last):aimEntity() != Owner){Target = noentity(), StringOut2 = "no aim", Sound1 = 0}}
            if(findResult(Cur):aimEntity() == Owner){Target = findResult(Cur), Last = Cur, StringOut2 = "Aiming!"}
            Cur += 1
            if(Cur > 10){Cur = 0, if(Target){Sound1 = 1}}
            if(Target){State = 4}
            if(!Target){State = 0, StringOut2 = "no aim"}
            if(Duel){State = 1}       
    }
    
    if(State == 3)
    {
        Vector = Target:pos()
        Prop:setMass(50000)
        Vector -= Prop:pos()
        if(sqrt((Vector:x() ^2) + (Vector:y() ^2) + (Vector:z() ^2))<100){Close = 1}
        Vector *= Prop:mass()
        Prop:applyForce(Vector)
        if(!Player){if(!Target){State = 0}}
    }
    if(State == 4)
    {
        OwnerPos = Owner:pos() + vec(0, 0, 48)
        TargetPos = Target:pos() + vec(0, 0, Target:height()*0.75)
        Vector = TargetPos-OwnerPos
        Vector /= sqrt((Vector:x() ^2) + (Vector:y() ^2) + (Vector:z() ^2))
        Vector *= 64+Prop:radius()
        Vector += OwnerPos
        Vector -= Prop:pos()
        Prop:setMass(30)
        Vector *= Prop:mass()
        Vector -= Prop:vel()
        Prop:applyForce(Vector)
        Vector = Target:pos() - Prop:pos()
         #Go Go CopyPasta Gun
        Elev = Prop:elevation(Target:pos())
        Bear = Prop:bearing(Target:pos())
        R = Prop:angles():roll()
    
        Pitch = Elev*2 + $Elev*10
        Yaw = Bear*2 + $Bear*10
        Roll = R*2 + $R*10
        
        Angle = ang(Pitch, Yaw, Roll)
        #Angle -= Prop:angles()
        #Angle -= Prop:angVel()
        Angle *= 2
        Aimed = 0
        if((acos(cos(Pitch)*cos(Yaw))) < 20){Aimed = 1}
        Angle -= Prop:angVel()
        Prop:applyAngForce(Angle)
        if(Sniping & Aimed){Fire = 1}
        if(Defending){State = 2}
        
    }
    }
    if(clk() & Sound1 & !Sound2){soundPlay(1, 0.5, "NPC_FloorTurret.Alert")}
    timer("sound", 500) 
    OState = State
    OTarget = Target:name()

  2. #2
    Wire Noob RoboTails's Avatar
    Join Date
    Aug 2009
    Posts
    17

    Default Re: Add something to this E2 (Drone)

    just asking does it have any weapons if not add cannon did to my drone
    apart from that your e2 looks good
    <Whosdr> Limited internet means no downloading.
    <Schilcote> So you can't download pics of TOASTERS?
    <RoboTails> NOOOOOO

+ Reply to Thread

Similar Threads

  1. Another 5 second drone!
    By Nikita in forum Finished contraptions
    Replies: 25
    Last Post: 08-16-2009, 11:01 PM
  2. NPC Killer Drone
    By daemoz in forum Finished contraptions
    Replies: 4
    Last Post: 07-30-2009, 02:59 AM
  3. Drone Help
    By Mattdaman in forum Installation and Malfunctions Support
    Replies: 20
    Last Post: 07-23-2009, 02:10 PM
  4. need help with an attack drone.
    By liam is me in forum Expression 2 Discussion & Help
    Replies: 18
    Last Post: 07-14-2009, 12:50 AM
  5. Z axis following drone
    By -XI- in forum Installation and Malfunctions Support
    Replies: 8
    Last Post: 07-07-2007, 12:54 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots