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 Simon V · May 13, 2011 at 09:21 PM · levelexperience

Experience system for multiple skills

Hello,

I'm currently working on a demo for an RPG.

We will have a lot of skills (Could be up to 100). I have the basic functionality of 1 skill (checking if your exp is high enough to level, etc.)

Now, how do I go about implementing this for a lot of skills?

  • Just making a script for every skills that inherits from the base script?
  • Give the player the variables for every skill and call the other scripts to check for level-ups?
  • Something else?

What I have now is:

public class BaseSkills{

private int _baseLevel; //Level of the skill private int _curExp; //Current exp private int _expToLevel; //Total experience for the next level private int _levelModifier; //Determines the experience needed for the next level

public BaseSkills() { _baseLevel = 1; _expToLevel = 100; _levelModifier = 1; }

region Setters and Getters

/Setters and getters public int BaseLevel { get{ return _baseLevel; } set{ _baseLevel = value; } }

public int CurExp { get{ return _curExp;} set{ _curExp = value;} }

public int ExpToLevel { get{ return _expToLevel; } set{ _expToLevel = value; } }

public int LevelModifier { get{ return _levelModifier; } set{ _levelModifier = value; } } #endregion

private int CalculateExpToLevel() { #region Experience if-statements //These if-statements calculate how much //experience needs to be added to if (ExpToLevel < 1000) //ExpToLevel. { LevelModifier = 100; } if (ExpToLevel < 6000) { LevelModifier = 500; } if (ExpToLevel < 16000) { LevelModifier = 1000; } if (ExpToLevel < 36000) { LevelModifier = 2000; } if (ExpToLevel < 66000) { LevelModifier = 3000; } if (ExpToLevel < 106000) { LevelModifier = 4000; } if (ExpToLevel < 156000) { LevelModifier = 5000; } if (ExpToLevel < 256000) { LevelModifier = 10000; } if (ExpToLevel < 406000) { LevelModifier = 15000; } if (ExpToLevel < 606000) { LevelModifier = 20000; } #endregion

 return _expToLevel + _levelModifier;

}

public void LevelUp() { if (CurExp > ExpToLevel); BaseLevel++; }

}

Thanks in advance! Regards,

Simon.

P.S. I'm using C# in MonoDevelop.

Comment
Add comment · Show 3
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 GesterX · May 13, 2011 at 09:23 PM 0
Share

This question doesn't make sense to me? What are you asking. Posting script examples will help. I don't understand why "checking if your exp is high enough to level" is a skill...

avatar image Simon V · May 13, 2011 at 09:26 PM 0
Share

The "checking if your exp is high enough to level, etc." was a comment to "basic functionality". Look up in a $$anonymous$$ute to see my script.

avatar image Simon V · May 13, 2011 at 09:45 PM 0
Share

This script is the base for my other skills. they will inherit it from this script. The skills are things related to combat, but also things like $$anonymous$$ing, etc. I just need to know what the best way is to do the inheritance for a lot of skills.

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by GesterX · May 13, 2011 at 09:45 PM

I understand now. You basically answered your own question. I would have your skills inherit from the base skill class in order to use the common functions.

This seems like the most sensible way to do it.

Comment
Add comment · Show 2 · 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 Simon V · May 13, 2011 at 09:47 PM 0
Share

Ok, thank you. But do I need to do a new script for every single skill? Or is there a way to do this in one script?

avatar image GesterX · May 13, 2011 at 10:13 PM 0
Share

You could have scripts for generic skills (melee, spell, ranged, etc), Then you could dynamically change the variables that need to change (animation, particle effects, damage).

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

No one has followed this question yet.

Related Questions

Experience System 1 Answer

How can i make it give u a certain xp everytime u kill someone? 1 Answer

Using static members vs normal ones for exp,lvl, health ect.. 1 Answer

Xp Calculation Bar 1 Answer

Level Joining Issue 1 Answer


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