Home Showcase
Welcome to the new Diaspora forums, please let us know if you see anything broken! Notice: Some users may need to reupload their avatars due to an issue during forum setup!

Lt.Brandon's E2 Turret

LtBrandonLtBrandon Registered, Administrator Posts: 507
edited November 2011 in Showcase #1
I've had a lot of people ask me for this, so I'm finally going to give the lesser version away. Takes Entity for targeting, but can be edited to use Vector as well.

Functions:
  • Detects if it's about to shoot a friendly, and if it is, stops itself.
  • Can hold multiple guns
  • Easy to modify with whatever you need
  • Can be turned off to save OPs
Usage:
  • Step 1: Put down the E2 and any two guns you want attached
  • Step 2: Position the guns however you want them, just make sure they are aligned with the gun hologram
  • Step 3: Link your guns to LS
  • Step 4: Wire the Turretwl and Turret2wl to your guns
  • Step 5: Wire the Target to something that outputs an Entity target
  • Step 6: Wire Active to whatever you want to tell the guns to turn on and start tracking targets
  • Step 7: Wire Fire to whatever you want to tell the guns to start shooting
  • Step 8: Kill stuff
I request that you don't give out any edited versions of this, I prefer to only have the version I release here being given to people.

Now in 3 sizes!

Normal Sized:
@name E2 Holo Turret
@inputs Target:entity [Turretwl Turret2wl]:wirelink Active Fire
@persist MaxElevation MinElevation Range Hitscan:ranger
@model models/Stat_Turrets/st_turretswivel.mdl
interval(100)
runOnChat(1)
runOnLast(1)
if (first()|duped()){
    #Variables
    MaxElevation = 75
    MinElevation = -10
    Range = 15000
    
        #Holograms
        holoCreate(1,entity():toWorld(vec(0,0,10)))
            holoScale(1,vec(1,1,1))
            holoColor(1,vec(91,91,100))
            holoAng(1,entity():toWorld(ang(0,0,0)))
            holoAlpha(1,255)
            holoModel(1,"models/Stat_Turrets/st_turretstub.mdl")
            holoParent(1,entity())
                
                holoCreate(11,holoEntity(1):toWorld(vec(0,0,25)))
                    holoScale(11,vec(1,1,1))
                    holoColor(11,vec(91,91,100))
                    holoAng(11,holoEntity(1):toWorld(ang(0,0,0)))
                    holoAlpha(11,255)
                    holoModel(11,"models/Stat_Turrets/st_turretdual.mdl")
                    holoParent(11,1) # this is the holo that acts as an axis
                
                    holoCreate(2,holoEntity(11):toWorld(vec(0,0,25)))
                        holoScale(2,vec(5,4,4))
                        holoColor(2,vec(91,91,100))
                        holoAlpha(2,255)
                        holoModel(2,"models/Slyfo_2/weap_prover_industrialspiker.mdl") #here you put the holo thats gonna be representing the "gun"
                        holoAng(2,holoEntity(11):toWorld(ang(0,0,0))) 
                        holoParent(2,1) 
            
        print("Turret online! Say !deparent to remove your guns from the turret!")
        
} 

if(~Turretwl&Turretwl){
    Turretwl:entity():setAlpha(255)
    Turretwl:entity():setSolid(1)
    Turretwl:entity():parentTo(holoEntity(2))
    }
    
if(~Turret2wl&Turret2wl){
    Turret2wl:entity():setAlpha(255)
    Turret2wl:entity():setSolid(1)
    Turret2wl:entity():parentTo(holoEntity(2))
    }

if (Active){
    TBearing=entity():bearing(Target:pos())
    TElevation=entity():elevation(Target:pos())
    if (TElevation<MinElevation){TElevation=0 TBearing=0} elseif (TElevation>MaxElevation) {TElevation=0 TBearing=0}
    holoAng(1,entity():toWorld(ang(0,0-TBearing,0)))
    holoAng(11,holoEntity(1):toWorld(ang(0,90,0-TElevation)))
    holoAng(2,holoEntity(11):toWorld(ang(0,-90,0)))
            
    #Check if the target is owned by the owner of the chip, or is on the owners prop protection before firing
    rangerFilter(Turretwl:entity())
    rangerFilter(Turret2wl:entity())
    Hitscan = rangerOffset(Range, holoEntity(2):pos(), holoEntity(2):forward())
    if (Hitscan:entity():owner() == owner() | owner():trusts(Hitscan:entity():owner()))
    {
        Turretwl["Fire", number] = 0
        Turret2wl["Fire", number] = 0
    }
    elseif (Hitscan:entity():owner() == Target:owner())
    {
        Turretwl["Fire", number] = Fire
        Turret2wl["Fire", number] = Fire
    }
}

