Gw Temp

Menu

Tutorial - 'Fun with touch encounters' by SiliconHero

An item about RPGMaker 2000 posted on

Blurb

The tutorial may sound perverted, but it's really not! Shows how to do romancing SaGa stuff!

Body

Fun With Touch Encounters

Tutorial by: SiliconHero (siliconhero@skytowergames.net, or waltos_1999@yahoo.com)

Have you noticed that in some games (particularly those of the Romancing SaGa series), you can actually see the enemies around you? Some people prefer this style of encounter over the invisible random enemies that are present in most console RPGs. There is a method of getting this to work in RPG Maker 2000 games, and with some clever scripting, you, too, can make it happen.

1) First things first, you'll need to reserve some variables and switches. Set aside 6 variables and call them PlayerDir, PlayerX, PlayerY, EnemyDir, EnemyX, and EnemyY. These will be the variables used to check your player sprite's coordinates in relation to the enemy. Now, create two new switches and label them FirstStrikeChance and Surprised!. These will determine which one of you gets to start the battle.

2) Got that? Good. Now, we'll need to set up a "Surprise" condition in the Database, which will affect you and your enemy alike. Head into the database (press F8) and click on the "Conditions" tab. Create a new condition called Surprise, and give it the following specifications:

////////// CONDITION SETUP //////////

