Hi all,
in NWN, heartbeat was pretty easy to implement.
It is a little more complicated with the event driven engine of DA.
I would like that when the PC is in an area, this area randomly spawns stuff every x seconds.
The "randomly spawn stuff" is ok, but I can't figure out the "every x seconds" part.
Any Idea?
Area heartbeat
Débuté par
mj crom
, nov. 26 2009 11:40
#1
Posté 26 novembre 2009 - 11:40
#2
Posté 26 novembre 2009 - 03:37
edit: double post.
Modifié par DavidSims, 26 novembre 2009 - 04:11 .
#3
Posté 26 novembre 2009 - 03:44
You can make your own heartbeat with a DelayEvent function call in the spawn script, and call it again every time in the handler for that event. You can set the frequency to be whatever you want.
#4
Posté 03 décembre 2009 - 05:57
mj crom wrote...
So I can DelayEvent a function, like CreateObject ? I thought DelayEvent was for event ...
No, there is no way to delay a function call.
DelayEvent signals the event to the specified object after the delay.
You can make an area heartbeat this way by first sending a heartbeat event to the area, then within the area's script have a case for the heartbeat event, and within that handling delay a heartbeat event sent back to the area. Every time the heartbeat is run, it queues up the next one.
#5
Posté 03 décembre 2009 - 06:41
Hoagsie wrote...
Wouldn't be possible to make a new and empty event to fire?
So you would call
DelayEvent(5f, null, EVENT_BOGUS_DO_NOTHING, null);
??
Yes, but what would be the point? It would do nothing.
Although some events are sent by the engine, many are entirely scripted. The event type is just an integer. You can make whatever events you want with whatever event type you want and with whatever parameters stored on the event you want. You can send these events to any object you want. The event handling is done entirely through scripting, so you can see exactly what will happen by tracing through the object's script. You do however have to be very careful about overlapping event type IDs. For safety, using the EVENT_TYPE_CUSTOM_EVENT_1 is a good idea.





Retour en haut