if ( chatClk(owner()) & owner():lastSaid():lower() == "!deparent" ) { 
    #Unparent the weapons
     Turretwl:entity():deparent()
     Turret2wl:entity():deparent()
     print("Weapons Detached!")
    
    }

if (last()){
 #Remove the guns if the turret is deleted   
 Turretwl:entity():propDelete()
 Turret2wl:entity():propDelete()
}

Large Sized:
@name E2 Holo Turret
@inputs Target:entity [Turretwl Turret2wl]:wirelink Active Fire
@persist MaxElevation MinElevation Range Hitscan:ranger
@model models/Stat_Turrets/st_turretbase.mdl
interval(100)
runOnChat(1)
runOnLast(1)
if (first()|duped()){
    #Variables
    MaxElevation = 75
    MinElevation = -10
    Range = 15000
    
    entity():setColor(91,91,100)
    
        #Holograms
        holoCreate(1,entity():toWorld(vec(0,-8,30)))
            holoScale(1,vec(1,1,1))
            holoColor(1,vec(91,91,100))
            holoAng(1,entity():toWorld(ang(0,0,0)))
            holoAlpha(1,255)
            holoModel(1,"models/Stat_Turrets/st_turretswivel.mdl")
            holoParent(1,entity())
                
                holoCreate(11,holoEntity(1):toWorld(vec(0,0,25)))
                    holoScale(11,vec(1,1,1))
                    holoColor(11,vec(91,91,100))
                    holoAng(11,holoEntity(1):toWorld(ang(0,0,0)))
                    holoAlpha(11,255)
                    holoModel(11,"models/Stat_Turrets/st_turretdual.mdl")
                    holoParent(11,1) # this is the holo that acts as an axis
                
                    holoCreate(2,holoEntity(11):toWorld(vec(0,0,25)))
                        holoScale(2,vec(5,4,3))
                        holoColor(2,vec(91,91,100))
                        holoAlpha(2,255)
                        #here you put the holo thats gonna be representing the "gun"
                        holoModel(2,"models/Slyfo_2/weap_prover_energyblasterlrg.mdl") 
                        holoAng(2,holoEntity(11):toWorld(ang(0,0,0))) 
                        holoParent(2,1) 
            
        print("Turret online! Say !deparent to remove your guns from the turret!")
        
} 

if(~Turretwl&Turretwl){
    Turretwl:entity():setAlpha(255)
    Turretwl:entity():setSolid(1)
    Turretwl:entity():parentTo(holoEntity(2))
    }
    
if(~Turret2wl&Turret2wl){
    Turret2wl:entity():setAlpha(255)
    Turret2wl:entity():setSolid(1)
    Turret2wl:entity():parentTo(holoEntity(2))
    }

if (Active){
    TBearing=entity():bearing(Target:pos())
    TElevation=entity():elevation(Target:pos())
    if (TElevation<MinElevation){TElevation=0 TBearing=0} elseif (TElevation>MaxElevation) {TElevation=0 TBearing=0}
    holoAng(1,entity():toWorld(ang(0,0-TBearing,0)))
    holoAng(11,holoEntity(1):toWorld(ang(0,90,0-TElevation)))
    holoAng(2,holoEntity(11):toWorld(ang(0,-90,0)))
            
    #Check if the target is owned by the owner of the chip, or is on the owners prop protection before firing
    rangerFilter(Turretwl:entity())
    rangerFilter(Turret2wl:entity())
    Hitscan = rangerOffset(Range, holoEntity(2):pos(), holoEntity(2):forward())
    if (Hitscan:entity():owner() == owner() | owner():trusts(Hitscan:entity():owner()))
    {
        Turretwl["Fire", number] = 0
        Turret2wl["Fire", number] = 0
    }
    elseif (Hitscan:entity():owner() == Target:owner())
    {
        Turretwl["Fire", number] = Fire
        Turret2wl["Fire", number] = Fire
    }
}

if ( chatClk(owner()) & owner():lastSaid():lower() == "!deparent" ) { 
    #Unparent the weapons
     Turretwl:entity():deparent()
     Turret2wl:entity():deparent()
     print("Weapons Detached!")
    
    }

