+ Reply to Thread
Page 1 of 79 1231151 ... LastLast
Results 1 to 10 of 788

Thread: PewPew : new GCombat

  1. #1
    No u Divran's Avatar
    Join Date
    Jul 2008
    Location
    Sweden
    Posts
    4,582

    Smile PewPew : new GCombat

    PewPew

    The Name
    I've renamed it from GCombat to PewPew. Bull's idea

    Why?
    I need to practice lua so that I can become better at it, but to do that I need ideas on what to make.
    I thought I'd make my own version of GCombat and make it better than the normal GCombat

    This is my dev thread. I'm posting it here because wm.com is better than facepunch.

    In this thread you people can post suggestions to my code (how I can make it better and neater) and suggestions for functions.

    What?
    How is this different from the normal GCombat?
    In the normal GCombat, each weapon and each bullet is its own entity. This means each of them add an extra 3 lua files to the server. I thought: Why?
    With my GCombat, each bullet uses only 1 lua file (Or you can put all bullets in the same lua file if you'd rather want that, although that might get a little messy ) and there is only 1 cannon (and only 1 bullet entity). I then change the model, sounds, material, color, trails, effects... just about everything on the bullet and the cannon depending on which weapon you choose.

    I have no idea on how this affects performance... it may even be suckier than the normal GCombat's way of doing it.. but I'm doing it this way anyway.

    The best thing about this is that it makes it ridiculously easy for people who are not lua pros to code their own bullets!

    Sample bullet code:
    Code:
    -- Basic Cannon
    
    local BULLET = {}
    
    -- General Information
    BULLET.Name = "Example"
    BULLET.Category = "Cannons" -- This is the weapon Category. This is used in the Weapons Menu to choose weapons more easily.
    BULLET.Author = "Divran"
    BULLET.Description = "Aim away from face."
    BULLET.AdminOnly = false
    BULLET.SuperAdminOnly = false
    
    -- Appearance
    BULLET.Model = "put your model here"
    BULLET.Material = nil -- if you want to change the material of the bullet, put the material here instead of "nil" Example: "phoenix_storms/gear"
    BULLET.Color = nil -- if you want to change the color of the bullet, put the color here instead of "nil" Example: Color(255,0,0)
    BULLET.Trail = nil -- if you want to set a trail on your turret, put a table with the necessary contents. Example: { StartSize = 40, EndSize = 0, Length = 4, Texture = "trails/laser.vmt", Color = Color( 255, 0, 0) }
    
    -- Effects / Sounds
    BULLET.FireSound = {"sound1", "sound2","sound3","and so on"} -- use as many sounds as you want
    BULLET.ExplosionSound = {"sound1", "sound2","sound3","and so on"}  -- use as many sounds as you want
    BULLET.FireEffect = "cannon_flare" -- find an effect in the effects folder
    BULLET.ExplosionEffect = "big_splosion" -- find an effect in the effects folder
    
    -- Movement
    BULLET.Speed = 50
    BULLET.PitchChange = 0.2
    BULLET.RecoilForce = 500
    BULLET.Spread = 0
    
    -- Damage
    BULLET.DamageType = "BlastDamage" -- Look in gcombat_damagecontrol.lua for available damage types
    BULLET.Damage = 250
    BULLET.Radius = 800
    BULLET.RangeDamageMul = 0.3 -- This is only used with "BlastDamage". It determines how much less damage it deals depending on the distance from the center of the blast.
    BULLET.NumberOfSlices = nil -- this is only used with "SliceDamage". It determines how many props in a line you want to deal damage to.
    BULLET.PlayerDamage = 150
    BULLET.PlayerDamageRadius = 300
    
    -- Reloading/Ammo
    BULLET.Reloadtime = 3.5
    BULLET.Ammo = 0 -- If you set this to 0, it will have infinite ammo
    BULLET.AmmoReloadtime = 0
    
    -- Custom Functions 
    -- (If you set the override var to true, the cannon/bullet will run these instead. Use these functions to do stuff which is not possible with the above variables)
    
    -- Wire Input
    BULLET.WireInputOverride = false
    function BULLET:WireInput( inputname, value )
    	-- Nothing
    end
    
    -- Fire (Is called before the cannon is about to fire)
    BULLET.FireOverride = false
    function BULLET:Fire( self )
    	-- Nothing
    end
    
    -- Initialize (Is called when the bullet initializes)
    BULLET.InitializeOverride = false
    function BULLET:InitializeFunc( self )   
    	-- Nothing
    end
    
    -- Think (Is called a lot of times :p)
    BULLET.ThinkOverride = false
    function BULLET:ThinkFunc( self )
    	-- Nothing
    end
    
    -- Explode (Is called when the bullet explodes) Note: this will not run if you override the think function (unless you call it from there as well)
    BULLET.ExplodeOverride = false
    function BULLET:Explode( self, trace )
    	-- Nothing
    end
    
    -- This is called when the bullet collides (Advanced users only. It only works if you first override initialize and change it to vphysics)
    BULLET.PhysicsCollideOverride = false
    function BULLET:PhysicsCollideFunc(CollisionData, PhysObj)
    	-- Nothing
    end
    
    -- Client side overrides:
    
    BULLET.CLInitializeOverride = false
    function BULLET:CLInitializeFunc()
    	-- Nothing
    end
    
    BULLET.CLThinkOverride = false
    function BULLET:CLThinkFunc()
    	-- Nothing
    end
    
    BULLET.CLDrawOverride = false
    function BULLET:CLDrawFunc()
    	-- Nothing
    end
    
    pewpew:AddBullet( BULLET )
    Isn't it simple? I will of course add more variables to that later on, such as material and color, but this is just for debugging right now.

    How?
    How do you code your own weapons?

    You can make anything cannon-like using only the variables, without even touching the function overrides at the bottom (leave them all on false).
    However, if you want to make "custom" weapons such as timed bombs, bouncy mines, sticky bombs, homing missiles, then you'd have to use the functions.
    There is an example file on the first post in this thread (it is also located in PewPew/lua/PewPewBullets/Example Bullet.txt) which explains all those variables that are not self-explanatory, and gives examples to those which need examples.

    A tip for you: To code, do this:
    1: Create your bullet's lua file. (Create it in PewPew/lua/PewPewBullets/)
    2: Copy/paste the Example Bullet code
    3: Change the variables to something which you THINK might be what you want.
    4: Launch GMod in windowed mode, create server or single player (Note: I haven't tested PewPew in single player yet ...)
    5: Spawn the weapon. Try it out. Not good enough?
    6: Alt-Tab out to Notepad/notepad ++ and edit your weapon's lua file some more.
    7: Instead of restarting the map, you can now simply type:
    Code:
    lua_run pewpew:LoadBullets()
    and PewPew will re-load your bullet.
    8: Now simply get out the PewPew tool and Update the cannon to apply the changes. Doing it this way, with the console command instead of changing map, saves a LOT of time.
    9: Repeat 6-8 until you like the feel of the weapon.
    10: Spawn one of my "Basic" weapons which resemble your weapon (if you weapon is a machinegun, spawn the Basic Machinegun, and so on)
    11: Spawn a prop, and increase its weight slightly so that it isn't killed instantly.
    12: Dupe the prop so that you have 2
    13: Point your weapon on one and my weapon on the other
    14: Fire them both at the same time.
    15: Check to make sure your weapon does not kill it WAY before mine does or too late. If it does, edit the damage/reload time/etc until it's good and balanced (2 seconds give or take should be close enough)

    Also, if you make a weapon, post it here and I might commit it if it's good enough

    When?
    It's done when it's done

    Pictures/Videos!
    TIP: Use fullscreen!




    Download
    You must use SVN to download this addon. I am NOT going to post it on Gmod.org. SVN Tutorial is in my signature.
    My SVN Link:
    Code:
    http://divranspack.googlecode.com/svn/trunk/%20divranspack/
    or direct link:
    http://divranspack.googlecode.com/svn/trunk/%20divranspack/PewPew/
    Milestones
    Here are some of my bigger achievements.
    - Ability to update weapons (Something very useful which GCombat doesn't have!)
    - Use Menu (Hold Use on a weapon to see info about it)
    - Weapons Menu (Makes it a lot easier to select weapons)
    - E2 Functions
    - Cores (Makes all entities in a contraption share health)
    - The Repair Tool
    - Numpad support (Something useful which GCombat doesn't have!)
    - Ability to update Numpads (This is something not a lot of entities can do!)
    - Over 30 weapons!
    - GCombat compability (All GCombat (Note: remove the GCombat damage control code first) and SBEP/SBMP weapons will (should!) now work with PewPew)
    - SB3/LS3/RD3 compability (All PewPew weapons can now use energy if you have the required addons and if you don't disable ToggleEnergyUsage).
    - The Weapons Menu is now built into the Q/C menu. (And is separate as well)
    - Admin Tool (Damage Log, Owner Display, Menu controls)
    - Prop Protection Damage check thingy
    - Weapons are now better sorted in a folder structure.
    - Death notices changed
    - PewPew Weapon Designer

    Admining
    Useful admin-only console commands:
    Code:
    Command				Argument	Default		Description
    sbox_maxpewpew			[Number]	6		Maximum amount of PewPew Cannons
    sbox_maxpewpew_cores		[Number]	6		Maximum amount of PewPew Cores
    sbox_maxpewpew_safezones	[Number]	2		Maximum amount of PewPew Safe Zones
    PewPew_ToggleDamage		1/0		1		Toggles all PewPew Damage
    PewPew_ToggleCoreDamageOnly	1/0		0		Toggles damage vs cores only
    PewPew_ToggleFiring		1/0		1		Toggles firing. With this disabled, no PewPew cannons can shoot
    PewPew_ToggleNumpads		1/0		1		Toggles numpads. With this disabled, no one can use the numpad inputs. You must use the wire inputs instead.
    PewPew_ToggleEnergyUsage	1/0		-		Toggles energy usage if you have the required addons installed (SB3). If you have the required addons, it defaults to 1, otherwise to 0.
    PewPew_DamageMul		[Number]	1		All damage is multiplied by this number
    PewPew_CoreDamageMul		[Number]	1		All damage vs cores is multiplied by this number
    PewPew_RepairToolHeal		[Number]	75		The repair rate of the repair tool
    PewPew_RepairToolHealCores	[Number]	200		The repair rate of the repair tool vs cores
    PewPew_ToggleDamageLogSending 	1/0             1          	Toggles damage log sending (ie, sending the data to clients). If your server is lagging a lot, try turning this off. Once you turn it on again, it will re-send the recent loggings to all players.
    PewPew_TogglePP			1/0		0		Toggles Prop Protection Damage (If this is enabled, weapons will only deal damage if the owner of the damaged entity has the owner of the weapon in their PP Friends list)
    PewPew_ToggleWeaponDesigner     1/0	        0	        Toggles the usage of the Weapon Designer. If disabled, no one can create their own weapons. Since the weapon designer can be abused, this is disabled by default.

    So! Tell me what you think.

    Thanks To
    Free Fall for helping me out with a lot of different things.
    Seth for helping me a couple of times.
    Everyone with cool ideas
    Everyone who made cool weapons
    Everyone who has this on their server
    Last edited by Divran; 09-11-2010 at 06:29 AM.
    SVN Tutorial
    My SVN:
    Code:
    http://divranspack.googlecode.com/svn/trunk/%20divranspack/
    Get dropbox and get 250 MB extra space: Dropbox

  2. #2
    Wire Sofaking Unsmart's Avatar
    Join Date
    Dec 2008
    Location
    Belgium OR BANland
    Posts
    1,965

    Default re: PewPew : new GCombat

    seems nice, especially the way the bullet shell is made, as its MUCH cleaner then the old gcombat ones.
    New server IP: 89.238.160.17:27018
    Hologram contraptions 1 Holo contraptions 2 EGP stuff Holo minigun Holo javelin rocket launcher
    Unsmart: I doubt the intelligence of some people.
    Drunkie: Nobody could have said that any better than Unsmart.

    Unsmart: Solece, I totally did your mom yesterday
    Solece: Who hasnt

    Divran: there are more retarded people than there are clever people in this world

  3. #3
    billywitchdoctor.com Schilcote's Avatar
    Join Date
    Jan 2009
    Location
    There.
    Posts
    2,006

    Default re: PewPew : new GCombat

    You know, I think B0B got the damage system for WireWars working, you could always hoist his code...


    [19:16:47]Client "rcdraco" spawned in server
    [19:17:10]rcdraco: hamburgertime
    [19:18:04]rcdraco was killed by worldspawn
    [19:21:50]Dropped "rcdraco" from server

  4. #4
    Wire Sofaking Ehmmett's Avatar
    Join Date
    Sep 2009
    Posts
    595

    Default re: PewPew : new GCombat

    I smell greatness.

  5. #5
    No u Divran's Avatar
    Join Date
    Jul 2008
    Location
    Sweden
    Posts
    4,582

    Default re: PewPew : new GCombat

    Quote Originally Posted by Schilcote View Post
    You know, I think B0B got the damage system for WireWars working, you could always hoist his code...
    We will see whose is the best (I bet on his)



    Oh and I've "borrowed" the models and sounds from GCX. I've sent a message to one of the creators of GCX to ask if I can use them, and until he answers I am going to use them... because they are so awesome.
    SVN Tutorial
    My SVN:
    Code:
    http://divranspack.googlecode.com/svn/trunk/%20divranspack/
    Get dropbox and get 250 MB extra space: Dropbox

  6. #6
    No u Divran's Avatar
    Join Date
    Jul 2008
    Location
    Sweden
    Posts
    4,582

    Default Re: PewPew : new GCombat

    Bump.

    I've uploaded a video to show what I have so far.
    Anyone who wants to have a go at making their own weapons can download it and go right ahead. I'm going to add more weapons myself this weekend and also take some more effects from GCX.
    Speaking of GCX, I've sent a message to another creator of GCombat, but I still haven't gotten a response.

    If you make a weapon, go ahead and post it here and I'll try it and see if it's worth commiting

    If you come up with ANY suggestion AT ALL, post it. If you are good at lua and see a way to improve my code if it's crappy, PLEASE post what and why and how.
    SVN Tutorial
    My SVN:
    Code:
    http://divranspack.googlecode.com/svn/trunk/%20divranspack/
    Get dropbox and get 250 MB extra space: Dropbox

  7. #7
    Wire Sofaking N00bDud3's Avatar
    Join Date
    Jul 2009
    Location
    Error: Unknown Location
    Posts
    1,252

    Default Re: PewPew : new GCombat

    This is just amazing. I never used GCombat because it used so many files, and was hard to add my own stuff to it. This will be over 9000x better.



  8. #8
    No u Divran's Avatar
    Join Date
    Jul 2008
    Location
    Sweden
    Posts
    4,582

    Default Re: PewPew : new GCombat

    Update. Added a to-do list on the main post so you guys know what to expect :3
    SVN Tutorial
    My SVN:
    Code:
    http://divranspack.googlecode.com/svn/trunk/%20divranspack/
    Get dropbox and get 250 MB extra space: Dropbox

  9. #9
    Wire Sofaking Unsmart's Avatar
    Join Date
    Dec 2008
    Location
    Belgium OR BANland
    Posts
    1,965

    Default Re: PewPew : new GCombat

    PewPew :3
    New server IP: 89.238.160.17:27018
    Hologram contraptions 1 Holo contraptions 2 EGP stuff Holo minigun Holo javelin rocket launcher
    Unsmart: I doubt the intelligence of some people.
    Drunkie: Nobody could have said that any better than Unsmart.

    Unsmart: Solece, I totally did your mom yesterday
    Solece: Who hasnt

    Divran: there are more retarded people than there are clever people in this world

  10. #10
    Wire Sofaking Ramishen's Avatar
    Join Date
    Jul 2007
    Location
    Where I live
    Posts
    419

    Default Re: PewPew : new GCombat

    I can never find a working copy of gcombat anymore, and it did use alot of files. I can't wait for this to be finished!
    Quote Originally Posted by Schilcote View Post
    Do what I say, then tell me what happens.

+ Reply to Thread
Page 1 of 79 1231151 ... LastLast

LinkBacks (?)

  1. 11-02-2010, 07:35 PM
  2. 07-11-2010, 10:44 PM
  3. 06-14-2010, 01:46 AM
  4. 06-13-2010, 05:14 PM
  5. 06-12-2010, 07:23 AM
  6. 06-12-2010, 03:08 AM
  7. 06-09-2010, 02:00 PM
  8. 06-08-2010, 11:37 PM
  9. 06-07-2010, 09:31 AM
  10. 03-12-2010, 07:37 AM
  11. 03-07-2010, 12:29 PM

Tags for this Thread

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