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:
- 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.
- 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:
- 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.).
- 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).
- 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.
- 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.