Need help in making an RPG game!

First, you can find the beta version of the game here: http://www25.brinkster.com/dam****nationhq/games/rpg.swf
Unfortunately, at the time of this writing the server is going through maintanance and will be available only about a day or two from now. However, as I write this, I’m uploading a later version to another server, the address is: http://www.angelfire.com/fl5/storage1/files/rpg.swf

Before telling what I need help with, I’ll explain a bit what to do in the game:
When the SWF is loaded, click on “New Game” (“Controls” doesn’t do anything), from the screen you see before you, you move with the arrow keys around. At this map, there’s a randomizer MovieClip that will randomize wether the player will encounter an enemy, how many enemies, and which enemies. So you’ll maybe need to walk around a bit before entering the battle screen. In the battle screen, you’ll see at the bottom of the page your battle panel, from that panel you can see details about your currently selected attack and buttons to select a new attack (“Attacks” and “Skills”). To attack an enemy, you click on the enemy figure on the screen and the selected attack will be executed on the selected enemy. That’s all you need to know for now.

Now here’s my problem:
You’ll notice quite easily that the enemies will not attack you back. That’s exactly my problem, I need help with making the enemies retal.

The way the enemies work is this:

  1. First we get two values at least from the mainstage, one is how many enemies the player will fight, and the other(s) is the kind of enemy/ies the player will fight (an array was defined at the beginning of the game for the enemies). The randomizer I mentioned earlier defines these variables.
  2. When enemies slots 2 and 3 on the battle screen load, they check wether the enemy amount number is equel or bigger than their own value. ie enemy2 will check wether enemnum is >= 2 and enemy3 will check >=3. If it’s true, the enemy MC’s will gotoAndStop to the frame label inside themselves corresponding to the randomized enemy type defined earlier for them (enemy1 will gotoAndStop without checking), on each frame label is a MC containing all the enemy animations, every such MC in each frame inside enemy# has the same instance name, which is “monster”. Note that the enemy MC’s (named enemy1, enemy2 and enemy3) are the same MC’s only with different instance names.

This is how the player attacks work:

  1. The player figure we see on the battle screen is a MC containing frames with different MC’s inside them (like the enemies), a frame labeled “normal” containing the corresponding animation, and frames labeled by names of attacks (ie “jab”, “swing” etc.).
  2. First we have the selected attack, when selecting an attack, a few variables are defined:
  • name of attack, which is identical to the corresponding frame label inside the player MC.
  • damage of attack. Calculated by the default attack damage (jab is 8, swing is 12 etc.), plus the player level, plus strength bonus (if available). For example, if level is 1, strength is 0 and selected attack is jab, the damage will be 9.
  • maximum chance of attack (will be explained).
  1. When an enemy button is clicked, we define a trgt variable that tells which enemy we are attacking. ie clicking on enemy2 will define trgt to enemy2. Then we tell the player MC to go to the frame labeled with the attack we selected earlier.
  2. When the attack animation is executed, we first define a random chance variable like this: chn = random(_root.chance); _root.chance is the variable we defined when we selected the attack. Then, we check whether the randomized chance number is <= than the player level plus 3, like this: if(chn <= _root.level+3){ we tell the targeted enemy, which is trgt to gotoAndPlay to his “hit” animation, otherwise we tell the status MC to show the string “Miss” (those are the red words popping in the middle, tweening upwards).

I hope I explained enough, I feel that the answer is near but I just can’t manage to find it.

Can anyone help me make the enemies retal?

Thank you in advance.

P.S.
If you’re getting the Angelfire warning “not allowed to link from other websites” or something, do one of the following:

  • Right click on the link and Save target As…
    Or
  • Copy the link, go to any Angelfire website and paste the link in the address bar.

what… no one can help me? :’( sniff sniff

God****it what is wrong with you people??? Is there really no one who can help me??? :scream:

well…basically you can do a million different things.
to start with, you can first set up all your enemies exactly like your player. then, just have a randomly picked attack be initiated when it is the enemy’s turn to attack.
then, once you have that enemy working, you can simply set up additional enemies with different animations and attacks.
one way to do this would be to create an ‘enemyFight’ object and attach it to instances of enemies. the ‘enemyFight’ object could have all it’s own methods and work the same for all of your enemy characters. you could set up each instance of an enemy with an array that lists it’s attack and defense properties. then the ‘enemyFight’ object would call on either a defensive or offensive method and the enemy would carry out whatever commands the ‘enemyFight’ object told it to.
the clips would have to be set up with the different animations for each attack and defend move you would like them to do. you could label the frames where these animations begin with something like ‘attack0’, ‘attack1’, ‘defend0’, ‘defend1’, etc.
as long as you accurately listed the attack and defend attributes of each different class of enemy it wouldn’t be hard to set up a versatile and highly effective enemy battle. the enemies could even be set to fight other enemies by creating a property that defines who the enemy is attacking.
as you move through this process, you will probably not want to have the enemies do everything at random. or you may want a higher probability of certain moves, or even have classes of enemies learn from previous battles. depending on how involved you want to get you could spend months on just setting up one class of enemy.
now, with all that said, good luck! but, if you need more help you can email me by going to my site. i think it would be fun to help you out with this game. if you wanted to do the animations of the fighting i could create a turn-based fighting system to help you out.
have a nice day,
jeremy

Actualy, my main problem is to, lets say, after the player attacks an enemy, a random variable will be set to tell which enemy will do the attack (1, 2 or 3), but it also has to recognize wether an enemy even exists! Like what if we have 2 enemies, and I kill enemy1 first? And then we also have to decide what kind of an attack the enemy will execute, but that’s an easier part. My main problem is with telling which enemies are alive, and randomly selecting which one of them will attack. I thought of doing it with Arrays somehow but I got messed up.

Do you have any suggestions?

How many times will I have to bump this until someone will help me??

if an enemy is classified as having 400 hit points and you hit him for 400 points of damage, wouldn’t you eliminate that clip? Upon battle, you could create an array of the enemies present. If the damage >= hitpoints, then remove name from array, remove clip and your randomization would still work.

We could brainstorm all day! Does this address your problem?

Well you are asking a lot really. Like sinfiniti said you could do a million things, because there are so many possibilities. I was thinking about creating a game, and actually I am designing some characters now. My advice is, take things very slowly and go step by step or you’ll find yourself in over your head.