Classification: Combat Effect (since you'll only be using this condition during battle anyway)
How to Heal: After 999 turns, 100% Heal Probability (it really doesn't matter how high you set this; you can set it as low as 2, and it should still work.)
Priority: 100 (this will be more important than any other status condition that your character may have at the moment).
Action Limitation: Inside Battle (this will prevent the target from moving while this condition is in effect).

////////// END CONDITION SETUP //////////

When the Surprise condition is set, it will keep the side that is surprised from moving, giving the other side an opportunity to get a free hit.

3) Now, click on the "Monsters Party" tab and create a group of enemies. For the purpose of this tutorial, I'll be using the default party of three Slimes (from the RTP). This is the place where the "Surprise" condition will be triggered for a side that gets caught by surprise. Make sure you have four blank Battle Event pages to work with (click the "New Page" button three times if you just created the party.) When you're ready, you can start adding the event commands. The first page will happen once the enemy catches you from behind, and adds the Surprise condition to your party for one turn, which is removed after Turn 1 (event coding is on the third page). The second page will happen when you catch the enemy from behind, adding the Surprise condition to the enemy party. This condition is offset by the events on page 4, which cancels the Surprise condition for the enemy. Make sure to turn the FirstStrikeChance and Surprised! switches off after these events are triggered.

////////// BATTLE EVENT CODE //////////

Page 1 (Condition: your party gets caught by surprise)
Trigger: Switch[Surprised!] is ON, and Turn is at 0 // put 0's in both boxes, so that the event takes place before the battle actually starts.
Event Code:
<>Show Message: \>Your party was caught by surprise!\<\|\^
<>Change Condition: All Party Members, Add Condition, Surprise

Page 2 (Condition: the enemy gets caught by surprise)
Trigger: Switch[FirstStrikeChance] is on, and Turn is at 0
Event Code:
<>Show Message: \>Your party gets the initiative!\<\|\^
<>Change Enemy Condition: 1:Slime, Add Condition, Surprise
<>Change Enemy Condition: 2:Slime, Add Condition, Surprise
<>Change Enemy Condition: 3:Slime, Add Condition, Surprise
(Repeat the Change Enemy Condition code for every foe in the opposing party)

Page 3 (Condition: a turn has passed, and the enemy has taken its free hit)
Trigger: Switch[Surprised!] is ON, and Turn is at 1 // put a 0 in the first box, and a 1 in the second box, so that the event only happens on the first turn.
Event Code:
<>Change Condition: All Party Members, Remove Condition, Surprise
<>Change Switch: [Surprised!] OFF

Page 4 (Condition: a turn has passed, and your party has taken its free hit)
Trigger: Switch[FirstStrikeChance] is ON, and Turn is at 1
Event Code:
<>Change Enemy Condition: 1:Slime, Remove Condition, Surprise
<>Change Enemy Condition: 2:Slime, Remove Condition, Surprise
<>Change Enemy Condition: 3:Slime, Remove Condition, Surprise
(Repeat the Change Enemy Condition code for every foe in the opposing party)
<>Change Switch: [FirstStrikeChance] OFF

////////// END BATTLE EVENT CODE //////////

4) All right! You've got the battle events set up, so now it's time to deal with the actual enemy encounter. Close the database and create a new event on whatever map you'd like. Give the event any graphic you'd like (for mine, I'll use the default RTP Slime, which is located in Monster1.png), and give it a set path to follow. You can give it any path you want, but if you want this to work properly, you'll want to fix the event's direction. This will come in handy when we check their coordinates.

////////// EVENT SETUP //////////

Name: Slime (or whatever you feel comfortable with)
Graphic: (whatever you want)
Event Start Condition: On Touch (Event, Hero) (meaning that this event will trigger its commands when you touch the event, or the event touches you)
Position: Same Level as Hero
Animation Type: Without Stepping or Fixed Direction
Movement Speed: anything from 2x to 4x should be fine, depending on the type of enemy.
Movement Type: By Its Route
Movement Frequency: 8
Edit Route: This part is tricky. You'll want to place a "Face Random Direction" command at the beginning of each step, and then use a "Walk Forward" command to actually move the monster in that direction. If you want the enemy to move toward the hero, then add a "Normal Face Hero" command followed by a "Step Toward Hero" command. Mix up between the two sets of random-stepping and movement toward hero to give the enemy a mind of its own.

////////// END EVENT SETUP //////////

The enemy should be able to move on its own now, as if you had set its movement to Random Step. The reason that you should use this method of movement for your enemy is that with a "Common/Without Stepping" animation type, your enemy will turn and face you whenever you come in contact with it, meaning that you'll never be able to land surprise attacks on it! The Fixed Direction method ensures that the enemy will face the way it was moving when you approach. Now, it's time to add the event coding. We're going to set up our code to find out who gets the first attack, depending on the enemy's position and direction relative to you. A surprise attack condition will occur if both events are facing in the same direction, AND when one event is behind the other. In other words, if your event is behind the enemy's, then you'll get the first attack. If the enemy's event is behind yours, then the enemy's party gets the first strike. Any other condition will trigger a normal battle.

////////// EVENT CODE //////////

<>Change Variable: [PlayerDir] = Event: Hero: Beyond Facing
<>Change Variable: [PlayerX] = Event: Hero: X coordinate
<>Change Variable: [PlayerY] = Event: Hero: Y coordinate
<>Change Variable: [EnemyDir] = Event: This Event: Beyond Facing
<>Change Variable: [EnemyX] = Event: This Event: X coordinate
<>Change Variable: [EnemyY] = Event: This Event: Y coordinate

The Beyond Facing value will read the direction that the current event is facing. If the event is facing down, then the variable will be set to 2. If facing left, then the value will be 4. If facing right, then the value becomes 6, and if facing up, then the value will be set to 8. This will come in handy when checking our coordinates. For the next part, we'll be using nested Fork Conditions to compare directions and coordinates.

<>Fork Condition: If Variable[PlayerDir] = Variable[EnemyDir]
<>Fork Condition: If Variable[PlayerDir] = 2 // player is facing down
<>Fork Condition: If Variable[PlayerY] <= [EnemyY] // <= stands for "below", meaning that the first value is less than or equal to the second
<>Change Switch: [FirstStrikeChance] ON
<>
:ELSE Case
<>Change Switch: [Surprised!] ON
<>
:END Case
<>
:END Case
<>Fork Condition: If Variable[PlayerDir] = 4 // player is facing left
<>Fork Condition: If Variable[PlayerX] >= [EnemyX] // >= stands for "above", meaning that the first value is greater than or equal to the second
<>Change Switch: [FirstStrikeChance] ON
<>
:ELSE Case
<>Change Switch: [Surprised!] ON
<>
:END Case
<>
:END Case
<>Fork Condition: If Variable[PlayerDir] = 6 // player is facing right
<>Fork Condition: If Variable[PlayerX] <= [EnemyX]
<>Change Switch: [FirstStrikeChance] ON
<>
:ELSE Case
<>Change Switch: [Surprised!] ON
<>
:END Case
<>
:END Case
<>Fork Condition: If Variable[PlayerDir] = 8 // player is facing up
<>Fork Condition: If Variable[PlayerY] >= [EnemyY]
<>Change Switch: [FirstStrikeChance] ON
<>
:ELSE Case
<>Change Switch: [Surprised!] ON
<>
:END Case
<>
:END Case
<>
:END Case
<>Start Combat: Slimex3 (or the name of your enemy's party)

And finally, you should call the Start Combat code to trigger the battle. The first strike/surprise conditions will activate themselves as necessary when the battle begins.

////////// END EVENT CODE //////////

And BOOM! You've created a non-random enemy encounter. You should be able to copy-paste this code to place as many enemy events as you want. The only part of the event code that needs to be changed is the enemy party in the "Start Combat" function. You can even switch up the movement patterns of your enemies if you want them to behave differently as you approach.