Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

WEAPON UPRADING!

Discussion in 'Scripting' started by Ralph1388, Jul 25, 2015.

  1. Ralph1388

    Ralph1388

    Joined:
    Jul 25, 2015
    Posts:
    24
    Hi,
    I hope i can explain this as simple as possible. I am making a game which involves a plane as the main player, and i am currently on hold with my project since i am unable to implement an upgrading system where i can increase the damage/stats of that plane every time i have enough of that currency to upgrade. can anyone give me a simple push to keep going and help me with scripting it??

    P.S i am a self learning so no good background

    Thanks :)
     
  2. GroZZleR

    GroZZleR

    Joined:
    Feb 1, 2015
    Posts:
    3,201
    What aspect are you struggling with? What system(s) have you come up with to try to implement it?
     
  3. Ralph1388

    Ralph1388

    Joined:
    Jul 25, 2015
    Posts:
    24
    well thats the thing i dont know how and where to start.
     
  4. DonLoquacious

    DonLoquacious

    Joined:
    Feb 24, 2013
    Posts:
    1,667
    Nothing about this sounds like a "simple push" to me- you need to think up and attempt the execution of some method for accomplishing what it is you're after IMO, and then (when an effort has been made) I'm sure everyone here would be more than happy to help you out when you run into a problem. We can't make the project for you though- we have our own projects.

    If you're truly absolutely clueless as to any method of doing what you want, you have bigger problems than being "pushed". I'd recommend reading a C# book, watching any and all tutorials on Unity that you can find on the internet, and maybe writing a few simple demo projects.
     
    apparition likes this.
  5. Ralph1388

    Ralph1388

    Joined:
    Jul 25, 2015
    Posts:
    24
    might as well do that.. thought maybe i could get some help..
     
  6. apparition

    apparition

    Joined:
    Jan 11, 2012
    Posts:
    116
    One simple way you could go about this:
    Code (CSharp):
    1. public class Plane
    2. {
    3.   public int Level { get; set; }
    4.  
    5.   public float Damage
    6.   {
    7.     get
    8.     {
    9.       return Level * 1.2f;
    10.     }
    11.   }
    12.  
    13.   // Add other stats in a similar way...
    14. }
    You basically implement a formula for each stat that you want.

    But this is a very open-ended design problem. It's really up to you how you want to the stats to scale.
     
  7. gorbit99

    gorbit99

    Joined:
    Jul 14, 2015
    Posts:
    1,350
    Are you using C# or JS?
     
  8. DonLoquacious

    DonLoquacious

    Joined:
    Feb 24, 2013
    Posts:
    1,667
    I'm not trying to be mean-spirited or anything- I tried to make the response sound as far from "annoyed" as possible and yet it still sort of had that vibe to it despite my best efforts. I wasn't annoyed, I promise. However, there are literally over a hundred ways of doing what it is you want to do, and most of them are very very simple like "one week of programming experience stuff", which is why I'm unwilling to help you directly to do what it is that you want.

    I really do hope that you choose to stick with this and learn a programming language and make a fantastic game some day- I'm of the belief that the world can always use more good games. That said, even as a hobby, making games takes a bit of commitment to learning some things before you even start. It's just a part of the deal. Put in the effort and you'll be rewarded, I promise.
     
  9. Ralph1388

    Ralph1388

    Joined:
    Jul 25, 2015
    Posts:
    24
    well i am using c# to implement it... but JS seems easier to eye to understand more to me
     
  10. Ralph1388

    Ralph1388

    Joined:
    Jul 25, 2015
    Posts:
    24

    dont worry about it buddy thanks for the advise anyways :)
     
  11. Bradamante

    Bradamante

    Joined:
    Sep 27, 2012
    Posts:
    300
    The problem is that what you are describing is a very basic mechanic. There are a million ways to tackle this. As was already mentioned, I suggest reading a book on general C# coding (to get a feel for the language) and then to look at existing Unity code. To do so, look at the "Complete Projects" section of the Unity Asset store.

    You can also buy NGUI, since some of the included examples adress the problem you are describing. And I am sure other assets on the store do too. Also notice that there are Asset Store assets that solve the problem you are describing directly, i.e. they are providing some Inventory/Power-Up system - thus very likely eliminating most necessary effort required from you.
     
  12. Ralph1388

    Ralph1388

    Joined:
    Jul 25, 2015
    Posts:
    24
    Well thats where the feel of making money from your own sweat comes in tact! i want to do it all on my own even if it takes some effort and time :)
     
  13. Timelog

    Timelog

    Joined:
    Nov 22, 2014
    Posts:
    528
    Stick with C#, the documentation and available knowledge on the forums are way better for it. Also it is more directly the same C# as you might use on other projects, while the JS version Unity uses is a very, extremely, modified version of JS. You really can't even call it JS anymore...

    As for your problem, what do you have currently? What is your idea of getting the currency you need to upgrade weapons? How do you envision spending it? Will upgrades be automatic, or does the player have a choice what and when to upgrade?