Gw Temp

Menu

Tutorial - 'Shattered Samurai Battle System' by Adrian

An item about RPGMaker 2000 posted on

Blurb

Creating a battle system similiar to those found in the game, Shattered Samurai

Body



Step 1. Set-up
In this step, you will make an event for each monster (give each a name), the attack event (will be explained later on), your computer "helpers" events (anywhere on the map), an event for all the attack stuff (once again, will be explained later), a common event called anything like (did I hit?)
You have now completed step 1!

Step 1. Setting up your attack

In this step, you will have to create a lot of variables! Hero X, Hero Y, Monster* X, Monster* Y (replace * with the monsters number), and same with helpers. Also add attack, attack X, and attack Y In this tutorial, I am having 3 monsters, and two helpers. Here would be my variables list.

1. Hero X
2. Hero Y
3. Monster1 X
4. Monster1 Y
5. Monster2 X
6. Monster2 Y
7. Monster3 X
8. Monster3 Y
9. Helper1 X
10. Helper1Y
11. Helper2 X
12. Helper2Y
13. Attack
14. Attack X
15. Attack Y

In the event attack stuff, you will have to set each X and Y position of all the events except for the event you are in. This event will have to be parallel process. Keep the position the same, and have it not move. The event will also get it ready for the common event. Here is my code.
* is optional, > you have to do

>enter password to variable attack, wait until enter key is hit
>set variable Hero X, set to hero X coordanent relative to map
>set variable Hero Y, set to hero Y coordanent relative to map
>set variable Enemy1 X, set to event enemy1 X coordanent relative to map
>set variable Enemy1 Y, set to event enemy1 Y coordanent relative to map
>set variable Enemy2 X, set to event enemy1 X coordanent relative to map
>set variable Enemy2 Y, set to event enemy1 Y coordanent relative to map
>set variable Enemy3 X, set to event enemy1 X coordanent relative to map
>set variable Enemy3 Y, set to event enemy1 Y coordanent relative to map
>set variable Helper1 X, set to event helper1 X coordanent relative to map
>set variable Helper1 Y, set to event helper1 Y coordanent relative to map
>set variable Helper1 X, set to event helper1 X coordanent relative to map
>set variable Helper1 Y, set to event helper1 Y coordanent relative to map
>Fork options, hero is facing up
>>Change variable hero Y - 2
>>set variable Attack X, set to variable hero X
>>set variable Attack Y, set to variable hero Y
>>Call event, Did I hit?
>>Teleport event Attack by Variables, Hero X, X position, Hero Y, Y position
>Fork options, hero is facing right
>>Change variable hero X + 2
>>set variable Attack X, set to variable hero X
>>set variable Attack Y, set to variable hero Y
>>Call event, Did I hit?
>Fork options, hero is facing left
>>Change variable hero X - 2
>>set variable Attack X, set to variable hero X
>>set variable Attack Y, set to variable hero Y
>>Call event, Did I hit?
>Fork options, hero is facing down
>>Change variable hero Y + 2
>>set variable Attack X, set to variable hero X
>>set variable Attack Y, set to variable hero Y
>>Call event, Did I hit?

And that is all for step 2!

Step 1. Setting up the common event
YAY! Here is the hard part! In this event, you will have it check to see if you hit, and if you did, change some stuff, ect. Here is where the optional stuff comes in a lot! You will need to create a switch for each monster when they are dead, ie monster 1 dead, monster 2 dead, monster 3 dead, ect, a switch for attacking, and a variable for each monsters HP, ie monster 1 HP, monster 2 HP, Monster 3 HP, ect.
Code.
* Optional >Not optional

>Fork options, variable Attack X is the same as variable Monster1 X
>>Fork options, variable Attack Y is the same as variable Monster1 Y
>>>Fork options Monster 1 dead (off)
>>>>change switch attack, set on
>>>*move event (to make it look like you attacked)
>>>>Show battle animation, attack, over event attack
>>>>change variable, monster 1 HP - 1
>>>>change switch attack, set off
>>>>Fork options, variable monster 1 HP is 0 or less
>>>>>Change switch, monster 1 dead on
>Fork options, variable Attack X is the same as variable Monster2 X
>>Fork options, variable Attack Y is the same as variable Monster2 Y
>>>Fork options Monster 2 dead (off)
>>>>change switch attack, set on
>>>*move event (to make it look like you attacked)
>>>>Show battle animation, attack, over event attack
>>>>change variable, monster 2 HP - 1
>>>>Fork options, variable monster 2 HP is 0 or less
>>>>>Change switch, monster 2 dead on
>>>>change switch attack, set off
>Fork options, variable Attack X is the same as variable Monster3 X
>>Fork options, variable Attack Y is the same as variable Monster3 Y
>>>Fork options Monster 3 dead (off)
>>>>change switch attack, set on
>>>*move event (to make it look like you attacked)
>>>>Show battle animation, attack, over event attack
>>>>change variable, monster 3 HP - 1
>>>>Fork options, variable monster 3 HP is 0 or less
>>>>>Change switch, monster 3 dead on
>>>>change switch attack, set off

