tAPI Trekko727's Guns Mod

Discussion in 'Released' started by Trekko727, Dec 17, 2014.

?

What should be the next update for 0.8.7?

Poll closed Mar 14, 2015.
  1. Work on the Gun system, View Range, and Gun Accuracy (takes alot of time, 3-5 months)

    9 vote(s)
    56.3%
  2. Work on 33 more guns

    7 vote(s)
    43.8%
  1. IamWeasl

    IamWeasl Terrarian

    Thanks Trekko! Ill try make a uzi sprite for you! Also i completely forgot to scale the G-18 properly! Here is the correct version
     

    Attached Files:

    • G-18.png
      G-18.png
      File size:
      394 bytes
      Views:
      223
    Last edited: Mar 15, 2015
  2. Trekko727

    Trekko727 Terrarian

    thanks
     
  3. Trekko727

    Trekko727 Terrarian

    Hello back guys!
    I've been thinking about terraria and the gun mod. (yes, its still going to happen!)
    Things to note about the massive update:
    - I've planned to eliminate the aim time because its just not worth it. (unless you have tanks or what not.)
    - The reticle will be a simple A, without the reload bar around it (^ shape)
    - planned to reduce all gun's view range by 25% and increase gun range by 30%
    + CLASSES! You will be able to load your class that gets you perks, also note that gun class will be available. (boost for gun's stats)
    + Plan to implement Standard shells (100% dmg), Armour Piercing Shells (150% dmg) and Incendiary Shells (225% dmg with blast radius).
     
    Logodum likes this.
  4. hend

    hend Terrarian

    Awesome mod, but bullets take way to much crafting materials... I mean... 2 hellstone, 1 iron for 4 shells + 2 lead per bullet extra...
    I didn't even have lead in my original world so I had to make another one, farming it is absolutely boring and the work it takes to make one bullet is just way to much for just a bullet, lol.
     
  5. Trekko727

    Trekko727 Terrarian

    I'm very sorry!
    Maybe 2 copper? I think thats much worth it.
    NOTE: I have updated the download link realising that I have 3 mod files that are of slight differences.
     
    Last edited: Apr 14, 2015
    hend likes this.
  6. Soulight

    Soulight Official Terrarian

    AK-47 and Uzi for you.Tell me if they are good. :)
    EDIT: Changed Ak47 to AK-47, just in case. Also tell me if you want them bigger. These are 32x32 and scaled to 64x64 so they look bigger.
    EDIT2: Gonna try to make the Mosin, also if you could gimme a size for the guns, since I'm new with Terraria spriting.
    EDIT3: Too many edits, tell me if you want the Mosin with scope or without :D
     

    Attached Files:

    • Uzi.png
      Uzi.png
      File size:
      466 bytes
      Views:
      210
    • AK-47.png
      AK-47.png
      File size:
      568 bytes
      Views:
      971
    Last edited: Apr 15, 2015
  7. Trekko727

    Trekko727 Terrarian

    I'm fine without scope, thanks!
    64x64 scale would be great! thanks!
    great work on the guns! I appreciate it!
     
  8. Soulight

    Soulight Official Terrarian

    Alright, gonna start spriting :p
    EDIT: Done. Looks pretty sucky imo, also took longer than expected because the colors are tricky.
    EDIT2: Made a Colt too :p
     

    Attached Files:

    Last edited: Apr 16, 2015
    Potetgull92 and Trekko727 like this.
  9. Trekko727

    Trekko727 Terrarian

    Guys, I'm very sorry that the update caused a bug to the game! I'll be patching it up in a while.
     
  10. godpowers2

    godpowers2 Terrarian

    Hey i was wondering if someone could tell me how the accuracy thing works, i couldnt find any documentation on it.
     
  11. Trekko727

    Trekko727 Terrarian

    Hi all! I'm back. I admit that I couldn't do much last year and it was indeed a disappointment for me and all of you.
    So to sum it up last October till now:

    I was learning programming/coding/scripting. I have to admit it's great news! I am currently working on something bigger and also finding time to work on this as well!
    I haven't touch this project for a long time perhaps for the reason that I was doing the other project.
    What I was learning was through Khan Academy. It's free, please take your time to check it out and learn programming!
    I'm currently scripting with Lua.
    below is my code, that I took 1 and a half month to finish.
    Code:
    wait()
    Tool = script.Parent;
    damage = Tool.Damage.Value
    Att = Tool.Attachments.Value
    ACCURA = script.Parent.ACC
    RangeFinder = Tool.EffectiveRange.Value
    HIP = (ACCURA.HIP.Value/10)*1.2
    HIPCHANCE = ACCURA.HIP.CHANCE.Value/10
    BULLSEYEHIP = HIP*0.9
    ADS = ACCURA.ADS.Value/100
    ADSCHANCE = ACCURA.ADS.CHANCE.Value/1000
    BULLSEYEADS = ADS*0.95
    FIRED = ACCURA.FIRED.Value/100
    MOVING = ACCURA.MOVING.Value/100
    JUMPING = ACCURA.JUMPING.Value/100
    CROUCHING = (ACCURA.CROUCHING.Value/100)*-1
    AttVal1 = Tool.Attachments.Sights.Validity.Value
    AttVal2 = Tool.Attachments.Suppressor.Validity.Value
    AttVal3 = Tool.Attachments.Underbarrel.Validity.Value
    AttVal4 = Tool.Attachments.Stock.Validity.Value
    pock = Tool.Attachments.Stock
    sight = Tool.Attachments.Sights
    supp = Tool.Attachments.Suppressor
    underbarrel = Tool.Attachments.Underbarrel
    mag1V = Tool.MagType:FindFirstChild("Mag1")
    mag2V = Tool.MagType:FindFirstChild("Mag2")
    mag3V = Tool.MagType:FindFirstChild("Mag3")
    --Modes; 1 for pump, 2 for bolt, 3 for semi, 4 for auto and semi, 5 for auto semi and burst, 6 for auto semi burst and autohit
    --Start; 1 for auto ,2 for semi, 3 burst, 4 autohit, 5 pump and 6 bolt
    Type = Tool.Modes.Value
    CURRENT = Tool.Modes.Start.Value
    desc = Tool.VanityStats.Description.Value
    name = Tool.VanityStats.GunName.Value
    player = game.Players.LocalPlayer
    torso = player.Character:FindFirstChild("Torso")
    Gungui = Tool.Gunrounds
    reload = 2.1
    weleds = {}
    really = false
    potato = false
    debounce = false
    faiyah = false
    cloned = false
    
    local guigun = Gungui
    local timer = time()
    local fried = false
    local triggered = false
    local actualhits = 0
    local shotsfired = 0
    local bloom = 0
    local bipbop = game:GetService("UserInputService")
    local ow = Tool.autohit
    local mod = 1
    local guigun = nil
    local anim1 = nil
    local anim2 = nil
    local anim3 = nil
    local equipe = Instance.new("Animation")
    equipe.AnimationId = "https://www.roblox.com/item.aspx?id=440116335"
    local prefire = Instance.new("Animation")
    prefire.AnimationId = "https://www.roblox.com/item.aspx?id=440217580"
    local firing = Instance.new("Animation")
    firing.AnimationId = "https://www.roblox.com/item.aspx?id=440224699"
    local CurrentClip = 20
    local Clip = 20
    local Totalclip = 400
    local player = game.Players.LocalPlayer
    local cam = game.Workspace.CurrentCamera
    local mouse = player:GetMouse()
    local body = player.Character.Torso
    local sniping = false
    local bulh = 0
    local bulads = 0
    local ignore = game.Players.LocalPlayer.Character
    local hip = nil
    local ads = nil
    local hips = nil
    local adss = nil
    --[[
    local PPOSR = Vector3.new(-0.7,0.1,-1.1)
    local PANGR = Vector3.new(math.rad(-75),math.rad(-60),math.rad(0))
    local PPOSL = Vector3.new(1.95,0.7,-0.2)
    local PANGL = Vector3.new(math.rad(20),math.rad(20),math.rad(-50))
    
    local FPPOSR = Vector3.new(-0.7,0.1,-1.1)
    local FPANGR = Vector3.new(math.rad(-90),math.rad(-10),math.rad(0))
    local FPPOSL = Vector3.new(1.95,0.7,-0.2)
    local FPANGL = Vector3.new(math.rad(20),math.rad(-20),math.rad(-50))
    local FPPOSH = Vector3.new(0,-1.5,0)
    local FPANGH = Vector3.new(math.rad(0),math.rad(40),math.rad(0))
    ]]--
    
    local ADSPOSR = Vector3.new(-1.3,0,0)
    local ADSANGR = Vector3.new(math.rad(-90),math.rad(0),math.rad(0))
    local ADSPOSL = Vector3.new(1,0,-1)
    local ADSANGL = Vector3.new(math.rad(-90),math.rad(0),math.rad(-30))
    
    if Type == 4 then
        mod = 2
    elseif Type == 5 then
        mod = 3
    elseif Type == 6 then
        mod = 4
    end
    function fire(Unit) --needs buffing for server-sided type
        bulh = math.random(0,100)
        bulads = math.random(0,100)
        local bro = Tool.Parent
        local hit,position = nil
        local ignore = FindIgnorance()
        local Dispersion = 0
        if CurrentClip > 0 and not debounce then
            debounce = true
            if not sniping and bulh >= 100-HIPCHANCE then --bro.Head.Position, **LINE BELOW**
                local ray = Ray.new(player.Character.Head.Position,(Unit*(975)+Vector3.new(math.random(-BULLSEYEHIP,BULLSEYEHIP),math.random(-BULLSEYEHIP,BULLSEYEHIP),math.random(-BULLSEYEHIP,BULLSEYEHIP))))
                 hit, position = game.workspace:FindPartOnRayWithIgnoreList(ray, ignore)
            elseif not sniping and bulh < 100-HIPCHANCE then
                local ray = Ray.new(player.Character.Head.Position,(Unit*(975)+Vector3.new(math.random(-HIP,HIP),math.random(-HIP,HIP),math.random(-HIP,HIP))))
                 hit, position = game.workspace:FindPartOnRayWithIgnoreList(ray, ignore)
            elseif sniping and bulads >= 100 - ADSCHANCE then
                local ray = Ray.new(script.Parent.ADSFocus.Position,(Unit*(975)+Vector3.new(math.random(-BULLSEYEADS,BULLSEYEADS),math.random(-BULLSEYEADS,BULLSEYEADS),math.random(-BULLSEYEADS,BULLSEYEADS))))
                 hit, position = game.workspace:FindPartOnRayWithIgnoreList(ray, ignore)
            else
                local ray = Ray.new(script.Parent.ADSFocus.Position,(Unit*(975)+Vector3.new(math.random(-ADS,ADS),math.random(-ADS,ADS),math.random(-ADS,ADS))))
                 hit, position = game.workspace:FindPartOnRayWithIgnoreList(ray, ignore)
            end
            --shotsfired = shotsfired + 1
                if hit then
                    local newdamage = damage
                    if hit.Name == "Left Arm" or hit.Name == "Left Leg" or hit.Name == "Right Arm" or hit.Name == "Right Leg" then
                        newdamage = math.ceil(damage * 0.8)
                    elseif hit.Name == "Head" then
                        newdamage = math.floor(damage * 1.9)
                    end
                    local humanoid = hit.Parent:findFirstChild("Humanoid")
                    if not humanoid and hit.Parent ~= game.Workspace then
                    humanoid = hit.Parent.Parent:findFirstChild("Humanoid")
                end
                if not humanoid and hit.Parent ~= game.Workspace and hit.Parent.Parent ~= game.Workspace then
                    humanoid = hit.Parent.Parent.Parent:findFirstChild("Humanoid")
                end
                if humanoid then
                    local targetcharacter = humanoid.Parent
                    local prey = game.Players:GetPlayerFromCharacter(targetcharacter)
                    humanoid.Health = humanoid.Health - newdamage
                end
            end
            Tool.Handle.Fire:Play()
            debounce = false
        end
    end
    
    function autokill(victim)
        local tuget = workspace:FindFirstChild(victim)
        local bodyparts = tuget:GetChildren()
        local rng = math.random(1,6) 
        if not debounce then
            debounce = true
            if tuget then
            local newdamage = damage
                if rng == 1 then -- body
                    newdamage = damage
                elseif rng > 1 and rng < 6 then -- left arm
                    newdamage = damage * 0.8
                else
                    newdamage = damage * 1.9
                end
                local atm = tuget:FindFirstChild("Humanoid")
                if atm then
                    atm.Health = atm.Health - newdamage
                end
            else
            local warning = Instance.new("TextBox")
            warning.Text = (tuget.." hasn't spawn in yet.")
            warning.BackgroundTransparency = 1
            warning.TextColor3 = Color3(255/255,162/255,0/255)
            warning.BorderSizePixel = 0
            warning.Position = UDim2.new(0,500,0,70)
            warning.Size = UDim2.new(0,400,0,18)
            warning.Parent = player.PlayerGui
            end
        Tool.Handle.Fire:Play()
        debounce = false
        end
    end
    
    function FindIgnorance()
        local damn = {}
        table.insert(damn, player.Character)
        local bull = game.Workspace:GetChildren()
        for sheet = 1, #bull do
            if bull[sheet]:FindFirstChild("Shooter",true) then
                table.insert(damn,bull[sheet]:FindFirstChild("Shooter",true).Parent)
            end
        end
    return damn end
    
    function snipster()
        sniping = true
     
    end
    
    function check()
        if not really or not Tool.Enabled then
            return true
        else
            return false
        end
    end
    
    Tool.Enabled = true
    
    function updategui()
        CurrentClip = CurrentClip - 1
        guigun.ammo.Roundsleft.Text = CurrentClip
    end
    
    function facetarg()
        local character = player.Character-- thank you nicemike40
        local atan2, pi, dir, torso, torsoPos = math.atan2, math.pi
        torso = character:FindFirstChild("Torso")
        if torso then
            torsoPos = torso.Position
            dir = (mouse.Hit.p - torsoPos).unit
            torso.CFrame = CFrame.new(torsoPos) * CFrame.Angles(0, atan2(dir.X, dir.Z) + pi, 0)
        end
    end
    
    --Modes; 1 for pump, 2 for bolt, 3 for semi, 4 for auto and semi, 5 for auto semi and burst, 6 for auto semi burst and autohit --(2 lines)
    --Start; 1 for auto ,2 for semi, 3 burst, 4 autohit, 5 pump and 6 bolt
    function rots(mouse)--pls modify CurrentClip to inventory in next update
        if not potato then
            potato = true
            facetarg()
            local targ = Tool.Modes.Target.Value
            local targetPos = mouse.Hit.p
            local dist = (targetPos - player.Character.Head.Position).magnitude
            local lookAt = (targetPos - player.Character.Head.Position).Unit
            while check() and faiyah and CurrentClip > 0 do
                triggered = true
                updatech()
                if CURRENT == 1 then
                    anim3:Play()
                    fire(lookAt)
                    updategui()
                    wait(60/Tool.Modes.firerate.Value)
                    if faiyah then
                        potato = false
                        rots(mouse)
                    end
                elseif CURRENT == 2 then
                    anim3:Play()             
                    fire(lookAt)
                    updategui()
                    wait(60/600)
                    faiyah = false
                elseif CURRENT == 3 then
                    for i=1,3 do
                        if CurrentClip > 0 then
                            anim3:Play()
                            autokill(targ)
                            updategui()
                            wait(60/900)
                        end
                    end
                elseif CURRENT == 5 then
                    fire(lookAt)
                    updategui()
                    wait(60/100)
                elseif CURRENT == 4 then
                    anim3:Play()
                    autokill(targ)
                    updategui()
                    wait(60/900)
                    if faiyah then
                        potato = false
                        rots(mouse)
                    end
                elseif CURRENT == 6 then
                    fire(lookAt)
                    updategui()
                    wait(60/100)
                end
            end
            triggered = false
        end
        potato = false
    end
    
    function KeyDown(key)
        local temp = CurrentClip
        if not potato and not really then
            really = true
            if (key =="r") and CurrentClip >= 0 and Totalclip > 0 and Totalclip >= Clip then
                Tool.Handle.Reload:Play()
                wait(reload)
                Totalclip = Totalclip + temp
                Totalclip = Totalclip - Clip
                CurrentClip = Clip
                wait()
                guigun.ammo.RoundsTotal.Text = Totalclip
                guigun.ammo.Roundsleft.Text = CurrentClip
            elseif (key == "r") and CurrentClip >= 0 and Totalclip < Clip and Totalclip > 0 then
                Tool.Handle.Reload:play()
                wait(reload)
                Totalclip = Totalclip + temp
                CurrentClip = Totalclip
                Totalclip = 0
                guigun.ammo.RoundsTotal.Text = Totalclip
                guigun.ammo.Roundsleft.Text = CurrentClip
            end
            if key == "v" and not faiyah then
                wait()
                if Type > 3 then
                    CURRENT = CURRENT + 1
                    if CURRENT > mod then
                        CURRENT = 1
                    end
                end
                if CURRENT == 1 then
                    guigun.ammo.Mode.Text = "Automatic"
                elseif CURRENT == 2 then
                    guigun.ammo.Mode.Text = "Semi-Auto"
                elseif CURRENT == 3 then
                    guigun.ammo.Mode.Text = "Burst-Fire"
                elseif CURRENT == 4 then
                    guigun.ammo.Mode.Text = "Auto-Hit"
                    ow = Tool.autohit:Clone()
                    ow.Parent = player.PlayerGui
                elseif CURRENT == 5 then
                    guigun.ammo.Mode.Text = "Pump-Action"
                elseif CURRENT == 6 then
                    guigun.ammo.Mode.Text = "Bolt-Action"
                end
                if not CURRENT == 4 then
                    local vov = player.PlayerGui:FindFirstChild("autohit")
                    if vov then
                        vov:Destroy()
                    end
                end
            end
        end
        really = false
    end
    
    function bloomer()
        local bl = player.PlayerGui:WaitForChild("Gunrounds")
        local ret = bl:WaitForChild("CH")
        local x, y = mouse.X, mouse.Y
        ret.Position = UDim2.new(0,x,0,y)
    end
    
    function updatech()
        if triggered then
            local ret = guigun.CH
            local boom = 75
            local Dispersion = (HIP * 0.1)*1.5
            Dispersion = Dispersion + FIRED
            Dispersion = Dispersion * 0.3
            ret:TweenSize(UDim2.new(0,Dispersion*boom*2+50,0,Dispersion*boom*2+50),"Out","Linear",0.24)
            bloom = 0
        end
    end
    
    function onActivated(mouse)
        wait()
        if CurrentClip > 0 and not triggered then
            anim3:Play()
            faiyah = true
            rots(mouse)
        end
    end
    
    function onDeactivated(mouse)
        faiyah = false
    end
    
    function onEquip(mouse)
        guigun = Gungui:Clone()
        guigun.Parent = player.PlayerGui
        guigun.ammo.RoundsTotal.Text = Totalclip
        guigun.ammo.Roundsleft.Text = CurrentClip
        if CURRENT == 1 then
            guigun.ammo.Mode.Text = "Automatic"
        elseif CURRENT == 2 then
            guigun.ammo.Mode.Text = "Semi-Auto"
        elseif CURRENT == 3 then
            guigun.ammo.Mode.Text = "Burst-Fire"
        elseif CURRENT == 5 then
            guigun.ammo.Mode.Text = "Pump-Action"
        elseif CURRENT == 6 then
            guigun.ammo.Mode.Text = "Bolt-Action"
        end
        bipbop.MouseIconEnabled = false
        anim1 = player.Character.Humanoid:LoadAnimation(equipe)
        anim2 = player.Character.Humanoid:LoadAnimation(prefire)
        anim3 = player.Character.Humanoid:LoadAnimation(firing)
        anim1:Play()
        mouse.Move:connect(function() bloomer() end)
        mouse.Idle:connect(function() bloomer() end)
        mouse.Button1Down:connect(function() onActivated(mouse) end)
        mouse.Button1Up:connect(function() onDeactivated(mouse) end)
        mouse.KeyDown:connect(KeyDown)
    end
    
    function onUnequip()
        bipbop.MouseIconEnabled = true
        anim1:Stop()
        anim2:Stop()
        anim3:Stop()
        guigun:Destroy()
        local bm = player.PlayerGui:FindFirstChild("autohit")
        if bm then
        bm:Destroy()
        end
    end
    
    script.Parent.Equipped:connect(onEquip)
    script.Parent.Unequipped:connect(onUnequip)
    
    while true do
        wait(0.033)
        local fierr = (60/Tool.Modes.firerate.Value)
        if CURRENT == 1 then
            fierr = (60/Tool.Modes.firerate.Value)
        elseif CURRENT == 2 then
            fierr = (60/650)
        elseif CURRENT == 3 then
            fierr = (60/950)
        elseif CURRENT == 4 then
            fierr = (60/950)
        elseif CURRENT == 5 then
            fierr = (60/200)
        elseif CURRENT == 6 then
            fierr = (60/200)
        end
        local tim = time()
        if guigun then
            local ret = guigun.CH
            if not triggered and tim - timer > (fierr*1.04) then
                ret:TweenSize(UDim2.new(0,70,0,70),"Out","Linear",0.2)
            end
        end
    end
    

    @godpowers2 -- It's just a dispersion value that is generated by RNG (Random Number Generator, or math.random). Furthermore, since the weapon in general is OP, this reduces the chances of it hitting any targets.
     
    Last edited: Jul 28, 2016
  12. You Talking To Me

    You Talking To Me Terrarian

    this mod will not work for me