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. Dismiss Notice

Question Reducing an item level?

Discussion in 'Scripting' started by WolfmanGT123, Jul 13, 2021.

  1. WolfmanGT123

    WolfmanGT123

    Joined:
    Jun 28, 2021
    Posts:
    13
    Right guys,

    Im working on a project, but a little in the dark on this one.

    What i am wanting to do is lower the level of an item depending on the item being used.

    For example:

    If i am using a level 1 pickaxe on a level 5 rock - it will take say 5 minutes to destroy
    If i am using a level 5 pickaxe on a level 1 rock - It will take 1 minute to destroy

    Along with minutes/seconds counting time to destruction
     
  2. RadRedPanda

    RadRedPanda

    Joined:
    May 9, 2018
    Posts:
    1,593
    What does this have to do with Physics?
     
    Bunny83 likes this.
  3. WolfmanGT123

    WolfmanGT123

    Joined:
    Jun 28, 2021
    Posts:
    13
    Im not sure where it should be located, but im asking for HELP, not attitude
     
  4. Papum20

    Papum20

    Joined:
    Feb 15, 2021
    Posts:
    10
    maybe you can use a public variable in the script attached to to the item, so you can change the variable (that for example could represent the level or the time needed to break the rock) either from script or from the editor, or you can use different tags for different levels and change the time needed in the script according to the tag.
     
  5. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,384
    Then get a better one and people might be inclined to help you for free.
     
    ZO5KmUG6R likes this.
  6. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,512
    Granted it isn't answering your question but a post with absolutely no physics related question should not be in the physics forum and asking this isn't attitude. A quick look would suggest general discussion or scripting etc.

    I'll move your post for you.
     
    Yoreki likes this.
  7. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,722
    Give each level of pickaxe a "mining strength".

    Whenever you mine, take away HP from the rock equal to the mining strength of the pickaxe. Stronger rocks have more HP. Stronger pickaxes do more damage.
     
  8. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,713
    All of this levels and times and rates and feeds and speeds and powers and stuff is "all just numbers."

    To get a feel for how it is done, I suggest a few possible paths, and there are many more:

    1. do some tutorials on RPG / gathering / survival games that have stats systems

    2. find your favorite game that has the mechanic you want, and go looking for people who have written wiki pages detailing all the stats and levels and times and whatnot (they definitely exist for ALL popular games)

    3. pick up a paper-and-pencil gaming book and look how they do things like combat. Combat is exactly the same as mining; you do something with an item that has stats, and that something is then destroyed. It's identical in process.
     
    Munchy2007 likes this.
  9. WolfmanGT123

    WolfmanGT123

    Joined:
    Jun 28, 2021
    Posts:
    13
    Thank you PraetorBlue,

    "Whenever you mine, take away HP from the rock equal to the mining strength of the pickaxe. Stronger rocks have more HP. Stronger pickaxes do more damage"

    Thats put me more in the picture and has given me ideas