Help - Search - Members - Calendar
Full Version: Generate Events
Game Maker Community > Working with Game Maker > Advanced Users Only
KeeGames
Hi,

Im working on k2k2, wich is a multi-player game. I want all the packages to be send and received by one object, the 'multi-player controller'.

Other objects, like the player, should send a message to the 'multi-player controller' when it needs to send data (position or anything).

There's the problem. How do objects communicate with each other? I could change the value of a variable wich is readed out by the multiplayer controller every step, but thats an ugly way.

I found the generating event functions, but it seems i cant generate the user devined events by an other object

this code does not work:
CODE
event_perform_object(obj_mpcontroller,ev_user0,0)


So how should i change this to make it work? Or is there some better way to do this. Im wondering how you let your object communicate with each other.

Thx in advance,
Jordin
ragarnak
QUOTE (KeeGames @ Mar 10 2006, 03:34 PM)
I found the generating event functions, but it seems i cant generate the user devined events by an other object
*
Try "with (instance-id) event_perform(...)".

Hope that helps.
J-Factor
Also, ev_user0 is an event number not type. You should be using ev_other as the type:

CODE
with (instance) event_perform(ev_other,ev_user0);


However, there's a more appropriate function for calling user events:

QUOTE (Help File)
event_user(numb) In the other events you can also define 16 user events. These are only performed if you call this function. numb must lie in the range 0 to 15.
KeeGames
Stupid me, i totally forgot the with (instance) function of gm. I guess ive been out for too long...


Thanks guys it all worked. smile.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.