Gw Temp

Menu

Tutorial - 'FF9 Duel system Part 1' by KISSDemon

An item about RPGMaker 2000 posted on

Blurb

A nice, long tutorial about adding an duel system (like the Zidane-Blank duel at the beginning of FF9) to your RPG.

Body

Those of you who have played the excellent Final Fantasy 9 will no doubt recall the duel at the beginning of the game, which takes place between Zidane and Blank. That particular duel is only for a play and so there are no energy bars displayed. In this tutorial, I'm going to show you how to create the said duel WITH energy bars so one person is felled by the end of the battle.

-- Setting up--
So first, you want your character sets which depict the each character who will take place in the duel, holding their sword in a battle-type stance. I'm not going into detail on this as this tutorial covers the technical aspect rather than the graphical. You should also set the map, and since we are following from a side view, you should design your map accordingly.
Now place two events about two squares apart from each other, one will the hero, while the other will be the enemy/opponent. Name the events accordingly and apply the graphics and so on... now leave them for a bit.

--The coding--
Now everything is set for you to begin coding. Place an event in the top-left corner of the screen and name it "Duel code". It should be set to parallel event. The first command should be a comment: <>SETUP DUEL
Next, create two variables, call one "Hero health" and the other "opponent health". Set both to 100.
<>Var: xxx: Hero health set, 100
<>Var: xxx: Opponent health set, 100

Create a loop, this will be the main loop of this event.
Everything here on should be placed WITHIN the loop, not out of it, unless you are told differently.
Enter a comment:
<>Comment: PLAYER CONTROLS
And now we add a code so the player control the character in the duel...:
<>Key input proc:xxx: Players commands
<>IF Players commands = 5
Move hero: right
(Animation for hero striking)
<>IF opponent blocking = OFF
<>Var:xxx: Player Health -10
ELSE (Animation for enemy blocking)
ELSE IF Player commands = 2
Switch: Player blocking = ON
END
END

There is the coding for the player attacking the enemy. Create a new page on the same event, check the switch box and change it to "Player blocking". Add the command: Wait 1 second and underneath that, turn the switch: Player blocking off. It should look like this:

Wait 1.0 sec
Switch: xxx: Player blocking OFF

It simply render the player unable to attack while they are blocking, and the block lasts a second before the player chooses their next attack.
Click OK for this event and create a second one next to it. Name it: Enemy AI.
Now this should be exactly the same as the one you just created for the player, but rather than having key input processes, you randomise the enemy's action with a variable. Let's call it: Enemy action.
<> Var: Enemy action: RND 1-2
Now in the IF events, change the varible to Enemy action.
Do this for each, so the code should look the same as the player event, but each action is chosen at random rather than by player actions. (Cause it's enemy controlled duh.) Finally, on the second page do what you did before with the "Wait" command, but the switch off that follows should be "Enemy blocks" rather than player. Also check the switch box and chnage that to "Enemy blocks." See the pattern? Both the enemy and the player are EXACTLY the same in every respect other than the player controls their character, while the computer controls the enemy. So you should just change everything to correspond with the enemy rather than the player, resulting in two different events which each control each of the characters in duel. You should now be able to have a full on duel.

Well that's it for now, in part two I'll talk about the health display, which will take considerably shorter time because it is an easier concept to grasp. If you've done CMS's before you should be able to do that part on your own, nevertheless I will write a part two to this... farewell for now.