So I should put my objects into an array and draw them that way?
I don't know if this is relevant, but I already made a program for a tiered loot table, only that uses a big bunch of strings. I'm trying to merge this class idea with that table. So yeah, I need to get this to work with the following code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
bool loopAgain = true;
int lootLevel = 1, loot, rollResult, rollChange = 3;
int counter = 1;
while(loopAgain)
{
rollResult = rollDie();
cout << "Roll " << counter << ": " << rollResult << ".\n";
if(lootLevel == 3 && chooseJob == 2) {
if(rollResult >= 2 && rollResult <= rollChange) {
cout << "Loot Tier: " << lootLevel << ".\n\n";
break;
} else if((rollResult > rollChange && rollResult < 7) || rollResult == 1) {
lootLevel++;
}
} else if(rollResult >= 1 && rollResult <= rollChange) {
cout << "Loot Tier: " << lootLevel << ".\n\n";
break;
} else if(rollResult > rollChange && rollResult < 7) {
lootLevel++;
}
if(lootLevel == 4) {
cout << "Loot Tier: " << lootLevel << ".\n\n";
break;
}
rollChange++;
counter++;
}
|
This basically translates to (using a 1-6 die):
Roll 1: 1-3 gets Tier 1, 4-6 move up a tier
Roll 2: 1-4 gets Tier 2, 5-6 move up a tier
Roll 3: 1-5 gets Tier 3, 6-6 gets Tier 4 (top)
IF PLAYER IS A ROGUE
Roll 3: 2-5 gets Tier 3, 1or6 gets Tier 4 (top)
The output of that gives a Tier level, then I just have a rand function which chooses an item form that tier. That brings us to this problem, instead if getting a random string after that, I want a random object from the tier. The array idea will still work, right?