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
1
Question by WesterlyCarrot9 · Mar 14, 2013 at 12:40 PM · c#javascriptclassrpgstatistics

Creation of RPG Class Stat Presets?

Hello. So i want to have about three different classes for my game. The usual ones like Warrior,Archer and Wizard. How exactly should i approach the creation of the stat presets?I mean what i want is when you enter the game you will have this "Create Character" button and when you press it three more buttons will appear, each one for each of the classes. And of course there should be three different stat presets for each button/class. For example:

Warrior(Strength:12,Vitality:12,Dexterity:10,Intelligence:8) Archer(Strength:10,Vitality:11,Dexterity:12,Intelligence:9)

Should i just create three simple scripts with the variables i want and attach them to the different buttons so that when the Warrior button is pressed, the Warrior script is enabled and then create a whole Statistics system for the game OR something simpler/harder?

Thanks!

Comment
Add comment
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

1 Reply

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

Answer by Landern · Mar 14, 2013 at 01:31 PM

You can break it up and type out generically the character stats and such.

 // RPGClass.cs
 public class RPGClass
 {
     /// Name of the class(warrior, etc)
     public string ClassName { get; set; }
     
     public int Strength { get; set; }
     public int Vitality { get; set; }
     public int Dexterity { get; set; }
     public int Intelligence { get; set; }
 }
 
 // Character.cs
 using UnityEngine;
 using System.Collections.Generic;
 
 public class Character : MonoBehavior
 {
     private List<RPGClass> m_Classes;
     
     void Start()
     {
         m_Classes = new List<RPGClass>(); // could populate collection during instantiation if you wanted 
         m_Classes.Add(new RPGClass() { ClassName = "Warrior", Strength = 12, Vitality = 12, Dexterity = 10, Intelligence = 8 };
         m_Classes.Add(new RPGClass() { ClassName = "Archer", Strength = 10, Vitality = 11, Dexterity = 12, Intelligence = 9 };
     }
 }
Comment
Add comment · Show 4 · 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 WesterlyCarrot9 · Mar 14, 2013 at 06:20 PM 0
Share

Thanks for your answer. I actually did something myself but it's just some GUI and the textasset of Unity.Here it is:

var class01 = false; var asset : TextAsset; var textFieldString = "text field"; function OnGUI(){ if(GUI.Button(new Rect(80,10,200,40), "CAPTAIN")){ class01 = !class01; } if(class01){ GUI.Box(new Rect(80,100,200,200), asset.text); GUI.Button(new Rect(121, 250, 120, 30), "Create"); textFieldString = GUI.TextField (Rect (130, 120, 100, 30), textFieldString); } }

avatar image WesterlyCarrot9 · Mar 14, 2013 at 06:24 PM 0
Share

Actually how am i going to use those two scripts you wrote? Should i create the GUI buttons and apply them there? Apply them on the player perhaps?

avatar image Landern · Mar 14, 2013 at 06:25 PM 0
Share

You should do the UI as you normally would and access the list, do keep in $$anonymous$$d this was c#, but easy to port to unityscript

I was just giving an example of a setup.

avatar image WesterlyCarrot9 · Mar 14, 2013 at 06:32 PM 0
Share

Ok i see. Thanks a lot!

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

11 People are following this question.

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

Related Questions

Simplest way for some stat presets for RPG classes? 1 Answer

How do you make RPG class stat presets? 1 Answer

Character Attributes Question 1 Answer

help with creating a static Instance in javascript 2 Answers

How to Typecast JS Variables as C# Classes? 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