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.
Common Events Tutorial

0 Members and 1 Guest are viewing this topic.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Okay, this is part of my Event Commands Tutorial, but since I won't be able to finish that soon (studying), I decided I would post this part independently since it is pretty much self contained and it describes a useful feature of RMXP:

Here it is:

Spoiler for:
The Common Event Layout

A common event is an event which can apply to any map in the game. They can be found and edited in the database. They can be triggered in a few ways and can either be static (none), parallel process, or autorun. I am using the term static in this circumstance to mean that it runs once and only once for every time it is called. This does not mean it can only be called once: it can be called any number of times, but when it is called, it will not repeat. This kind of event must be called either from a) a local event, b) a battle event, c)  the use of a skill, d) the use of an item. Here is a look at the layout:

 

As you can see, I made big useless boxes around the stuff Enterbrain already boxed. Anyway:
Change Maximum: Misleading name. The maximum number of common events is 999 and you cannot change that. However, you can change how many common events you have stored in your data folder up to a max. of 999. So, in this file there are only two common events, but you can change how many there are.

Name: Label your common event with an appropriate name.

Trigger: What it is that causes this event to run. The static (none) option was described above. Paralell and autorun are the same as in local events and you can refer to that part if you do not know what it is. If you select either of those, you need to specify a switch which turns them on. It can be any switch you want.

List of Event Commands: As expected, this is where the event commands are placed.

Because of the way they function, common events can be used in many ways:
1)   Anything that you want to run constantly. For example, if you want to build a dynamic Day-Night System with events, you need the same event to run in every map, and so a common event will work perfectly.

2)   An event which is used often in separate events. You can call a common event within a local event by using the Call Common Event command. An example would be treasure chests. My treasure chest common event looks like this:


 
As you should know what every command in that does, I probably don’t need to tell you, but this event randomly decides what potion you get with 30% chance you get a single health potion, a 30% chance you get a single energy potion, a 10% chance you get two health potions, a 10% chance you get two energy potions, a 10% chance you get an improved health potion and a 10% chance you get an improved energy potion. Now, for every treasure all I have to do is assign a graphic, put it on direction fix, and use the Call Common Event command on this event. This is a pretty simple example, but useful.

3)   Custom Items. In the items tab of the database, you see an option called Common Event. Just select a common event from the pull-down menu. Every time the player uses the item, the common event you’ve chosen will run. Useful for a lot of items. Just as an example: books. Just set up the text of the book as a common event and have the book select that common event. You can also use this to limit the use of an item. For items in general, you can use either just once or always. If you wanted an item (for example, a Ring of Fireballs) which is destroyed after using it five times, you have to use a common event like this:

Control Variable: [001: Count Fireball Ring Usage]   + 1
Text: You have used the Ring of Fireballs \v[1] times.
Conditional Branch: Variable [Count Fireball Ring Usage] = 4
     Change Items: [Ring of Fireballs] – 1
     Text: The Ring of Fireballs is broken.
     Control Variable: [001: Count Fireball Ring Usage]   = 0
Branch END


4)   Custom Skills. Like the Items tab, the Skills tab also allows you to call a common event. This allows you to make custom skills. For example, if you wanted a skill which could create an item, like potions or something, you could just make a common event like this:

Change Items: [Potion] + 1

That probably didn’t deserve it’s own line, but you get the idea that youcan do a lot of things with skills that would be impossible without common events.

Common Events are very important for a lot of event systems. Use them or die!

As always, tell me what you find unclear so I can improve. Did I forget something? Do you need more details on a particular thing? Be sure to post your questions so I can make this tutorial as good as possible.
« Last Edit: April 01, 2007, 08:39:01 PM by modern algebra »

pokeball :)OfflineMale
********
Cheese
Rep:
Level 95
?
sweet. You make great tut's on these things.

*adds to index.
Watch out for: HaloOfTheSun

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Thanks. If you find anything wrong or incomplete be sure to tell me  :D

**
Rep: +0/-0Level 87
Sorry to be a bother, but do you mind posting the event when using a skill, it needs a item to work?

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Do you want the items to be used as reagents? i.e. they are consumed upon the use of the skill? Or do you just want it so that you need to have an item, but once you have it you keep it? Either one is really easy.
« Last Edit: April 02, 2007, 11:46:25 PM by modern algebra »

