Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Mrbojangles · Feb 28, 2012 at 11:59 PM · fpsindie

FPS custom weapons & characters?

Okay here is my questions; firstly is it possible to have custom characters or weapons without unity pro? perhaps via scripting? My Team desires to work on a fps short game featuring the custom weapons, similar too army of two, also could that apply to characters as well?

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image syclamoth · Feb 29, 2012 at 12:29 AM 0
Share

Everything is possible via scripting. What do you mean, actually, by 'custom' weapons and characters? Do you mean player-created content?

avatar image Mrbojangles · Feb 29, 2012 at 01:00 AM 0
Share

Well, I am not sure about player created content, have yet to see that in any game that i have played. If it werent for the risk of glitches or viruses i would say why not. But i mean like attaching scopes, switching barrel types, stocks, ammo types, silencers etc. for example the silenced shotgun saw that on redjacket show. Then again...perhaps if some players had 3d skills and wanted to upload usable 3d models....perhaps another weapon type or something perhaps have a submission process...but otherwise i just meant switching barrels clips etc that change the weapon power, speed, distance Loudness etc.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by GoThXoRd · Feb 29, 2012 at 01:00 AM

Yes. no scripting required. If they are FBX files, you can just drag them from explorer into the Unity Project pane. Scripting will be required to make the weapons fire though.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by syclamoth · Feb 29, 2012 at 01:26 AM

I'm not sure where you got the idea that you would require unity Pro to do any of this stuff, but anyway...

If you want to be able to switch between various weapons, there are several well-known methods for doing this. Search this site, I'm sure you'll come up with at least 10 similar problems.

For customisable weapons, you could do someting like this

 [System.Serializable]
 public class Weapon
 {
     public float damage;
     public float recoil;
     public bool hasScope;
     public bool hasLamp;
     public bool hasProjectile;
     public GameObject projectilePrefab;
     public Renderer weaponRenderer;
 }

Make all the 'weaponRenderer' fields be renderers, children of the main camera, that are the correct objects in the correct positions.

Then, in your firing script, have somthing like this:

 public Weapon shotgun;
 public Weapon rifle;
 public Weapon bfg;

 Weapon curWeapon;

 void Awake()
 {
     curWeapon = shotgun;
 }

 void FireGun()
 {
     Target.takeDamage(curWeapon.damage);
     // do other things based on 'curWeapon.whatever'
 }

 void ChangeWeapon(Weapon nextGun)
 {
     curWeapon.weaponRenderer.enabled = false;
     curWeapon = nextGun;
     curWeapon.weaponRenderer.enabled = true;
 }

 void Update()
 {
     if(Input.GetKeyDown(KeyCode.Alpha1))
     {
         ChangeWeapon(shotgun);
     }
     if(Input.GetKeyDown(KeyCode.Alpha2))
     {
         ChangeWeapon(rifle);
     }
     if(Input.GetKeyDown(KeyCode.Alpha3))
     {
         ChangeWeapon(bfg);
     }
 }

Now, you can add as much functionality as you like to the 'Weapon' class, but this should get you started with basic weapon switching and customisation. Remember that you can modify the weapons at runtime- if your shotgun gets an addon that increases its damage and decreases its recoil, you can use

 shotgun.damage = shotgun.damage + damageModAmount;
 shotgun.recoil = shotgun.recoil + recoilModAmount;

Same for adding scopes etc:

 void RaiseScope(bool up)
 {
     if(!curWeapon.hasScope)
     {
         return;
     }
     Camera.main.fieldOfView = up?35:80;
 }

Remember to reset the scope before you change weapons! It's as simple as adding the line

 RaiseScope(false);

immediately before you switch guns.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

A node in a childnode? 1 Answer

Weapon switching using array 1 Answer

How to draw an arrow from fps contoller 1 Answer

Players unexpectedly change positions 0 Answers

How to make an ingame weapon/ammo shop 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges