murgh wrote:Any examples on how to use that stuff would be more than welcome.
I have been on the hunt for that info myself, and so far have come up dry. I watched the entire dev blog video on that release, but they kind of glossed over the world scripts feature, saying only that it was intended to resolve a common hack where modders would want to have only one instance of a script running, so they would have to spawn a single object somewhere to attach the script to.
This is something I could definitely use, but I can't find any further info on it, so I just started experimenting with it myself. So far what I have discovered is:
- In addition to WorkQueue.Request, there are a number of special functions in the Game table that are only visible to World scripts (some of which look very interesting)
- World scripts are not attached to a traditional 'game object'/Entity, a call to 'this.GetNearbyObjects()' will fail from within a world script
- Calling this.getNearbyObjects("World",x) from inside traditional scripts attached to regular Entities doesn't seem to yield any results
My current focus is in trying to figure out how to get a reference to a regular game object from within the world script, or a reference to the world script from within a regular game object, as I need some sort of communication between my regular scripts and the world script in order to make proper use of it. Since some of the parameters to WorkQueue.Request are potentially object tables, I assume there must be a way to do it, but the traditional mechanism of 'GetNearbyObjects' does not seem to be working.