Hello!
I'm trying to make an text based RPG game using Visual C#
I have so far not found any good articles on the subject I'm looking for so I'm asking for help here,
I'm have made a combat code for my game and all but I'm having trouble with the generation of monsters and I would like either some help on how to do it OR if you know of an good article about such I would be greatfull for a link;)
in my Monster class I have declared all the variables like HP, Attack, AC(Armor Class/Defence) etc.
before combat starts I set the int "nummberOfEnemies" to the nummber of opponents I want the player to face in the encounter.
and in the combat class I tried somthing like this:
Monster[] monsters;
monsters = new Monster[nummberOfEnemies];
And then I made this code:
for (int index = 0; index < nummberOfEnemies; index++)
{
monsters[index].monsterAC = 16;
Followed by a declearation of stats, like setting the AC to 16.
I thougth this would do the following:
it will do the for loop once for every monster,
and set all the monsters stats to the values they should have.
I got two problems with this:
1. Every monster will be exactly the same monster.
2. the program crashes when reading the last Line of code I posted, saying it's Out of range,
the value of Index is then 0, and I can't understand why this is happening since an array starts at 0?
this is when I test with nummberOfEnemies = 1; so it should loop once and then exit the loop.
atleast thats what I thougth, I was badly mistaken I realize:)
so do anyone have any hints or articles they can recommend?
below here is a short description of how I want to end up inn the end and I realize that they way I now tried to make it work will not give me the flexibility I want.
I want to be able to call for random encounters or premade encounters,
the premade ones is fine, I can make them work, atleast the monster generator part:)
the random ones I want to create a number of enemies equal to the nummberOfEnemies variable,
and I want them to have different stats depending on their type and such.
Also I want the types that are chosen to be from monsters defined as native to the players current area.
so that if hes in the aquatic area he whont meet a random fire elemental :P
as for the stats I have created a list of all stats for all the monsters inn my game and how they vary,
I have no idea how to applay this into the random generator though.
I realize that my "simple" text to give an idea of what I want to create is getting way to huge so I'm going to stop myself now and say:
thank you for your time:)