if (last()){
 #Remove the guns if the turret is deleted   
 Turretwl:entity():propDelete()
 Turret2wl:entity():propDelete()
}

Mod Bridge Edition:
@name E2 Holo Turret
@inputs Target:entity [Turretwl Turret2wl]:wirelink Active Fire
@persist MaxElevation MinElevation Range Hitscan:ranger
@model models/cerus/modbridge/misc/engines/eng_sq11b.mdl
interval(100)
runOnChat(1)
runOnLast(1)
if (first()|duped()){
    #Variables
    MaxElevation = 75
    MinElevation = -10
    Range = 15000
    
    entity():setColor(91,91,100)
    
        #Holograms
        holoCreate(1,entity():toWorld(vec(0,0,60)))
            holoScale(1,vec(1,1,1))
            holoColor(1,vec(91,91,100))
            holoAng(1,entity():toWorld(ang(0,0,0)))
            holoAlpha(1,255)
            holoModel(1,"models/Stat_Turrets/st_turretswivel.mdl")
            holoParent(1,entity())
                
                holoCreate(11,holoEntity(1):toWorld(vec(0,0,25)))
                    holoScale(11,vec(1,1,1))
                    holoColor(11,vec(91,91,100))
                    holoAng(11,holoEntity(1):toWorld(ang(0,0,0)))
                    holoAlpha(11,255)
                    holoModel(11,"models/Stat_Turrets/st_turretdual.mdl")
                    holoParent(11,1) # this is the holo that acts as an axis
                
                    holoCreate(2,holoEntity(11):toWorld(vec(0,0,25)))
                        holoScale(2,vec(5,4,3))
                        holoColor(2,vec(91,91,100))
                        holoAlpha(2,255)
                        #here you put the holo thats gonna be representing the "gun"
                        holoModel(2,"models/Slyfo_2/weap_prover_energyblasterlrg.mdl") 
                        holoAng(2,holoEntity(11):toWorld(ang(0,0,0))) 
                        holoParent(2,1) 
            
        print("Turret online! Say !deparent to remove your guns from the turret!")
        
} 

if(~Turretwl&Turretwl){
    Turretwl:entity():setAlpha(255)
    Turretwl:entity():setSolid(1)
    Turretwl:entity():parentTo(holoEntity(2))
    }
    
if(~Turret2wl&Turret2wl){
    Turret2wl:entity():setAlpha(255)
    Turret2wl:entity():setSolid(1)
    Turret2wl:entity():parentTo(holoEntity(2))
    }

if (Active){
    TBearing=entity():bearing(Target:pos())
    TElevation=entity():elevation(Target:pos())
    if (TElevation<MinElevation){TElevation=0 TBearing=0} elseif (TElevation>MaxElevation) {TElevation=0 TBearing=0}
    holoAng(1,entity():toWorld(ang(0,0-TBearing,0)))
    holoAng(11,holoEntity(1):toWorld(ang(0,90,0-TElevation)))
    holoAng(2,holoEntity(11):toWorld(ang(0,-90,0)))
            
    #Check if the target is owned by the owner of the chip, or is on the owners prop protection before firing
    rangerFilter(Turretwl:entity())
    rangerFilter(Turret2wl:entity())
    Hitscan = rangerOffset(Range, holoEntity(2):pos(), holoEntity(2):forward())
    if (Hitscan:entity():owner() == owner() | owner():trusts(Hitscan:entity():owner()))
    {
        Turretwl["Fire", number] = 0
        Turret2wl["Fire", number] = 0
    }
    elseif (Hitscan:entity():owner() == Target:owner())
    {
        Turretwl["Fire", number] = Fire
        Turret2wl["Fire", number] = Fire
    }
}

if ( chatClk(owner()) & owner():lastSaid():lower() == "!deparent" ) { 
    #Unparent the weapons
     Turretwl:entity():deparent()
     Turret2wl:entity():deparent()
     print("Weapons Detached!")
    
    }

if (last()){
 #Remove the guns if the turret is deleted   
 Turretwl:entity():propDelete()
 Turret2wl:entity():propDelete()
}
This is a block of text that can be added to posts you make. There is a 255 character limit.

Lλmbdλ: donations for coding the space future of diaspora :>

Get your extra long EVE trial here!

Comments

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file