the events in openmw-lua works/starts by simply defining it with these
- where to send, which is defined in sender script
- and can send data with it to receiving script(s)
- and you can also send multiple events in one file
Defining local event works in the sender like:
target:sendEvent( "eventname" , { data = value(s), another_data = value(s) } )
- " : " means self and is preferencing target. this reads as self value in tooltips
- target needs to be a GameObject, be it actor, container or something else
- eventname is the distinc name of the event
- data is serializable table or single value which can then be used in receiving actor.
GLOBAL events are the same but don't need target, just the core, ie.
local core = require('openmw.core')
core.sendGlobalEvent( "eventname", { data = value(s) } )
- the fields are same as on local event
- notice there is now
. after core
For sending events to local script (attached somewhere):
- for this purpose the recipient must have script attached
- directly via openmwscripts or via global addscript function.
- global works with using CUSTOM keyword in omwscripts file