*****
Ancient Mummy
Rep:
Level 90
great great great and usefull tut !
Very handy with the chest to make them random, nice idea !
Thanks ;)

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Thanks Snailer. Comments like that warm this old, half machine heart  ;8

I don't really know why it is half-machine, but anything is possible with the internet. That is only part of my chest event. I also have it for gold and crafting items, etc... all with one common event and two variables.

Anyway, mumerus, you haven't responded so I will just post the event for both possible situations.

For both of these, you need to make a dummy skill. What this means is that you need to copy the skill you want to require an item into another slot in the skills tab of the Database (DB). All that you have to do is make it so that this skill can never be used, which means using the pull-down menu under Occasion and selecting Never in the dummy skill. If you want you can edit the description to say what it requires.

(1) Needing an item, but not using the item:

You need to make a common event set to paralell process called by any switch. Remember to turn that switch on before you get the skill. The common event needs to do two things: If you do not have the item, it needs to replace the real skill with the dummy skill. If you do have the item, it needs to replace the dummy skill with the real skill. Thus, we need a conditional branch and a change skills (see Event Commands Tutorial if you do not understand these concepts). The common event should look like this:


That's all.

(2) Using an item upon casting. (reagents)

You need to do the exact same thing as (1), so read it now if you have not already done so. Now, you need to make an additional event which is called by the real skill. What you need this to do is remove the item or items you need to cast the spell. SO, that means a Change Items command. Furthermore, paralell process events do not run during battle, so you will need to reproduce a simplified version of the first event within this one. I.E. if we run out of the reagent, we need to stop our player from using the skill, but we do not need to add the condition of relearning since there is no possibility of obtaining the reagent in the middle of battle. So, this event should look like this:



If the skill cannot be used within battle, it only needs the change item part.


I hope that helps. If anything is confusing, just post. And post if you understand everything too so the tut gets a bump  ;8





**
Rep: +0/-0Level 87
Yeah, I understand them, even though its my first time reading it, I only need the skills that needs an item, thats all and sorry if I didnt respond earlier.

I PM you some questions, hope Im not being a beast.

Thanks alot man!

***
Rep:
Level 87
Is that a pocket dimension? Indeed!
Thanks Snailer. Comments like that warm this old, half machine heart  ;8

I don't really know why it is half-machine, but anything is possible with the internet. That is only part of my chest event. I also have it for gold and crafting items, etc... all with one common event and two variables.

Anyway, mumerus, you haven't responded so I will just post the event for both possible situations.

For both of these, you need to make a dummy skill. What this means is that you need to copy the skill you want to require an item into another slot in the skills tab of the Database (DB). All that you have to do is make it so that this skill can never be used, which means using the pull-down menu under Occasion and selecting Never in the dummy skill. If you want you can edit the description to say what it requires.

(1) Needing an item, but not using the item:

You need to make a common event set to paralell process called by any switch. Remember to turn that switch on before you get the skill. The common event needs to do two things: If you do not have the item, it needs to replace the real skill with the dummy skill. If you do have the item, it needs to replace the dummy skill with the real skill. Thus, we need a conditional branch and a change skills (see Event Commands Tutorial if you do not understand these concepts). The common event should look like this:


That's all.

(2) Using an item upon casting. (reagents)

You need to do the exact same thing as (1), so read it now if you have not already done so. Now, you need to make an additional event which is called by the real skill. What you need this to do is remove the item or items you need to cast the spell. SO, that means a Change Items command. Furthermore, paralell process events do not run during battle, so you will need to reproduce a simplified version of the first event within this one. I.E. if we run out of the reagent, we need to stop our player from using the skill, but we do not need to add the condition of relearning since there is no possibility of obtaining the reagent in the middle of battle. So, this event should look like this:



If the skill cannot be used within battle, it only needs the change item part.


I hope that helps. If anything is confusing, just post. And post if you understand everything too so the tut gets a bump  ;8





I'm confused. I made 2 common events, just like you, one of each. I gave a character the skill, then tried to use it and he did with none of the required items, but only once. I think I might be screwing up in a few places.