YAY! You got through a hard part!!! Wait until my next post, it will have enemy attacks!
Sorry it took so long, I've had a project that has been eating up on my free time. I hope to have the next part up in a day or two, but no promises. Oh, and btw, I'm using DMS, and you would need a CMS if you want more than one helper.

yes, it is long... if you use it, put me in the credits, ok?

PART 2 IS BELOW, IT HAS BEEN CONDENSED INTO ONE ARTICLE


Step 1. Set up
OK, you know those events you made for the enemy? Well, this is what we will be working in... First off, I would like to thank you for reading this, and now for the tutorial! OK, well anyway, we will be starting off with setting the enemies death. Remember last time, when I had you have the fork condition, if monster __ hp = 0 or less, chang switch, monster__ dead on? This is what will stop the enemies from attacking. Open the enemies event. In this, add a new page, and another new page. On the 2nd page, have it be set to the coresponding enemy dead switch to the event you are in. Add another page if you want an item drop system. Set all of the pages to parallel process. As a reminder, here are all of the switches/variables I have and will use in this part.

1. Hero X
2. Hero Y
3. Monster1 X
4. Monster1 Y
5. Monster2 X
6. Monster2 Y
7. Monster3 X
8. Monster3 Y
9. Helper1 X
10. Helper1Y
11. Helper2 X
12. Helper2Y
13. Attack
14. Attack X
15. Attack Y
16. Randomness
17. Hero HP

1. Monster 1 dead
2. Monster 2 dead
3. Monster 3 dead
4. Monster 1 Item got
5. Monster 2 Item got
6. Monster 3 Item got

Step 2. Set up the enemy death

If you are not adding an item drop system, make this event be blank. Either way, set the picture to blank.
OK, on that 2nd page, add this coding
(> means you have to add, and * means optional)

*Change variable, randomness set, 1-(however many possible choices)
*Fork conditions, randomness = 1
**Move event, this event, change GFX (your item)
**Change variable, Monster_X, this event, set to X position to map
**Change variable, Monster_Y, this event, set to Y position to map
**Change variable, Hero X, hero, set to X position to map
**Change variable, Hero Y, hero, set to Y position
**Fork conditions, Hero X = Monster _ X
***Fork conditions, Hero Y = Monster _ Y
****Add Item, _________+__
****Change switch, Monster _ Item got

Tra-dah! Do that to every monster event, and there you go! You will also have to add the coding for every item. I just demonstrated 1.

Now, on your third page, have it be set to a switch to the enemy event you are in, switch : Enemy__Item got, and parallel process. OK, now create a new event. In this, It will make the enemies come to life as you get on the map. Here is the code:

>Change variable, Monster 1 HP, __
>Change variable, Monster 2 HP, __
>Change variable, Monster 3 HP, __
>Change switch, Monster 1 dead, off
>Change switch, Monster 2 dead, off
>Change switch, Monster 3 dead, off
:clear timer

Step 3. Enemy attacks...
OK, right now, it would be boring to play. So, I am going to add enemy attacks to it! Here is how...
On the first page, have it be set to on touch (event, hero)
And now for the all famous coding!

*Show battle animation _______________ over hero
*Play sound effect
>Move event, turn direction, step forwarf, step foreward, ignore if can't be moved
>Chang variable, hero HP, (-)- __
>Fork options, hero HP (=)- 0 or less
>* Move event (death pose)
>>Game Over

Tra-dah again! Now so far, you should have this done

-You attacking, able to hit, able to kill enemies
-Enemies attacing you, able to hit you, able to kill you

Please note! It WILL NOT work unless you add some code, somewhere in your game that makes the hero HP more than 1 before an enemy attacks you!