Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Jermainek369 · May 09, 2016 at 09:51 AM · arrayrandomclassweapongenerator

How to create Random Stats matching the weapons?

using UnityEngine; using System.Collections;

public class RandomScript : MonoBehaviour {

 int weaponDamage;
 int weaponSpeed;

 string weaponName;

 public string weaponStrength;
 public string weaponType;
 public int weaponDmge;
 public int weaponSpd;
 public bool classSpecific;
 public string myClass;


 string[] weaponTypes = new string[35];
 string[] weaponStrengths = new string[16];
 string[] classTypes = new string[3];



 void Start ()
 {
     weaponTypes[0] = "Sword";
     weaponTypes [1] = "Mace";
     weaponTypes [2] = "Spear";
     weaponTypes [3] = "Dagger";
     weaponTypes [4] = "Short Bow";
     weaponTypes [5] = "Compisite Bow";
     weaponTypes [6] = "Long Bow";
     weaponTypes [7] = "Stick";
     weaponTypes [8] = "Wand";
     weaponTypes [9] = "Staff";
     weaponTypes [10] = "Long Sword";
     weaponTypes [11] = "Claymore";
     weaponTypes [12] = "Rapier";
     weaponTypes [13] = "Twin Blades";
     weaponTypes [14] = "GreatSword";
     weaponTypes [15] = "Shield";
     weaponTypes [16] = "Claw";
     weaponTypes [17] = "Katana";
     weaponTypes [18] = "Spear";
     weaponTypes [19] = "Scythe";
     weaponTypes [20] = "Axe";
     weaponTypes [21] = "Great Axe";
     weaponTypes [22] = "Hammer";
     weaponTypes [23] = "Falchion";
     weaponTypes [24] = "Caestus";
     weaponTypes [25] = "Halberds";
     weaponTypes [26] = "Whip";
     weaponTypes [27] = "Great Bow";
     weaponTypes [28] = "Crossbow";
     weaponTypes [29] = "Talisman";
     weaponTypes [30] = "Pike";


     weaponStrengths[0] = "Strong";
     weaponStrengths [1] = "";
     weaponStrengths [2] = "Weak";
     weaponStrengths [3] = "Ultra";
     weaponStrengths [4] = "Broken";
     weaponStrengths [5] = "Great";
     weaponStrengths [6] = "Awsome";
     weaponStrengths [7] = "Deamon";
     weaponStrengths [8] = "Vampyric";
     weaponStrengths [9] = "Holy";
     weaponStrengths [10] = "Magical";
     weaponStrengths [11] = "Cool";
     weaponStrengths [12] = "Fire";
     weaponStrengths [13] = "Ice";
     weaponStrengths [14] = "Lightning";
     weaponStrengths [15] = "Godly";


     classTypes[0] = "Warrior";
     classTypes [1] = "Wizard";
     classTypes [2] = "Hunter";




     GenerateWeaponClass ();

 }



 void Update ()
 {


 }

 void GenerateWeaponClass(){

     int strRnd = 1;
     int typeRnd = Random.Range (0, 31);
     weaponType = weaponTypes [typeRnd];
     
     int Rnd = 1;
     int trnd = Random.Range (0, 16);
     weaponStrength = weaponStrengths [trnd];

     int tDam;
     int tSpd;

     if (strRnd == 0) {
         tDam = Random.Range (50, 250);
         tSpd = Random.Range (50, 75);
     }



         

} }

This is what i have, so far i can generate a random weapon and saying how strong it is, but i also want to give it a strength stat and speed stat, as well as giving it a class eg: Wand for Wizard and Sword for Warrior and Hunter. I am not sure how to perform this however and later i want to give descriptions to the weapons as well.

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

0 Replies

· Add your reply
  • Sort: 

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Random texture changer (problem with array) 2 Answers

Is it possible to use a scriptable object with title and content in a randomized array, output to 2 text fields? 0 Answers

Multidimensional Arrays of Classes in Java 2 Answers

Adding a class with Generic Lists inside a Generic List 1 Answer

Level generation using a "tree" type structure, why when i add a cell i get an error argument out of range? 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