- Home /
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