Results 1 to 9 of 9
Like Tree4Likes
  • 4 Post By postman

Thread: [E2] AI release thread.

  1. #1
    Wire Sofaking postman's Avatar
    Join Date
    Mar 2010
    Location
    oregon
    Posts
    1,089

    Default [E2] AI release thread.

    Now first off a description:
    None of these are TRUE AI's, but they do simulate or respond to the environment, and that's as close as you can get in e2.

    This is my second release thread, and with much fewer e2's than the last one, so it should be more organized etc.

    Again as I said in my last one, don't judge based on the code I post, quite a few of these were written many months ago and i just now decided to release them.

    __________________________________________________ _
    First is engine bird
    Instructions:spawn chip
    code:
    Code:
    @name Engine bird
    @inputs 
    @outputs Speed On T Force:vector Blade:entity Strength
    @model models/props_c17/TrapPropeller_Engine.mdl
    runOnTick(1)
    
    Bird=entity()
    O=owner()
    soundPitch(1,Speed*2)
    
    propSpawnEffect(0)
    
    if(T>=360){T=0}else{T++}
    
    
    if(first())
    {
        Strength=7.5
        On=1
        Speed=0
        
        
        holoCreate(1)
        holoModel(1,"models/props_c17/TrapPropeller_Blade.mdl")
        holoPos(1,Bird:toWorld(vec(0,-2.5,22)))
        holoParent(1,Bird)
        
        soundPlay(1,0,"vehicles/v8/v8_idle_loop1.wav")
        
        timer("die",randint(80000,240000))
        #timer("die",20000)
    }
    
    
    
    if(On)
    {
        #upwards detection
        rangerFilter(Bird)
        RngU=rangerOffset(150,Bird:pos(),Bird:up())
        RngD=rangerOffset(150,Bird:pos(),Bird:up()*-1)
        
        
        #the rotation
        if(Speed<100){Speed+=0.14}
        holoAng(1,Bird:toWorld(ang(0,T*(Speed/2),0)))
        
        #making it go
        #has force reduction based on upwards decection, and distance away
        Force=Bird:up()*Speed*(Bird:mass()/Strength)-((Bird:pos():distance(O:pos())>=1300)*380)-(RngU:hit()*250)+(RngD:hit()*200)
        Bird:applyForce(Force)
        
        
        #angling the bird
        if(Bird:pos():distance(O:pos())>=1500&Speed>=90)
        {
            Bird:applyForce(Bird:forward()*Speed*(Bird:mass()/20))
            Bird:applyTorque(( 80 * Bird:toLocalAxis(rotationVector(quat( (O:pos() - Bird:pos()):toAngle() ) / quat(Bird) ) ) - 12 * Bird:angVelVector()) * Bird:inertia())
        }
        else
        {
            Bird:applyTorque(( 50 * Bird:toLocalAxis(rotationVector(quat( (Bird:pos() - Bird:pos()):toAngle()-ang(90,0,0) ) / quat(Bird) ) ) - 12 * Bird:angVelVector()) * Bird:inertia())
        }
        
        
    }
    
    
    
    if(clk("die"))
    {
        On=0
        Speed=0
        
        soundStop(1)
        soundPlay(3,0,"ambient/explosions/explode_3.wav")
        
        Bird:setTrails(55,55,4,"trails/smoke",vec(90,90,90),140)
        
        Blade=propSpawn(holoEntity(1):model(),Bird:toWorld(vec(0,-2.5,22)),holoEntity(1):angles(),0)
        
        holoAlpha(1,0)
        
        timer("die",randint(60000,240000))
        timer("revive",randint(5000,10000))
    }
    
    if(clk("revive"))
    {
        On=1,
        soundPlay(1,0,"vehicles/v8/v8_idle_loop0.wav")
        
        holoAlpha(1,255)
        holoAng(1,Blade:angles():setPitch(0):setRoll(0))
        Blade:propDelete()
    }
    
    #fix trails
    if(changed(On)&On){Bird:removeTrails()}
    Pictures:



    ________________
    And now An aquarium
    Instructions:spawn and wait for all fish to spawn (changeable amount in chip)
    (also the fish like bug bait, throw one into the tank and watch em nom it.
    Code:
    Code:
    @name Aquarium
    @inputs 
    @outputs Holos:array On
    @persist [V1 V2]:vector Plate:entity Spawn Num NumC BugBaits:array BugBait:entity
    interval(20)
    E=entity()
    
    V1=E:toWorld(vec(40,22,43))
    V2=E:toWorld(vec(-40,-22,12))
    
    propSpawnEffect(0)
    
    
    if(first())
    {
        #make the bottom detection plate
        Plate=propSpawn("models/hunter/blocks/cube1x2x025.mdl",E:pos()+vec(0,0,5),E:angles()+ang(0,90,0),1)
        Plate:setMaterial("models/props/CS_militia/roofbeams01")
        
        
        #on
        On=1
        Spawn=1
        NumC=0
        #number of fish
        Num=10
        
        
        #bottom
        holoCreate(1)
        #front
        holoCreate(2)
        #back
        holoCreate(3)
        #left
        holoCreate(4)
        #right
        holoCreate(5)
        #water 
        holoCreate(6)
        #water top
        holoCreate(7)
        #plant
        holoCreate(8)
        
        
        holoPos(1,E:toWorld(vec(0,0,10)))
        holoPos(2,E:toWorld(vec(0,25,35.1)))
        holoPos(3,E:toWorld(vec(0,-25,35.1)))
        holoPos(4,E:toWorld(vec(-49.1,0,35.1)))
        holoPos(5,E:toWorld(vec(49.1,0,35.1)))
        holoPos(6,E:toWorld(vec(0,0,33)))
        holoPos(7,E:toWorld(vec(0,0,54)))
        holoPos(8,E:toWorld(vec(20,0,22)))
        
        
        holoScale(1,vec(8.38,4.37,0.2))
        holoScale(2,vec(8.38,0.2,4))
        holoScale(3,vec(8.38,0.2,4))
        holoScale(4,vec(0.2,4.37,4))
        holoScale(5,vec(0.2,4.37,4))
        holoScale(6,vec(8.18,4.17,3.6))
        holoScale(7,vec(8.18,4.17,0.1))
        holoScale(8,vec(0.4,0.4,0.4))
        
        
        holoMaterial(1,"models/props_canal/metalwall005b")
        holoMaterial(2,"models/props_combine/health_charger_glass")
        holoMaterial(3,"models/props_combine/health_charger_glass")
        holoMaterial(4,"models/props_combine/health_charger_glass")
        holoMaterial(5,"models/props_combine/health_charger_glass")
        holoAlpha(6,130)
        holoMaterial(7,"models/shadertest/predator")
        holoModel(8,"models/props/CS_militia/fern01.mdl")
        
        
        holoParent(1,Plate)
        holoParent(2,Plate)
        holoParent(3,Plate)
        holoParent(4,Plate)
        holoParent(5,Plate)
        holoParent(6,Plate)
        holoParent(7,Plate)
        holoParent(8,Plate)
    
        timer("spawn",1000)
    }
    
    if(clk("spawn"))
    {
        
        if(NumC<Num&holoCanCreate()){NumC++,timer("spawn",1000)}elseif(!holoCanCreate()){timer("spawn",2000)}
        
        
        #bodies
        holoCreate(NumC+20)
        holoScale(NumC+20,vec(0.43,0.14,0.34))
        holoPos(NumC+20,randvec(V1,V2))
        holoModel(NumC+20,"hqsphere")
        holoColor(NumC+20,vec(255,136,0))
        holoMaterial(NumC+20,"phoenix_storms/mat/mat_phx_metallic")
        
        #fins
        holoCreate(NumC+80)
        holoScale(NumC+80,vec(0.25,0.1,0.41))
        holoPos(NumC+80,holoEntity(NumC+20):toWorld(vec(-2,0,0)))
        holoAng(NumC+80,ang(90,0,0))
        holoModel(NumC+80,"prism")
        holoColor(NumC+80,vec(255,136,0))
        holoMaterial(NumC+80,"phoenix_storms/mat/mat_phx_metallic")
        holoParent(NumC+80,NumC+20)
        
        #eyes
        holoCreate(NumC+140)
        holoScale(NumC+140,vec(0.1,0.1,0.2))
        holoPos(NumC+140,holoEntity(NumC+20):toWorld(vec(1,0,0.4)))
        holoAng(NumC+140,ang(90,90,0))
        holoColor(NumC+140,vec(0,0,0))
        holoModel(NumC+140,"cylinder")
        holoParent(NumC+140,NumC+20)
        
        #angle them fish
        holoAng(NumC+20,ang(0,randint(-180,180),0))
        
        Holos:pushEntity(holoEntity(NumC+20))
        
        timer("turn"+NumC,randint(1000,10000))
    }
    
    
    #find food
    if(findCanQuery())
    {
        findIncludeModel("models/weapons/w_bugbait.mdl")
        findInBox(V1,V2)
        BugBaits=findToArray()
        BugBait=BugBaits[1,entity]
    }
    
    
    #on loop
    if(On)
    {
        #run through the fish
        for(I=1,Holos:count())
        {
            #ranger
            Rng=rangerOffset(40,holoEntity(I+20):pos(),Plate:up()*-1)
            
            #goooooooo
            if(holoEntity(I+20):pos():distance(BugBait:pos())>5+(I*2)|!BugBait)
            {
                holoPos(I+20,holoEntity(I+20):pos()+holoEntity(I+20):forward()*0.2)
            }
            
            #go down if they go to far up
            if(holoEntity(I+20):pos():z()>holoEntity(7):pos():z()-5){holoPos(I+20,holoEntity(I+20):pos()+holoEntity(I+20):up()*-1)}
                    
            #go up if to far down
            if(holoEntity(I+20):pos():z()<holoEntity(1):pos():z()+8){holoPos(I+20,holoEntity(I+20):pos()+holoEntity(I+20):up())}
            
            
            
            #turn if they hit a side
            if(Rng:entity()!=Plate)
            {
                holoAng(I+20,(Plate:pos()-holoEntity(I+20):pos()):toAngle():setPitch(0))
            }
            
            if(BugBait)
            {
                holoAng(I+20,(BugBait:pos()-holoEntity(I+20):pos()):toAngle())
            }
            
            #random turning
            if(clk("turn"+I))
            {
                Dir=randint(-1,1)
                
                timer("turn"+I,randint(1000,10000))
                
                #randomly turn
                holoAng(I+20,ang(25*Dir,randint(-90,90),0))
                
                #randomly move verticaly
                holoPos(I+20,holoEntity(I+20):pos()+holoEntity(I+20):up()*Dir)
            }
        }
    }
    
    
    
    #only work when frozen, or the fish break :/
    if(changed(Plate:isFrozen())&!Plate:isFrozen())
    {
        for(I=1,Holos:count())
        {
            holoParent(I+20,Plate)
            On=0
        }
        hint("freeze the tank please!",5)
    }
    elseif(changed(Plate:isFrozen())&Plate:isFrozen()&!first())
    {
        for(I=1,Holos:count())
        {
            holoUnparent(I+20)
            On=1
        }
    }
    
    
    #delete e2 if bottom is gone
    if(!Plate&!first()){selfDestruct()}

    __________________________________________
    Kamikaze cars
    Instructions: spawn e2 and watch the cars
    Code:
    Code:
    @name holo cars
    @inputs
    @outputs Count [Explosions Horns Dead]:array Ambulance:entity BodyOnBoard
    interval(30)
    Ambulance=holoEntity(0)
    
    if(first()) 
    {
        Count=randint(10,20)
        
        for (I=1,Count) 
        {
            holoCreate(I)
            holoScale(I,vec(0.15,0.15,0.15))
            holoModel(I,"models/props_vehicles/car002a_physics.mdl")
            
            timer("turn"+I,randint(1000,3000))
        }
        holoCreate(0)
        holoModel(0,"models/props_vehicles/van001a_physics.mdl")
        holoScale(0,vec(0.16,0.16,0.16))
        holoColor(0,vec(255,0,0))
        holoPos(0,entity():pos()+vec(0,0,5))
        
        Horns=array(
        "ambient/misc/carhonk1.wav",
        "ambient/misc/carhonk2.wav",
        "ambient/misc/carhonk3.wav")
        
        Explosions=array(
        "ambient/explosions/explode_3.wav",
        "ambient/explosions/explode_1.wav",
        "ambient/explosions/explode_4.wav",
        "ambient/explosions/explode_7.wav")
        
    }
    
    
    for(I=1,Count)
    {
        Car=holoEntity(I)
        
        RngF=rangerOffset(5,Car:pos(),Car:forward()*1)
        RngFF=rangerOffset(5,Car:pos()+Car:forward()*20,Car:forward())
        RngD=rangerOffset(5,Car:pos(),Car:up()*-1)
        
        if(RngFF:hit()|clk("turn"+I)|Car:pos():distance(entity():pos())<=10)
        {
            Car:soundPlay(1,0,Horns:string(randint(1,Horns:count())))
            holoAng(I,ang(0,randint(-2,1)*90,0))
        }
        elseif(Car:pos():distance(entity():pos())>=1000)
        {
            holoAng(I,(entity():pos()-Car:pos()):toAngle())
        }
        
        if(clk("turn"+I)){timer("turn"+I,randint(3000,12000))}
        
        
        if(changed(RngF:hit())&RngF:hit())
        {
            Car:soundPlay(2,0,Explosions:string(randint(1,Explosions:count())))
            soundPitch(2,randint(0.5,3)*60)
            
            
            #make the boom
            holoCreate(I+100)
            holoModel(I+100,"sphere")
            holoPos(I+100,Car:pos())
            holoScale(I+100,vec(3,3,3))
            holoAlpha(I+100,140)
            holoColor(I+100,vec(255,144,10))
            
            #make the dead guy
            holoCreate(I+200)
            holoModel(I+200,"models/props/de_train/de_train_securityguard.mdl")
            holoPos(I+200,Car:pos())
            holoScale(I+200,vec(0.25,0.25,0.25))
            holoAng(I+200,Car:angles())
            Dead:pushNumber(I+200)
            
            holoDelete(I)
            
            timer("remove"+I,2000)
        }
        if(clk("remove"+I)){holoDelete(I+100)}
        
        
        #car gravity!
        if(!RngD:hit())
        {
            holoPos(I,Car:pos()+Car:forward()*2+vec(0,0,-5.7))
        }
        else
        {
            holoPos(I,Car:pos()+Car:forward()*4.5)
            Diff=2-RngD:distance()
            holoPos(I,Car:pos()+vec(0,0,Diff))
        }
        
        if(changed(RngD:hit())&!RngD:hit())
        {
            holoAng(I,Car:angles()+ang(45,0,0))
        }
    
    }
    
    if(Dead:count()>=1)
    {
        RngA=rangerOffset(5,Ambulance:pos(),Ambulance:up()*-1)
        RngAF=rangerOffset(5,Ambulance:pos(),Ambulance:forward())
        holoPos(0,Ambulance:pos()+Ambulance:forward()*5.1)
        
        
        if(Ambulance:pos():distance(holoEntity(Dead[1,number]):pos())<=10&!BodyOnBoard)
        {
            BodyOnBoard=1
            holoPos(Dead[1,number],Ambulance:pos())
            holoParent(Dead[1,number],Ambulance)
        }
        elseif(Ambulance:pos():distance(entity():pos())<=10&BodyOnBoard)
        {
            BodyOnBoard=0
            
            holoCreate(Dead[1,number]-200)
            holoScale(Dead[1,number]-200,vec(0.15,0.15,0.15))
            holoModel(Dead[1,number]-200,"models/props_vehicles/car002a_physics.mdl")
            holoAng(Dead[1,number],ang(0,randint(-2,1)*90,0))
            
            holoDelete(Dead[1,number])
            Dead:removeNumber(1)
        }
        
        
        #angles if there is a person
        if(BodyOnBoard)
        {
            holoAng(0,(entity():pos()-Ambulance:pos()):toAngle():setPitch(0))
        }
        else
        {
            holoAng(0,(holoEntity(Dead[1,number]):pos()-Ambulance:pos()):toAngle():setPitch(0))
        }
        
        
        #gravity
        if(!RngA:hit())
        {
            holoPos(0,Ambulance:pos()+vec(0,0,-5.7))
        }
        else
        {
            Diff2=4-RngA:distance()
            holoPos(0,Ambulance:pos()+vec(0,0,Diff2))
        }
        
        if(Ambulance:pos():z()<entity():pos():z()&BodyOnBoard)
        {
            holoPos(0,Ambulance:pos()+vec(0,0,10.7))
        }
            
    }
    Pictures:

    ________________________________________________
    Holo roaches
    Instructions: spawn in a place with walls or obstructions, try capturing the roaches or squishing them
    Code:
    Code:
    @name holo roaches v3
    @inputs
    @outputs
    @persist Count Status:array
    interval(30)
    
    if(first()) 
    {
        Count=randint(10,20)
        
        for (I=1,Count) 
        {
            holoCreate(I)
            holoScale(I,vec(0.6,0.2,0.15))
            holoModel(I,"sphere")
            holoColor(I,vec(79,51,9))
            holoEntity(I):setTrails(6,6,50,"trails/laser",holoEntity(I):getColor(),255)
            holoAng(I,ang(0,randint(-1,2)*90,0))
            Status:setString(I,"moving")
            
            timer("turn"+I,randint(1000,5000))
        }
    }
    
    
    for(I=1,Count)
    {
        Roach=holoEntity(I)
        
        if(Status[I,string]=="moving")
        {
            holoPos(I,Roach:pos()+Roach:forward()*1.1)
            
            RngF=rangerOffset(5,Roach:pos(),Roach:forward()*1)
            RngFD=rangerOffset(5,Roach:pos()+Roach:forward()*10,Roach:up()*-1)
            RngD=rangerOffset(5,Roach:pos(),Roach:up()*-1)
            
            if(!RngFD:hit()|RngF:hit()|clk("turn"+I))
            {
                Roach:soundPlay(1,0,"roach/rch_walk.wav")
                soundPitch(1,randint(0.5,3)*60)
                holoAng(I,ang(0,randint(-2,1)*90,0))
            }
            if(clk("turn"+I)){timer("turn"+I,randint(1000,5000))}
            
            
            if(RngF:hit())
            {
                RngU=rangerOffset(5,Roach:pos(),Roach:up()*1)
                
                if(RngU:hit())
                {
                    Status:setString(I,"captured")
                    holoParent(I,RngU:entity())
                    
                    Roach:soundPlay(2,0,"roach/rch_die.wav")
                    soundPitch(2,randint(1,3)*60)
                }
            }
            
            
        }
        elseif(Status[I,string]=="captured")
        {
            RngU=rangerOffset(5,Roach:pos(),Roach:up()*1)
            
            holoAng(I,ang(0,randint(-2,1)*20,0))
            
            if(!RngU:hit())
            {
                Status:setString(I,"moving")
                holoUnparent(I)
            }
        }
        
        
        #roach gravity!
        if(!RngD:hit())
        {
            if(!RngFD:hit())
            {
                holoPos(I,Roach:pos()+vec(0,0,-5.7))
            }
        }
        else
        {
            Diff=2-RngD:distance()
            holoPos(I,Roach:pos()+vec(0,0,Diff))
        }
    }
    pictures:

    __________________________________________________ _______
    Uncle fungus
    Instructions:spawn chip, spawn a skull, crouch to bring him infront of you. Rope anything to him, proceed.
    Code:
    Code:
    @name Uncle Fungus
    @inputs 
    @outputs [E]:entity [Props]:array Model:string V:vector Active AllowAC ArmRot Parented
    @persist [Merge Exit]:array Z Down
    runOnTick(1)
    
    O=owner()
    E=Props[1,entity]
    findIncludePlayerProps(O)
    
    if(first())
    {
        Model="models/Gibs/HGIBS.mdl"
        
        Active=1
        AllowAC=1
        Parented=0
        
        Merge=array(
        "vo/ravenholm/aimforhead.wav",
        "vo/ravenholm/bucket_almost.wav",
        "vo/ravenholm/bucket_thereyouare.wav",
        "vo/ravenholm/engage01.wav",
        "vo/ravenholm/grave_stayclose.wav",
        "vo/ravenholm/pyre_keepeye.wav",
        "vo/ravenholm/shotgun_closer.wav",
        "vo/ravenholm/monk_coverme04.wav",
        "vo/ravenholm/shotgun_keepitclose.wav")
        
        Exit=array(
        "vo/ravenholm/exit_darkroad.wav",
        "vo/ravenholm/exit_goquickly.wav",
        "vo/ravenholm/exit_hurry.wav",
        "vo/ravenholm/exit_nag01.wav",
        "vo/ravenholm/exit_nag02.wav",
        "vo/ravenholm/exit_salvation.wav",
        "vo/ravenholm/monk_blocked03.wav",
        "vo/ravenholm/monk_kill02.wav",
        "vo/ravenholm/monk_kill05.wav",
        "vo/ravenholm/monk_kill09.wav")
        
        timer("search",1000)
        timer("confirm",2000)
    }
    
    if(clk("search")&!E)
    {
        #main search
        findByModel(Model)
        Props=findToArray()
        
        timer("search",2000)
        
    }
    elseif(clk("search")&E)
    {
        hint("Skull found.",5)
        
        E:setAlpha(255)
    }
    
    
    #tell you to spawn the prop, but not every time it searches
    if(clk("confirm")&!E)
    {
        timer("confirm",10000)
        hint("Spawn a skull to begin.",5)
    }
    
    #set the weight
    if(changed(E)&E)
    {
        E:setMass(35000)
        holoCreate(1)
        holoModel(1,"models/Gibs/HGIBS_spine.mdl")
        
        holoCreate(3)
        holoCreate(4)
        
        holoModel(3,"models/skeleton/skeleton_arm.mdl")
        holoModel(4,"models/skeleton/skeleton_arm_L.mdl")
        
        holoScale(3,vec(0.6,0.6,0.6))
        holoScale(4,vec(0.6,0.6,0.6))
    }
    
    #restrict the arms from going to far forward
    if(E:angles():pitch()<=-10){ArmRot=-10}
    
    
    if(E)
    {
        #make the spine move and stuff
        holoPos(1,E:pos()+(O:up()*-8.6)+(O:forward()*-0.5))
        holoAng(1,ang(0,E:angles():yaw()-90,0))
            
        holoPos(3,E:pos()+(O:up()*-10.6)+(E:right()*8)+(E:forward()*-2))
        holoAng(3,ang(ArmRot,E:angles():yaw(),E:angles():roll()+20))
        
        holoPos(4,E:pos()+(O:up()*-10.6)+(E:right()*-8)+(E:forward()*-2))
        holoAng(4,ang(ArmRot,E:angles():yaw(),E:angles():roll()-20))
    
    
        #floats the fungus
        rangerHitWater(1)
        rangerFilter(E)
        Rng = rangerOffset(E:pos(),E:pos()-vec(0,0,100))
        if (Rng:hit()&Active) 
        {
            Diff = 60-Rng:distance()
            if(!owner():inNoclip()){
                E:applyForce((vec(0,0,Diff+(Z+$Z))*20-E:vel())*E:mass())
            }
        }
    
        #move when hes behind you
        if(!owner():isCrouch()&Active)
        {
            E:propNotSolid(1)
            
            V=(O:pos()-E:pos()+(O:forward()*-50)+vec(0,0,50))*E:mass()*5
        }
        elseif(owner():isCrouch()&Active)
        {
            E:propNotSolid(0)
            
            V=(O:pos()-E:pos()+(O:forward()*70)+vec(0,0,30))*E:mass()*5
        }
        elseif((!owner():isCrouch()|owner():isCrouch())&!Active)
        {
            E:propNotSolid(1)
                
            V=(O:shootPos()-E:pos())*E:mass()*7
        }
        
        E:applyForce(V+$V*5)
        
        
        if(changed(Active)&!Active|clk("align"))
        {
            holoCreate(2)
            holoModel(2,"models/Gibs/HGIBS.mdl")
            holoAng(2,owner():attachmentAng("eyes"))
            holoPos(2,owner():attachmentPos("anim_attachment_head")+(O:up()*3)+(O:forward()*4)+(O:right()*-0.15))
            
            timer("parent",100)
        }
        
        if(clk("parent")){holoParentAttachment(2,O,"eyes")}
        if(clk("nope.avi")){E:propNotSolid(0)}
        
        
        if(changed(owner():isCrouch())&!owner():isCrouch()&owner():weapon():type()=="weapon_simplekeys"&!Parented&!Active)
        {
            if(!Parented){timer("align",100)}
            Parented=1
        }
        
        if(changed(owner():isCrouch())&!owner():isCrouch()&!Active)
        {
            E:propNotSolid(1)
        }
        
    
        #thanks jason, this code really helped ;D
        E:applyTorque(( 150 * E:toLocalAxis(rotationVector(quat( (owner():aimPos() - E:pos()):toAngle() ) / quat(E) ) ) - 12 * E:angVelVector()) * E:inertia())
    
    }
    
    if(owner():isCrouch()&changed(owner():keyAttack2())&owner():keyAttack2()&owner():keyUse()&Active&AllowAC)
    {
        Active=0
        AllowAC=0
        E:setAlpha(0)
        holoAlpha(1,0)
        holoAlpha(3,0)
        holoAlpha(4,0)
        
        timer("nope.avi",1000)
        
        E:soundPlay(1,0,Merge:string(randint(1,Merge:count())))
        
        timer("AllowAC",1000)
    }
    elseif(owner():isCrouch()&changed(owner():keyAttack2())&owner():keyUse()&owner():keyAttack2()&!Active&AllowAC)
    {
        Active=1
        AllowAC=0
        Parented=0
        E:setAlpha(255)
        holoAlpha(1,255)
        holoAlpha(3,255)
        holoAlpha(4,255)
        
        E:soundPlay(2,0,Exit:string(randint(1,Exit:count())))
        
        holoDelete(2)
        timer("AllowAC",1000)
    }
    
    if(clk("AllowAC")&!AllowAC)
    {
        AllowAC=1
    }
    
    
    if(changed(Z)&Z>=12)
    {
        Down=1
    }
    if(changed(Z)&Down&Z<=1)
    {
        Down=0
    }
    
    
    if(Down)
    {
        if(Z>5)
        {
            Z-=0.2
        }
        else
        {
            Z-=0.05
        }
    }
    else
    {
        if(Z<5)
        {
            Z+=0.2
        }
        else
        {
            Z+=0.05
        }
    }


    ________________________-
    I KNOW this isnt an AI chip, but i wanted to squeeze it in
    (right after this im also making an in depth thread about a stargate i made, AND a thread about a holo dashboard i made.

    Name:Postman physgun
    Instructions:
    If you want to be able to rotate the actual physgun in any direction (no gimbal lock), spawn 4 numbpad inputs (8,4,6,5), and wire the e2 (up down left right) to those numbpads.

    Controls:
    Get out something other than the gmod physgun
    Works like a normal physgun, besides rotating the actual physgun.
    Crouch + E throws it (let go of holding at the right time)

    *I know its glitchy, i know it has issues, i know it sucks, but its cool to say the least*

    Code:
    @name Postman_physgun V5
    @inputs Left Right Up Down
    @outputs Reset AddPitchP AddYawP AddPitch AddYaw
    @persist Prop:entity Dist BeamDist PhysHeight PhysRight 
    @persist NearestAngP NearestAngY TempAngP TempAngY
    @persist [V V1 Target]:vector Rng:ranger
    @model models/weapons/w_physics.mdl
    runOnTick(1)
    E=entity()
    
    if(first())
    {
        E:setSkin(1)
        E:setMass(50000)
        AddPitchP=0
        AddYawP=0
    }
    
    #clamp the values, clamp() doesnt work
    if(PhysHeight>=100){PhysHeight=100}
    if(PhysHeight<=50){PhysHeight=50}
    
    if(PhysRight>=50){PhysRight=50}
    if(PhysRight<=20){PhysRight=20}
    
    
    #thanks jason, this code really helped ;D
    E:applyTorque(( 150 * E:toLocalAxis(rotationVector(quat( (owner():aimPos() - E:pos()):toAngle() + ang(AddPitchP,AddYawP,0) ) / quat(E) ) ) - 12 * E:angVelVector()) * E:inertia())
    
    
    #Add ang to the prop/physgun when needed
    if(Up&!owner():keyReload()&!owner():keyUse()){AddPitchP+=2}elseif(Up&owner():keyReload()&!owner():keyUse()){AddPitchP+=0.5}
    if(Down&!owner():keyReload()&!owner():keyUse()){AddPitchP-=2}elseif(Down&owner():keyReload()&!owner():keyUse()){AddPitchP-=0.5}
    
    if(Left&!owner():keyReload()&!owner():keyUse()){AddYawP+=2}elseif(Left&owner():keyReload()&!owner():keyUse()){AddYawP+=0.5}
    if(Right&!owner():keyReload()&!owner():keyUse()){AddYawP-=2}elseif(Right&owner():keyReload()&!owner():keyUse()){AddYawP-=0.5}
    
    
    #Add ang to the prop when needed
    if(Up&!owner():keyReload()&owner():keyUse()){AddPitch+=2}elseif(Up&owner():keyReload()&owner():keyUse()){AddPitch+=0.5}
    if(Down&!owner():keyReload()&owner():keyUse()){AddPitch-=2}elseif(Down&owner():keyReload()&owner():keyUse()){AddPitch-=0.5}
    
    if(Left&!owner():keyReload()&owner():keyUse()){AddYaw+=2}elseif(Left&owner():keyReload()&owner():keyUse()){AddYaw+=0.5}
    if(Right&!owner():keyReload()&owner():keyUse()){AddYaw-=2}elseif(Right&owner():keyReload()&owner():keyUse()){AddYaw-=0.5}
    
    #Reset the added ang on the physgun
    if(((AddPitchP>0|AddYawP>0)|(AddPitchP<0|AddYawP<0))&changed(owner():keyReload())&owner():keyReload()&!owner():keyUse()&owner():isCrouch())
    {
        AddPitchP=0
        AddYawP=0
    }
    
    if(changed(Reset)&Reset){AddPitch=0,AddYaw=0}
    
    
    #moving the physgun above you
    if(owner():isCrouch())
    {
        PhysHeight--
        PhysRight+=0.5
        V = (owner():pos()+vec(0,0,PhysHeight)+(owner():right()*PhysRight) - ( -owner():eye()*70))-E:massCenter()
        E:applyForce((V+$V*20)*E:mass()*2)
    }
    elseif(!owner():isCrouch())
    {
        PhysHeight++
        PhysRight-=0.5
        V = (owner():pos()+vec(0,0,PhysHeight)+(owner():right()*PhysRight) - ( -owner():eye()*100))-E:massCenter()
        E:applyForce((V+$V*20)*E:mass()*2)
    }
    
    
    #creats the beams
    if(changed(owner():keyAttack1())&owner():keyAttack1()&owner():weapon():type()!="weapon_physgun")
    {
        holoCreate(1,E:pos()+vec(0,0,20))
        holoParent(1,E)
        
        if(Prop:isFrozen()){Prop:propFreeze(0)}
        
    }
    elseif(changed(owner():keyAttack1())&!owner():keyAttack1())
    {
        holoDelete(1)
    }
    
    #Freeze the prop
    if(Prop&changed(owner():keyAttack2())&owner():keyAttack2()&owner():keyAttack1()&!Prop:isFrozen()){Prop:propFreeze(1)}
    
    
    #limit the physbeam
    if(E:pos():distance(Rng:position())/2>=600){BeamDist=600}
    elseif(E:pos():distance(Rng:position())/2<600){BeamDist=E:pos():distance(Rng:position())/2}
    
    
    if(owner():keyAttack1()&owner():weapon():type()!="weapon_physgun")
    {
        Reset=0
        
        
        #make the ranger
        rangerFilter(E)
        Rng=rangerOffset(600, E:pos(),E:forward())
        
        #make the holos
        holoAng(1,E:angles())
        holoColor(1,vec(0,20,200))
        holoAlpha(1,200)
        holoScale(1,vec(E:pos():distance(Rng:position())/12,0.1,0.1))
        holoPos(1,E:pos()+E:forward()*BeamDist)
        
        #throwing!
        if(owner():isCrouch() & owner():keyUse() & (AddPitchP<=0|AddPitchP>=0) & (AddYawP<=0|AddYawP>=0) )
        {
            Prop:applyForce(owner():eye()*Prop:mass()*Prop:mass()*500)
        }
        
    
        #thanks jason, this code really helped ;D
        Prop:applyTorque(( 150 * Prop:toLocalAxis(rotationVector(quat(Prop:pos():toAngle() + ang(AddPitch,AddYaw,0) ) / quat(Prop) ) ) - 12 * Prop:angVelVector()) * Prop:inertia())
    
    
        #force the prop
        Target=(E:pos()+E:forward()*Dist)
        V1=(Target-Prop:massCenter())*Prop:mass()*3
        Prop:applyForce(V1+$V1*10)
    }
    elseif(owner():keyAttack1()&owner():weapon():type()=="weapon_physgun"){E:setColor(200,0,0)}else{E:setColor(255,255,255)}
    
    
    #sets the distance
    if(changed(Prop)){Dist=(E:pos():distance(Rng:position()))}
    
    #Sets the prop you pick up(so props with holes through them will still be grabbed)
    if(changed(owner():keyAttack1())&owner():keyAttack1()&owner():weapon():type()!="weapon_physgun"&owner():aimEntity()!=E
    |!Prop&owner():weapon():type()!="weapon_physgun"&owner():aimEntity()!=E)
    {
        Prop=Rng:entity()
    }
    elseif(changed(owner():keyAttack1())&!owner():keyAttack1())
    {
        Prop=noentity()
    }
    Picture:
    Last edited by postman; 11-07-2011 at 07:56 PM.
    TylerB, Grocel, Jack37 and 1 others like this.

  2. #2
    Wannabe Wiremod Helper TylerB's Avatar
    Join Date
    Mar 2010
    Location
    Starbuck, Minnesota, US
    Posts
    1,163

    Default Re: [E2] AI release thread.

    Nice release, though I spotted an error in the first chip.



    You need to replace
    Code:
    soundPlay(1,0,"vehicles/v8/v8_idle_loop0.wav")
    with
    Code:
    soundPlay(1,0,"vehicles/v8/v8_idle_loop1.wav")

  3. #3
    Wire Sofaking postman's Avatar
    Join Date
    Mar 2010
    Location
    oregon
    Posts
    1,089

    Default Re: [E2] AI release thread.

    Quote Originally Posted by TylerB View Post
    Nice release, though I spotted an error in the first chip.



    You need to replace
    Code:
    soundPlay(1,0,"vehicles/v8/v8_idle_loop0.wav")
    with
    Code:
    soundPlay(1,0,"vehicles/v8/v8_idle_loop1.wav")

  4. #4
    Wannabe Wiremod Helper TylerB's Avatar
    Join Date
    Mar 2010
    Location
    Starbuck, Minnesota, US
    Posts
    1,163

    Default Re: [E2] AI release thread.

    I don't have that sound :/, is it custom or something?

  5. #5
    Wire Sofaking postman's Avatar
    Join Date
    Mar 2010
    Location
    oregon
    Posts
    1,089

    Default Re: [E2] AI release thread.

    No, its not, perhaps its one garry added and then removed, somehow i still have it.

    Ima just replace the one in the code with the one you posted. (does it sound good?)

  6. #6
    Developer Jack37's Avatar
    Join Date
    Jul 2009
    Location
    Slovakia
    Posts
    1,312

    Default Re: [E2] AI release thread.

    Great release, I like all of it.

    Only the small secrets need to be protected. The big ones are kept secret by public incredulity.

  7. #7
    Indie Developer Okei's Avatar
    Join Date
    Jul 2011
    Location
    Romania,Bucharest
    Posts
    113

    Default Re: [E2] AI release thread.

    I love the bird and the aquarium . You have great stuff here keep working . Hope you'll post more.

  8. #8
    Banned mrBuBB13s's Avatar
    Join Date
    Oct 2010
    Location
    Techni can fuck himself
    Posts
    138

    Default Re: [E2] AI release thread.

    Very cool.

  9. #9
    Wire Sofaking postman's Avatar
    Join Date
    Mar 2010
    Location
    oregon
    Posts
    1,089

    Default Re: [E2] AI release thread.

    Quote Originally Posted by okeidev View Post
    I love the bird and the aquarium . You have great stuff here keep working . Hope you'll post more.
    [E2] Three of my best E2's release thread [STARGATE, HOLO DASHBOARD, POLTERGIEST]

    if you havnt seen.

Posting Permissions

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