1. What skill does the charcter need to have to use the item? The real skill or the dummy skill?  and how does the game switch between them? (This should be obvious but I'm missing something)
2. Uh, noob question comming, How do I use the conditional switch?

I think this is a great tut for those that know what their doing, so no disrespect to you, but I've only had XP for 2 weeks, so could you dumb it down a little for me? *gets on knees and begs*
I apologize in advance for all spelling errors...

**
Rep: +0/-0Level 87
Conditional Branch is something like a condition that must be met,
When you click on it on event, it shows you many things, member gold and item.

For example, if you have a Small Key, you can open lock doors, if you dont have a Small Key, then that door wont open at all.

Its like... it checks of the player have the item and stuff like that, you can make a negative thing or a positive thing.

Hope that gives you a basic idea. Otherwise, theres some tutorial that  have it, those people are a pro, Im just a noob!

***
Rep:
Level 87
Is that a pocket dimension? Indeed!
Acctualy I ment the contditional switch in the common event, but thanks for trying mumerus.

Edit: Ok, I got the second one to work, I just didn;t understand why it was working with out the item and the rason is it will work once if you start a new game with none of that item, then the common event will work as it is supposed to and remove the skill.

Still would like a quick explination of the Condition switch (trigger switch in PKXP) in the common event.

Edit 2: Something cool. Since I couldn;t figure out how to get the skill back once the character bought more of the needed item, I set it up so that the dummy skill does no damage and when you run out of the item, a message pops up telling you you have run out of the item. I'm really stating to like this skill MA.
« Last Edit: April 04, 2007, 05:45:40 PM by Jangles »
I apologize in advance for all spelling errors...

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Okay, I'll explain it real quick as I have to go to class, so it might not be perfect. The condition switch means that the event will only be active when the specified switch is on.

Quote
Ok, I got the second one to work, I just didn;t understand why it was working with out the item and the rason is it will work once if you start a new game with none of that item, then the common event will work as it is supposed to and remove the skill.

I think this is because you did not turn the switch which controls the first common event on. In my example, it requires the switch "reagents" to be on before the event will work. Therefore, you need to turn that switch on before the player has an opportunity to use the skill. The problem you mention will not exist if you turn that switch on using the Control Switch event command in some local event before the player can use the skill (see Event Commands Tutorial if you don't understand what that command does).

Basically, the Condition Switch places a condition on the event, so that the event will not run unless a previous condition has been fulfilled. It works just as Conditional Branch does, but it applies to the entire event. In this case, the condition is just a switch. Post if you don't understand, I will be back in approx. 3 hours.

You just haven't activated that switch, and that is why firstly, you can cast without the item the first time, and secondly, you won't be able to recover the skill once you buy the appropriate items.
« Last Edit: April 04, 2007, 05:56:28 PM by modern algebra »

***
Rep:
Level 87
Is that a pocket dimension? Indeed!
Thanks MA, i think I figured it out. I had to put the conditional switch in the shop so that when I bought the item neede to use the skill, I regained the skill. And your right about Putting a switch before the player can use the skill. I think the idea is that the character will probably have some of the item when you gain that character, which means the swich before won;t be needed, and when they gain a new skill, have it set to the dummy skill first, the real skill with the switch when they fid a shop that sells the item. I hope I've got it.
I apologize in advance for all spelling errors...


*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
Thanks MA, i think I figured it out. I had to put the conditional switch in the shop so that when I bought the item neede to use the skill, I regained the skill. And your right about Putting a switch before the player can use the skill. I think the idea is that the character will probably have some of the item when you gain that character, which means the swich before won;t be needed, and when they gain a new skill, have it set to the dummy skill first, the real skill with the switch when they fid a shop that sells the item. I hope I've got it.

Well, if you wanted, you could just make another common event, also set on parallel process, which checks if the person has the skill, and then turns on the appropriate switch. If you want I can write it up in more detail, but this is a tutorial after all.
Actually, I'll post an upgraded version of the event in a separate thread soon. I'll answer your PM question there too mumerus.

Hoep you don't mind but I made a Ring Of Fire. ;)

How dare you make a Ring of Fire. I'm allergic to rings of fire. I'm so pissed because of that  ;8
Nah, I'm happy my tut was of use to you.



**
Rep: +0/-0Level 87
Thanks, take your time, I have alot of time, Im working on my game's story right now.
Good luck and thanks again!

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Most Mature Member2012 Favorite Staff Member2012 Best RPG Maker User (Scripting)2012 Best MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Use of Avatar and Signature Space2011 Best RPG Maker User (Scripting)2011 Most Mature Member2011 Favourite Staff Member2011 Best Veteran2010 Most Mature Member2010 Favourite Staff Member
There's the upgraded event.

It doesn't yet address your question mumerus. But, eventually, it will.


http://rmrk.net/index.php/topic,14951.0.html