• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM Help with event that only happen once

M

molcap

Guest
Hi!
I can't make a code for a event that only happen once, I just want when the player stops moving create once a block and then wait until the next move ends for create a new block

help please
 
H

Husi012

Guest
Hi,
you can create an variable (e.g. moving) in the create event which contains false. If the player is moving you set the variable to true.
When you aren't moving you check if it is true. If it is true you create the object and set it to false.
 
M

molcap

Guest
Hi,
you can create an variable (e.g. moving) in the create event which contains false. If the player is moving you set the variable to true.
When you aren't moving you check if it is true. If it is true you create the object and set it to false.
it worked! thank you
Events - > Other -> User defined
how it works?
 

obscene

Member
Create the event by following the menu items I listed.

Then call it with event_perform(type, numb);

It's basically like calling a script but unique to that object.
 

TheouAegis

Member
You don't need to use event_perform(), just use

event_user(n)

where n is the number of the user event.

User events are nothing more than scripts to be loaded with an object's data. When you think about it, they're pretty worthless, since anything you can do with a user event you can do with a script without any of the shortcomings of user events.
 

obscene

Member
I like them. My biggest use for them is for interactive objects. In my game when the player hits a button, flips a switch or picks up an item or whatever it is, it runs that objects user event and they are all very specific to that object. The alternative would be to get the object index and then switch between a ton of scripts and it's easier to just know that each objects interactive action is right there in the object.
 

TheouAegis

Member
Oh yeah. They're good for those kinds of things; but it seems like around here people just waste them on stuff that a normal script would suffice for. It could still all be done with normal scripts, though. Write the scripts for each of the objects, then in each object save the script ID it will use. Then just use event_perform. But yeah, I guess they do have their uses in some situations.
 

obscene

Member
I mostly use it as a place to copy backup code to when I make drastic changes I'll just make a user event and copy it over. :p
 
Top