RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[Tutorial] Multi use guide on how to "event stuff"

0 Members and 1 Guest are viewing this topic.

*
Rep:
Level 88
Something something events
Project of the Month winner for December 2008
                             


 Hello everyone, this is a guide I decided I'd write on how to "Event stuff".
Personally I'm pro-event, though I don't knock scripting (since it works wonders), but for people who are
just starting to use RPG Maker, and more so using VX I wanted to offer them means of info on how to set up
a battle system that they can tailor and custom to thier needs and tastes. A lot is possible if you just
put your mind to it. (By the way, sorry if I mispell anything, I'm typing this up at 4am). Also, I feel by
eventing an ABS or CBS, it will help people understand more how the game-maker functions. It's more of a
learning process, then just copy and pasting some text into the script data base. Though this first guide
won't be a "How to make an AWSOME ABS/CBS!" Everything starts with the basics and that is what I'm going
to begin with.
EDIT: I decided to add some tutorials on how to event some non-combat related stuff (though it can be used in
combat if you are creative enough)

NOTE: If you are creating a new project, PLEASE make sure to visit this thread and fix the scripts other wise some things will not work correctly! http://rmrk.net/index.php/topic,25243.0.html



===Beginner===

I. Status Box Display
II. Refreshing HP (Up-To-Date Display)
III. Player/Enemy "Range"
IV. Input/Output System

===Novice===

V. Player/Enemy "Range" Pt.2 'Moving enemies'
VI. Magic use in an ABS system
VII. Creating a Boss AI

===Demo/Ending===

VIII.Demo Download/Lesson Materials Download (Note: You will either need to make your own materials or download the materials I provide. My lessons are based around my materials so if you make your own the X,Y will be different at certain points of the lesson.)



===I. Status Box Display===

Spoiler for:
Lesson Goal: Learn how to make a common event that can turn on and off the status display box.

Alright, this might sound simple, but I feel I should go over on how to display a status box on to the screen.
First off, we need a picture of what we are going to use for a status box, then we need to import it into the
data base. Luckly I went ahead and made one (well... just edited one from my current game project). Hopefully
everyone is an Elmer fan such as I, because thats who I used in my demo.


Now once that is in our data base we
want to open up the database and go to the "Common Events" tab. Once there, lets start by clicking on common
event 001 and we'll name it "Status Box". Right next to the common event naming box, there
should be a trigger choice selection. We'll set this to "Parallel" (This will be needed for the next lesson),
and then for the condition switch, let's use 0001 and name it "Trigger [On/Off]".
Go into the "List of Event Commands" box below, and double click, and click on "Condition Branch". Now, we
will set the condition to our Trigger On/Off switch, and have it on "ON". Before clicking ok, make sure you
uncheck the "Set handling when conditions do not apply" box. Now inside our branch, double click, go to the 2nd tab,
then select the "Show Picture" option. This will be picture 1, then set the picture graphic to the display box picture we
imported earlier. Now below our branch, double click then select the Condition Branch option again. Now make the
condition to if our switch was OFF. Inside that branch, double click then go to the 2nd tab. Now select "Erase
Picture" and set it to picture 1. Now we're all done! In your game all you have to do is make an event that flips the switch
0002 on and off and make sure you turn on 0001 so the parallel process can begin.(Other wise the window won't pop up!


===II. Refreshing HP (Up-To-Date Display)===


Spoiler for:
Lesson Goal: Learn how to build off our last lession and now be able to display current HP from the moment the player takes damage.

When most people think of ABS, they usually think of Zelda, and it's heart system. Using a heart system is much easier to event
then doing HP. Though, displaying HP really isn't that hard, it just tends to get really boring fast if your character has high
HP. What we are going is make a common event that will let us display the character's current HP up in the status box and it will
stay up to date even after the player takes damage. First, the one reason why eventing out a HP display is very boring is because
you need to make a image for every single number, 0 to how ever high your game goes. Again, I went ahead and made numbers 0-10 for
this lesson, just make sure you import it into your database. Also, make sure you import the "Slash" symbol into the data base
because now we want to display "Current HP" and "Max HP" and we don't want the player to think they have 1010 HP.

Go into thedatabase, go to common events. Now click on the common event we did last time. In the "On" condition branch, double click, 2nd
tab, show picture. Set this as picture 2, and set the graphic to the "Slash". Now for X,Y of the image usually you would
have to set a number and guess and check by running the game, but, from what I used in my demo the X,Y is (175,9). Now go into
the OFF condition branch and add a "Erase Picture" and set it to 2. That way if you turn off the display box, the slash will disappear
as well and not remain on the screen. Our next task is to make 2 variables. In the game, on the NPC event that turns on/off your
display box, at the very start, add 2 control variables. First variable we will call "Player HP(Max)" and we'll set it to "10". The
2nd variable we will name "Player HP(Current)" and we will set that equal to "Player HP(Max)". This will act as a 'Full Heal'
function for when ever the user turns on/off the display box.

 Open up the database and go to common events again. Now we will make
a new common event, and call it "HP Check". This is where it becomes boring, but not hard. Start a condition branch, and have the
condition be "If Player HP(Current) = 10". In that condition branch do a "Show Picture" and have this picture 4 then set the
picture graphic to the picture of 10 that we imported. X,Y for the image is (155,9). Now make another condition branch, and do the
same thing except have the condition be "9" instead of 10 and in the branch have it as the graphic 9. Do this again and again
till you reach 0. Once at 0, it should be the same as the others, except add "Game Over" into it (since most games don't
let you continue living at 0 HP). Now, go back to our first common event, and go to the ON condition branch and add
"Call Common Event: HP Check". This will make it so it will be constantly refreshing the HP display as long as the display is on.
In the OFF condition branch, add "Erase Picture" and set it to 4. We are almost done! Last thing that needs to be done is display
the "Max HP". In the ON condition branch, add "Show Picture" and set it to picture 3, and set the graphic to 10. The X,Y for the
picture will be (190,9). In the OFF condition branch, just add "Erase Picture" 3. Now you are done! To test it, simply make
an event that takes away "1" (or more) away from the "Player HP(Current)" variable. Understanding how do this this will enable
you to display a whole lot more then just HP. You can do the same for MP and even show pictures of the player's current STR in
a custom menu. Congrats, you finished lesson #2!



===III. Player/Enemy "Range"===

Spoiler for:
Lesson Goal: Learn how to build a common event that can be used to decide if the player is in or out of range.

Trying to think about how to do this, for most people thier head would just spin. "How on earth can you test out range?" well
chin up because it really is quite easy! For this lesson I will show you how to make a common event that will test to see
if the player is in melee range of the monster. First off, we'll need to make an event on the map, and name the event "Monster".
Now choose what ever graphic you would like for this bad guy. Once done, hit ok because we do not need to do anything to that
event. Lets open up our database and go to our good ol' common event tab. Find a blank one, and lets name it "Player/Monster X/Y".
This common event will only consist of 4 things, all we are gonna do is set 4 variables. double click in the common event box,
and go to Variable Control. First common event we're going to name "X Range". We'll set this variable equal to Player X (we will set the values to Player X, Player Y, Monster X, and MonsterY later in the tutorial, so just name them for now and we'll use them later)

2nd variable we'll name "Y Range" and we will set it equal to the Player's Y. Now below these 2 variable operations, we will
do two more. Now, take the X Range variable and MINUS the Monster X and the 4th operation, we will take Y Range variable and
minus the Monster Y. Now comes the fun part! Make a new common event and let's name it "In or out of range". This condition
branch will be used to check if the user is in or out of range and will give a message according to where the player is standing.
Our goal is to have the "in range" be at the sides of the monster and out of range be everywhere else. Our first condition branch
will be set to "If X Range = 0" (make sure you have the else handle unchecked), now inside this condition branch we are going to make
another condition branch set to "If Y Range = 1" and inside this condition branch we'll add a text message saying "You are in melee
range!" What we just did was make it so if the player is below the monster event, the game can test the range and it knows they are
close enough. Now below what we just did, we'll do the same thing, but this time the X Range condition will be -1 and Y Range
condition will be 0. This makes it so if the player is standing to the left they are in melee range. (don't forget to add a message
alerting the player they are in range!) Below that one we'll do the same thing again, but X Range condition will be 0 and Y Range
condition will be -1. This will test to see if the player is just above the monster. Our last one will be if X Range condition is
1 and Y Range condition is 0. This is the area just on the right of the monster.

Now we need to make a condition branch that will test if the user is out of range. This will be the time we will check the "else"
box, as if we don't we will get multiple messages saying "You are out of range." So for the first condition branch we will have
the condition set to "If X Range <= -2" in this condition we'll add the messages "You are out of range!" Now in the else part of
this condition branch we're going to make another condition branch. The condition will be set to "If X Range >= 2" and make sure
you check the 'else' box. Just like before, in this condition branch we'll add "You are out of range!" and in the else area we're
going to make another condition branch. Condition will be "If Y Range <= -2", like before, give them the message they are out of
range, and finally, in the else area we're going to make the last condition branch for this part (for this one you can leave the
else part unchecked) and set the condition to "If Y Range >= 2" (sorry if I sound like a broken record) and make sure you add
the "out of range!" message. Phew, hard part is done, but there are still 4 more condition branchs we'll need to do. The ones
we just did will give us a message if we are standing next to the monster or a square away, but what about if we are right next
to the monster but just in the upper right box? The as of now the player will not get any message if they are standing on the corner
boxs of the monster. We'll have to make a condition branch for each corner.

This will be easy, for the first condition branch set the condition to "If X Range = 1" and in that condition branch make another
one "If Y Range = 1" and give the message "You are out of range!". This covers the lower right box now for the other 3. Make
another condition branch with "If X Range = 1" and then a condition branch "If Y Range = -1". This covers the upper right box.
For our 3rd one, we'll have "If X Range = -1" then "If Y Range = 1". This will cover the lower left box, and finally, we'll
do our last one and we'll have "If X Range = -1" then "If Y Range = -1" and this will cover the upper left box. Now all that is
left is to actually use these common events! Go into your game, and on the map make tiles that are surrounding the monster that
are player touch. For the event they should look something like this:



This is where we set the variable numbers for Player X, Player Y, Monster X, Monster Y. We do this on the event we step on because we want up to date info on where the player is vs where the monster is. (Though this can lead to lag if not used carefully. I will explain in a later lesson on how to make a enemy/player range event that can keep you lag free) You can set these variables like so:



And then your test map should look something like this:



Now start your game and test it out! If you did everything like you should, then everything should work out just fine. Congrats
you finished Lesson #3.


===IV. Input/Output System===

Spoiler for:
  This type of event system can be used in many ways, and it's really flexible you just have to
have some creativity with what you do with it. The way I'll be teaching it is as a storage
system but you can use it for almost anything. In my game Wings of Eternia, I use it for my
attachment system.
 
To get started, first lets make an item that we plan on storing. We'll make it simple,
and for this example we'll use a potion. Next make an npc that you want to have as the
storage person. Now give him a message that will ask the user if they would like to store or
withdraw their potion. Use the show Choices option and make the two options (and a cancel if
you wish). For the sake of the lesson, I will only go into storing and withdrawing by ones
since 5 and 10 are the same process. In the "Store" option, we'll make a condition branch
that will check if the play even has a potion. (Don't want them to store something they
don't have) This can be done by using the Condition Branch option and going to the last tab
where you will find the item option, but make sure you check the box at the bottom for if
the condition doesn't match. If the condition is true, then we will make a variable, name it
potion and add +1 to it, then make sure to remove the potion from their inventory. If the
condition is false then give them a message saying they don't have any potions to store.
 
Now the withdraw is pretty much the same thing but in reverse. This time we'll make a
condition branch checking if that potion variable is equal to or greater then 1. If it's
true then you add one potion in their inventory and subtract 1 from the potion variable, and
if it's false give the player the message that they don't have any potions stored. That is
all there is to it. You can easily customize this input output system to something much
more then just storage. Like maybe once the player finds 5 fire crystal shards their
strength goes up, or the player must find gems to stick into a statue to continue into a
maze.

From here on out, I will be explaining things with the mind set as if you know where to find the all the event options. By now you should have the hang of eventing in RMVX and should be used to the functions

===V. Player/Enemy "Range" Pt.2 'Moving enemies'===

Spoiler for:
Lesson Goal:  Learn how to make a range common event for moving enemies all while keeping your map clean and lag free. Also will
introduce the concept of ranged weapons for an ABS.

Alright, I know I've been putting this off but it's time for me to post this tut on a lag free player/enemy range check, and in this tut I will be introducing the concept of ranged weapons. (Setting it up, if you want to use it then you must continue with it your self). So let's begin! First we're going to make a common event and lets name it "Range Weapon" This will surprisingly be quick if you kept the code we did in the last range tut. In my example, I'll be showing how to make a "Line-of-Sight" range weapon.

Start by making a condition branch and the condition will be "If the player is facing down" Now this is going to be a small bump of branchs with in a branch. Start off with the condition branch with "If Range X is = 0" This will check to see if the player is with in the same line as the monster. Inside that branch we will make another condition branch checking to see "If Range Y = -4" and make sure to check the "Else" box. The range weapon has a range of 4 squares. If the condition is true, then add the animation on the monster NPC to show that it got hit, then make sure to add a delay (Your choice, 60 frames is decent) so that the player can't hold the range button (will talk about button configuration later in this tut) and have no delay in ranged attacks. Now in the "Else" section of this branch you will make another condition branch, with Else checked, and the condition will be "If Range Y = -3" Repeat the above and continue doing the branchs untill you have it looking like this (You do not need to check Else on the "If Range Y = -1" branch) :



If you got that down, the rest is just the same except you have to mod the Range X and Range Y condition to the correct facing (So the player can't shoot backwards!) Here are the facing and the numbers used for the X and Y:

Down- (X = 0)(Y = -4, -3, -2, -1)
Right- (Y = 0)(X = -4, -3, -2, -1)
Up- (X = 0)(Y = 4, 3, 2, 1)
Left- (Y = 0)(X = 4, 3, 2, 1)

Once you have all the branchs done, make another condition branch but for this one, name it "Player/Monster X/Y" Remember that very first condition branch we made? It's exactly like that except this time, at the very start of the condition branch we are adding what we had in the events in the last tut in there because with this range method, it doesn't not use events placed on maps (To avoid lag). Which should look like:



Now go back to our "Range Weapon" condition branch and at the very begining add "Call Common Event" and call the "Player/Monster X/Y".  We're almost done! Now we just need to configure the buttons. Make a new common event and name it "Button Configure" and set it to parallel process, and make a new switch and name it what ever you want (Recommended is "Ranged [On/Off]") as with this switch, you can turn it off when the player has a stat effect on or something that restricts ranged attacks (Another tut, another time~  :P I'll explain stat effects in an ABS system) Make a condition branch and set the condition to "The Z button is being pressed" (Note: You can set it to any button you want, this is the button the player will need to press in order to use a ranged attack (Default set up Z button is D on the keyboard but you can change it by pressing F1 in test play)) Now, what I did was I wanted to make it so the player had to have a ranged weapon equipped. So I made a weapon called "Rock" in the database. Now in our condition branch, check the "Else" box, and make the condition "If [Character you are using] has rock equipped" If true, then call common event "Range Weapon", in the else make a message telling the player they need a range weapon equipped. The common event should look like this:



All finished! If you did everything correctly, when you run your game everything should run just fine. Now a few notes, if you wanted to add a damage system, the branch area where we added the animation and delay, that's where you would put any "Monster HP - 1" variable changes. Also keep in mind this is a VERY basic ranged weapon event. If you wanted to get more advanced then you will have to continue yourself, as I just provided a base example to assist the new eventers. Now if you wanted to get fancy, and you wanted a "Ring" damage effect and not a Line of Sight (Say, if you threw a Chakram) then you would have to do multiple Range X = 1, Range Y = -1 and then another X check inside that condition branch followed by the Y. You would have to form a loop with the right numbers.


===VI. Magic use in an ABS system===

Lesson goal: Will learn how to make a magic hotkey equip system, part 2 will be the tut on how to event magic use with the hot key

Spoiler for:
Alright! This lesson is actually pretty quick and simple. First you'll need down save these two icon images and import them into your picture folder.


Now open up your database and it's time to make a new condition branch. This will be used to display which spell is currently equipped. It should look something like this:



Now note, when the player learns magic, and you turn on the magic display switch to start the parallel process, make sure you turn on either Fire switch or the Heal switch. Not both! and make sure at least one is on. Other wise this will not work. I always add that extra 1 frame wait to avoid lag.

Next step, we'll want to configure out buttons. I would recommend doing the same as I did:


This can be done by starting a test play and then hitting F1.

Now we'll want to set up the equipping magic common event. So make a new common event and it should look something like this:

Make sure you do the "Else" option on the Fire switch, and don't place the healing condition part right below the fire otherwise it will finish with the fire part and then continue down the line and start the healing part of the condition branch. (don't know how to explain this better) Also make sure you put that 20 frame wait in other wise the swapping of magic will become difficult to do.

Now comes the last part. Make our 3rd and final common event! This part should look something like this:


Now I'll explain what is happening in this condition branch starting from line 10 (after the Fire Equipped switch == ON)
Here we are making a "box" around the monster. If the player is in this box then they are in range to cast magic. On line 15, we are checking to see if Elmer has enough MP to cast the spell. If he does and is in range, then the spell will go off and consume 1 MP. We will also add a 20 frame wait here as if you don't the spell will go off multiple times and the player will be out of MP before they know it. If Elmer doesn't have enough MP, then the buzzer will sound.
Below this are the rest of the "else" parts of the X/Y checking branchs. If the player is not in range then the buzzer will sound. (If you do this for a real game I suggest not using a buzzer SFX. Just take it out :x )
Now if Fire Equipped switch is not on, then it will check if Healing Equipped switch is on. If it is, and Elmer has enough MP then the healing animation will go off. If Elmer lacks the MP, then the buzzer will sound.

And there you have it~ A simple yet nice looking magic system where you can have a hotkey to cast magic and a hotkey to change what spell you want to use. Now remember, this is a very basic outline of a magic system for a ABS. If you wanted to get fancy you could add better character animations by changing the sprite  while casting. If you added more spells you could easily just add an "else" branch on the healing part (like you did with the fire and added the healing part in) and continue down the line.


===VII. Creating a Boss AI===

Lesson goal: Will cover on how to making a boss AI for an ABS that will be more then just running aimlessly around the map.


===VIII. Demo Download===

I'm putting up a demo that displays everything I tought so far in this tutorial. If you get stuck, I recommend looking at the
demo so you can see how I did it. Which you can download here: http://www.megaupload.com/?d=12T9QQXW

Lesson Materials Download: http://www.megaupload.com/?d=5UHZ3FHM

===Screenshots===
Spoiler for:





===Ending Comments===

Well, this really isn't the end, I plan on making more tutorials and adding them in here so that my tutorials will eventually lead
up to making a ABS or CBS. Hopefully people find these guides of use and I hope I was good at explaining the lessons (I've
never posted/made a tutorial before o_o; this is my first). Also, my way is not the absolute way of doing things. There are many
ways to do things in RM, I just would like to provide my way of doing things to help others.
« Last Edit: February 19, 2009, 10:46:34 PM by HowlingWinds »

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Great tutorial HowlingWinds. Very nice job!

********
Shadow Knight
Rep:
Level 91
Ruin that brick wall!
Project of the Month winner for October 2008
Great job, HowlingWinds! ^_^
It wouldn't hurt to add more image references to keep the readers on track though.
Be kind, everyone you meet is fighting a hard battle.

*
Rep:
Level 88
Something something events
Project of the Month winner for December 2008
Great job, HowlingWinds! ^_^
It wouldn't hurt to add more image references to keep the readers on track though.
I should probably do that lol. I'll make sure to go back and do that when I have the next tutorial ready

*
Rep:
Level 88
Something something events
Project of the Month winner for December 2008
New tutorial added: V. Player/Enemy "Range" Pt.2 'Moving enemies'
and by request of

It wouldn't hurt to add more image references to keep the readers on track though.

There are pictures showing how things should look so the learner can use as reference without having to download the demo. Pictures haven't been added to the older tuts.

Updating demo link with a new demo having the ranged weapon example in it. I also am splitting the tuts up in "Difficulties"

EDIT: Demo link updated
« Last Edit: December 21, 2008, 08:43:53 AM by HowlingWinds »

*
Rep:
Level 88
Something something events
Project of the Month winner for December 2008
New tutorial has been added VI. Magic use in an ABS system which explains how to event a magic hotkey system while also creating a magic equip swap key.

I'll be updating lesson materials and demo download soon.

EDIT: Updated
« Last Edit: February 19, 2009, 10:47:06 PM by HowlingWinds »