Search Unity

  1. Engage, network and learn at Unite Austin 2017, Oct 3 - 5. Get your ticket today!
    Dismiss Notice
  2. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  3. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice
  4. Unity 2017.1 is now released.
    Dismiss Notice
  5. Unity 2017.2 beta is now available for download.
    Dismiss Notice

Energy Based Objects - Weapon scripts

Discussion in 'Assets and Asset Store' started by GibTreaty, Apr 29, 2012.

?

How much do you think it is worth?

  1. $5

    11 vote(s)
    52.4%
  2. $10

    7 vote(s)
    33.3%
  3. $20

    1 vote(s)
    4.8%
  4. $50

    2 vote(s)
    9.5%
  5. $100

    0 vote(s)
    0.0%
Multiple votes are allowed.
  1. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    769
    $DisplayWeapons.PNG
    Quickly create non-energy and energy based weapons with these easy to use scripts. Make machine guns, laser weapons, rocket launchers, anything you can think of! Contains a weapon reel scene with seven weapons as an example of how you can take advantage of this package.

    Asset Store
    Website
    Online Docs
    Weapon Reel Webplayer

    Shooting Scripts :
    Weapon scripts are based on the ObjectShootingPoint component that controls shooting and loading time for your weapons and calls events when they happen.

    ObjectShootingPoint
    •ObjectRaycastTurret
    •ObjectPusher
    •^ObjectSpawnerPusher
     
    Last edited: Jun 25, 2014
  2. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    769
    I plan on submitting this to the asset store once I've finished cleaning it up and adding some doxygen-generated documentation. Also I'll need to add some extra documentation that doxygen can't generate, like messages sent with SendMessage.
     
  3. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    769
    Updated the Object Shooting Testbed. You can play with the settings of each weapon and their energy containers. This will serve as a sort of interactive documentation which I'm hoping will be enough to understand how to use these few scripts once I've put them on the asset store.
     
  4. hOss

    hOss

    Joined:
    Nov 1, 2007
    Posts:
    3
    This looks very promising! Can't wait to see it released!

    One question: Are you planning to have any type of targeting ability?

    -Patrick
     
  5. HeadHunter

    HeadHunter

    Joined:
    Dec 17, 2011
    Posts:
    53
    Awasome work) Looks wery cool.
     
  6. Severance

    Severance

    Joined:
    Apr 20, 2012
    Posts:
    4
    I am still very new to Unity and game development and I don't know how to write code other than what I can learn from tutorial vids so I can appreciate the time, effort and frustration involved BUT when thinking about the costs involved with a project I have voted $10 simply because although this is an essential function it is still just a very small part of the overall project and taking into consideration that only small indie developers would purchase this (obviously the bigger commercial developers have their own coders).
    I did have a question regarding the scripts though: could this be used for a non energy based weapon such as a bow arrow? Or would the script have to be completely different? (If I sound like a noob it's because....I am actually a noob :) )
     
  7. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    769
    @hOss
    The main idea was for weapons that required Energy to be used which came from the game Global Agenda (the idea has been used in many games but that one inspired me the most). The scripts for shooting projectiles are there as an example of how you can set up the Energy, Energy User and Energy Weapon Switch (should be renamed) scripts.

    There is a TurretLookAt script for the turrets in the "More Energy Weapon Examples" example but it doesn't work correctly when the turret is upside-down. It is the only thing close to a targeting script. Everything else that is game-specific should be coded by the developer.

    @Severance
    Like I said to hOss, this is mainly for energy based weapons and objects (items too). If you get it just for the projectile shooting scripts then you need to know that 2 are for pushing rigidbodies and the other is for getting raycast info. For arrows you can do something similar to what I've done with the Orb Cannon on the FPS example. I've set it up so you can either Shoot a weapon or Load a weapon THEN shoot. Shooting a weapon takes energy and pushes the rigidbody right away. Loading a weapon will take energy but send a message that the weapon has been loaded so you can do with the projectile as you'd like before sending it on its way.

    Thanks for your comments and interest! I'll be working on it more within the next 3-4 days (I have other work so I work on these scripts when I can).
     
  8. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    769
    I've figured out how to pack the command reference that DoxyGen spits out, into a nice and neat chm file. Also, I've spotted a bug that I'm currently trying to fix. If the Object Spawner uses the Load function, runs out of energy, then tries to shoot, it leaves the projectile hanging without pushing it. It has to do with the "CanShoot" variable. After I fix this I want to make an in-game interactive tutorial showing how to set up your own weapon.

    Next thing to do after that should probably be to make some screenies and submit it to the asset store. I might try to get it onto the store BEFORE I make the tutorial because everything should be pretty easy to put together without one if you look at how I've set up the weapons and hierarchy.

    Edit:
    I think I've fixed the problem plus I had to change the EnergyWeaponSwitch script. It uses an ArrayList now instead of two booleans to tell whether the other scripts on its object should be disabled or enabled.

    Edit2:
    Also in fixing it I've made an example object that shows that it's possible to have a single object be a weapon instead of having to use a hierarchy of objects. It'll be a deactivated object in the Object Testbed example when it's released. Although you would still want to put the Object Shooting scripts on a parented object so you can move it to the end of the barrel of the gun, otherwise you'll be shooting from the center of the object.

    Edit3:
    Updated the Object Testbed to let you change the energy containers' "Energy Gain Delay". It's the time it takes before the energy script starts recharging its energy. Also sorry for suckifying the graphics too. I was using the Pro Trial and wanted to stop spoiling myself with the nice graphics until after I get Unity Pro for real (which I'm about 1/3 of the way saved up for it).

    Edit4:
    I think this project is in a good enough state that it can be released. Later I'll focus on packaging it up for the asset store but for now I'm taking a break.
     
    Last edited: May 5, 2012
  9. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    769
    Preparing this project for the Asset Store! I'll try to get it done before monday and have it submitted.

    Edit:
    I'm making good progress so far. I've got 2 out of 7 images done that are for the screenshots and will briefly show how these scripts work. After I've done those I've got to do the key images for the store and if I haven't forgot anything, that should be all that's left before I submit it! This is fun!

    Edit2:
    Screenies are finished.

    Edit3:
    Gotta love edits.
    The key images for the store are finished. All that's left to do is test it as if I had downloaded it from the Asset Store and imported it from a package. That's sure to introduce a few bugs.

    Edit4:
    Submitted and pending!
     
    Last edited: May 6, 2012
  10. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    769
  11. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    769
  12. pneill

    pneill

    Joined:
    Jan 21, 2007
    Posts:
    207
    Wow, I just came across this script. The demo looks amateurish, but the script is absolutely terrific. You would think making a nice little laser would be a trivial little task, but once you get into you'd be surprised about how complex it is. This script just saved me hours and hours of time plus I was impressed with the features the developer had thought of that I hadn't considered yet.

    Couple of questions:
    - What does the enable shooting property on the ray cast spawn script do?
    - What does the line renderer time property do?
    - Is there a way to parent the linerenderer to a game object?

    FWIW, I the docs could use some improvement. I'd see an explanation of all the scrips and what they're for along with a quick explanation of all the properties.

    For all you other SciFi game developers out there, check this script out. It's a hidden gem and at $10 the price can't be beat.
     
    Last edited: Jul 20, 2012
  13. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    769
    @pneill Thanks, I'm glad it helped you out. I was hoping to create a system of scripts that would help make weapons a lot quicker and it does it really well.

    The forum hasn't been notifying me of new posts like it used to. Plus I've changed my username from GIB3D to GibTreaty but hopefully that won't cause too much confusion. I haven't received any PM's which is disappointing.

    - Enable Shooting will decide whether the weapon script can shoot or not if "Shoot" is called. But it's there so you don't have to disable the whole script which may cause some problems.

    - Line Renderer Life or "Time" in Move Line Renderer Options? Life will destroy the line renderer in that many seconds. Time will be how fast the Line Renderer start and end points will move if they are told to move.

    - I hadn't thought to place something in to let you take over the LineRenderer that get's created. If you want, you can go to OnWeaponRaycastSpawn.cs and under line 36 where the object gets created, you can use SendMessage to send the object to another script on the weapon that can handle it.

    The Command Reference should have most of the properties explained. The ones that don't have a comment for them I figured would be obvious what they are just by looking at their variable name. I haven't explained some of the extra scripts either because there are so many of them. They weren't meant to be used outside of the examples but some of them can, like the On Weapon Raycast Spawn was an extra, but can be used outside of the project. A script like ColorByEnergy was super temporary and was whipped up especially for the one scene.
     
  14. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    769
    Just noticed a glitch when using this today. ObjectRaycastTurret used up double the energy, which means that ObjectPusher and ObjectSpawner are probably doing the same thing. I'll check it out tomorrow and upload the fix when I can.

    Edit:
    Looking at it today, it seems to only be effecting the ObjectRaycastTurret script.

    Edit2:
    Fixed and submitted to the Asset Store. I'm lowering the price down to $5 until I get some better models and other things added to this package. What time I add things I'm not sure because I have other things I'm working on at the moment.
     
    Last edited: Mar 11, 2013
  15. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    769
    I'm working on an update for this. It won't be an update for the scripts but it will add what I hope will be a better example of how to use this package. What I plan on doing is basically removing the current examples from the package (I'll leave the other example webplayers here though) and add a single level that will showcase what you can do. The weapons I have planned to make are a grenade, crossbow, laser weapon, bullet shooting weapon and a rocket launcher. There will be a stationary robot turret that is AI controlled and another enemy that will be placed at various points in the level. The programming involved isn't as much of a problem as the model making process. It takes a lot of time to get the models, uvs and textures looking just right. That means I don't know when this update will be 100% ready.

    Here is the progress so far...
    $SciFiGrenadeAndCrossbow.png

    What is shown there is the floor panel texture, rail (unfinished), grenade and crossbow (unfinished).
     
  16. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    769
    The progress on the new level has been halted as I'm working on other projects. But I have halted progress on those "other projects" to do a recode of this package. I found some glitches in the code that I hadn't seen before and instead of spending hours trying to fix it, I'm redoing the whole darn thing. I'm switching to using C# events rather than SendMessage (although I do use SendMessageUpwards a couple times, but I don't have a choice). There's also going to be a few new features such as loading multiple times rather than just loading once and firing once. Here's the demo I've made showing that off!

    Energy Based Objects Recode - Cannon

    The new version will be mainly recoded scripts and in place of the new level there will need to be a smaller, more focused, level so it doesn't take so much time to get this out. Also do expect to have some broken weapons if you upgrade your package. When this update does come out, I would recommend deleting the Energy Based Object scripts beforehand as some of the classes have been renamed and you'll have useless scripts floating around.
     
    Last edited: Oct 13, 2013
  17. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    769
    Still working on the update for this. I've made a weapon reel to show off some of the things you can do with this package once the update is out.

    Weapon Reel Webplayer

    It includes 4 different guns (and 3 variations of one of them)

    Multi-Missile Turret
    Gravity Gun
    GTB Machine Gun
    LCD-909 Laser Gun
    LCD-909 Laser Gun Insta Shot (slow but powerful)
    LCD-909 Laser Gun Phase Through (also slow and powerful but can shoot through objects)

    $DisplayWeapons.png
     
    Last edited: Jan 12, 2014
  18. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    769
    This package has been removed temporarily as of February 2nd, 2014

    Energy Based Objects will be updated soon though! I had submitted the package but it had been declined because I had included Ben3D's crate asset. It was free so I figured I could use it, but apparently I couldn't. Among the confusion, my asset was removed until I reupload a version with my own crate in it.

    I'll let you all know once the update is up!
     
  19. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    769
  20. GibTreaty

    GibTreaty

    Joined:
    Aug 25, 2010
    Posts:
    769
    A small update with some useful features...
    2.01 Release Notes -

    Changed

    • OnWeaponRaycastSpawn
      • maxObjectsToHit default is now 1

    Added

    • OnWeaponRaycastSpawn
      • OnCreateLineRenderer(LineRenderer lineRenderer) event so you can grab the LineRenderer when you shoot
    • AddLightOnCreateLineRenderer
      • Uses OnWeaponRaycastSpawn's OnCreateLineRenderer event to grab the newly created LineRenderer and attach a light to it.
    • CreateAndParentOnCreateLineRenderer
      • Instantiates (if you choose to) a specified GameObject and parents it to the LineRender that is returned from OnWeaponRaycastSpawn's OnCreateLineRenderer event.

    Fixes

    • MoveLineRenderer
      • The GameObject now moves along and rotates properly with the LineRenderer. It's position will now be between the start and end of the line.

    Get it on the Unity Asset Store or at my Website!