Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

I can't understand the event system


Recommended Posts

Hello, I'm new at the forums and game making. The only thing I really know about game making is from the time I tried to make an RPG with RPG Maker XP, which progressed a little but failed, and a little time in which I tried to do something with the Sonic Worlds Engine in MMF2, but I failed miserably because I simply don't have the slightest idea of how the events work, so I could only mess with the level design. Although I know something about variables and such, and I'm learning algorithms at the course I'm doing, that's pretty much what I know about programming. So, I'd like to know if there are any guides for MMF2 that teach the basics about the event system. Really, as I said, I'm pretty new at this, so any help is appreciated.

PS.: Two things: sorry if I'm just being an annoying newbie, and sorry if I did any english errors (BTW, I'm brazilian).

Link to comment
Share on other sites

Nice to know there's another brazillian over there.

Dude, MMF2 is all about conditions, which we call Events, and objects have Alterable Values, Alterable Strings and Internal Flags (boolean variables).

For example, in Sonic Worlds, when you're on the ground and has no X Speed, your animation will turn into the stopped one.

To do that, you do the following:

//(Right click New Condition)
//A box will appear. Select the desired object that has the variable you want to compare. In this case, it's Player_MovementValues. Right click it, go to Alterable Values > Set. Another box will appear. Select value "Ground", then type 1, click OK. This will appear:

Ground(Player_MovementValues) = 1

//This will make you compare the current value of Ground, a variable from the specific Player object;
//(right click the event above, click Insert)
//Here's a little trick: When you need to compare with an expression (like in this case, as we're going to need the absolute value of a variable, as XSpeed's signal is used to compare to where Sonic is going), you're not going to right click the object that has the variable you want.
//Instead, right click the Special object (the two monitors' icon. This is one of the general objects of a frame, that doesn't depend on you to create them) and select "Compare two general values".
//In the first box, type Abs() and put the cursor between the two brackets.
//Then, click "Retrieve data from other objects", and NOW you will select the variable you want.
//You'll see something like Abs(XSpeed(Player_MovementValues)). On the other box, type 0. You'll see this under the Ground event we created:

+ Abs(XSpeed(Player_MovementValues)) = 0

//The function Abs() returns the absolute value of the specified number variable. There are other useful functions too, like random() str$() and whatever.

Then, on the list of the events editor, on the right side of the events itself, you'll see a wide array with icons for every active object in the frame. Just go to the object's column, go to the line of the event you just made and right click it.

In this case, as we're gonna set a specific animation (imagine that we've already set the animation "Stopped" of Sonic to play when the value Animation of object Player_Others is equals to 0), you do the following:

//(right click the space in the event's line, and Player_Others' column)

Alterable Values > Set

//(In the box that is going to appear, you select the value Animation and type 0)
//When you put the mouse over the check that is going to appear, you'll see:

Set Animation to 0

Here's a little screnshot of what we just did:

attachment.php?attachmentid=1557&stc=1&d=1336324961

I hope that helps a bit.

Notice that the event above has already been made on the engine, you don't have to do it again.

You'll eventually have to get some tutos to learn better about objects, backgrounds and how they work. There's nothing much complicated; like any other programming, it's all about practice.

post-1782-138639765286_thumb.png

Link to comment
Share on other sites

Thanks for the help, I'm beginning to understand some things. So, everything that happens in the game is handled by those conditions, and to modify things I need to modify the values, strings, and flags, and also compare them so something will happen if that value is equal to something (in this case, we made it so Sonic would be still when he isn't moving).

I'll search around a bit and mess with the events to see what I can do. Also, do you know where I can get some basic tutos?

Once again, thanks.

Link to comment
Share on other sites

Contrary to what LH seems to be suggesting, events and conditions aren't the same concept. Rather, an event is made up of conditions and actions. Conditions are the triggering component of an event. In other words, an event executes if and only if the conditions are met. A caveat of that though is that the objects an event applies to are selected based on certain conditions as well. So for instance, if you have a condition that a certain variable on an object must be equal to a certain value, then the event will only apply if there are objects with that value and actions on that type of object will only apply when that particular instance of the object meets the condition... Meanwhile actions are the things you do in response to the conditions being true. It's sort of like every event is a big 'if then' statement where the if also includes some database style selections.

Object selection is probably the hardest part to understand about events in MMF though, so you might want to just focus on the simple stuff for now... which is to say for a given event list, you can basically step sequentially to figure out what will happen in a given frame. Order matters. The first event will be executed before the second. Same goes for conditions within an event (though this usually only matters for performance, again a complex topic) and actions as well. Once the conditions have been evaluated, the actions for that event are applied if all the conditions were met. (by at least one object for each condition where an object is relevant). That's basically all there is to the whole event/condition/action concept.

There is at least one exception to events executing in order, and that's in the case of events marked with the "On Loop X" condition... which they will run at any point in the code when you execute the "Run Loop X" Action. With that you can create a number of useful subroutines/functions/whatever you want t call them. There might be other exceptions, but I'm not sure what they would be. Also note that they still run sequentially, it's just that they are part of a different sequence. If events 56, 62, and 80 all lead with "On Loop FancyFries", then when you run your FancyFries loop, they will run in the order 56, 62, and then 80 like you would logically expect. Nothing that doesn't lead with "On Loop FancyFries" will be executed between them or anything like that, and they of course won't be executed during the normal event loop if you don't call them.

By the way, an event in MMF is basically one full row. The conditions are the doted things on the left while the actions are what go into the little check boxes. Sometimes it helps to double click on one of those checkboxes so you can pull up the event viewer which will basically just show you the full sequence of all conditions and actions executed by the event.

Link to comment
Share on other sites

Okay, then...

Events are made of conditions and actions, and are like a big "if then" system.

Conditions are, as the name makes obvious, the conditions for the event to occur. Actions is what will occur if the conditions are met. Things will be executed in the order they are show, except when they're marked with the "On Loop X" condition, which makes then happen when you execute the "Run Loop X" Action. Yeah, the concept is pretty easy to understand, at least for me.

Anyway, while testing some things in the Event Editor, I ended up making the application end by pressing Esc. Yeah, I know, it's simple, but I'm just a beginner after all, and I'm learning things slowly XD.

I'll be trying to learn more here (it seems that the best way for me to learn is actually trying new things and examining what's already done). I really thank you guys for helping me with such a basic thing.

Also, another thing, I think this doesn't has anything to do with the events, but could someone tell me how to select this level detail object in the frame editor? I can click anywhere on it, it simply looks like it's not selectable.

attachment.php?attachmentid=1558&stc=1&d=1336425241

post-8027-138639765288_thumb.png

Link to comment
Share on other sites

CTRL+Shift+Click on it.

That unlocks it. For some reason, the object must have ended up locked.

That also happens if the layer it's it's in gets locked. CTRL+K opens the layers toolbar. Click the red lock icon to turn it green, thus unlocking the layer. (This may not unlock the object if it itself was locked.)

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...