Learning "Events"

Posted By: DiegoFloor

Learning "Events" - 03/08/09 00:04

Hi!

After reading the manual, I get the idea that the event system is very important/useful for communication between entities. But what I read was not enough to actually undertand how it works!

Is there some tutorial about events? I find it really hard to navigate through all those lite-c workshops!
Posted By: Pappenheimer

Re: Learning "Events" - 03/08/09 01:09

I don't know better for now than show you the links to the online manual to start with them:

http://www.conitec.net/beta/aentity-event.htm

http://www.conitec.net/beta/aent-scan_entity.htm

Try to build simple functions build on that. It is quite complicated.

Probably, in some issues of the AUM Magazine are articles about that, but I don't know where.
Posted By: DiegoFloor

Re: Learning "Events" - 03/08/09 05:00

Thanks for the response Pappenheimer smile

I'm a little uncertain of what's going on, but I managed to make it work!
Posted By: Pappenheimer

Re: Learning "Events" - 03/08/09 11:46

Some hints:
Let's think of a special event:
let's say an npc pushes another.
You can scan each frame, but it is better to scan in a certain situation only, for instance when the player pushes the push button, or when the npc pushes another, means he is in an attack state and has reached a certain distance to the other, then call c_scan.
In case you have a lot scans within the game, and the more complex your world gets the more you need to assure that they don't interfere, then you should give each scan a scan id.
And, to assure that the other isn't pushed several times from a single event you have to switch the event off (my.event = NULL;)
Probably, you play a sound as well, and that sound should play only once, too.

But, when you set the event to zero, you have to switch it on, at least in the attack state (my.event = npc_event;), before you can use it again.

I describe it as it is in A6 - there could be slightly changes in A7, though.
© 2023 lite-C Forums