Jump to content

Recommended Posts

Basically, my question was in title - how sending Event from object in Master world (forest) to object in Slave world (caves) and vice versa can be done and is it posible to be done at all?
I found this topic where @ZupaleX sad next: "By using net variables, you can make slaves react to event pushed by the master, but not the opposite". How master -> slave can be done using net_vars? Can someone clarify?
Has something changed from December 2015 and slave -> master Event is possible now? 

More context with code:

 

Spoiler

I've created Prefab and in main function I've wrote next lines:

inst:ListenForEvent("test_event", function(inst, data) print ("got event from") print (data.guid) end, TheWorld)
inst:DoPeriodicTask(5, function(inst) TheWorld:PushEvent("test_event", {guid = inst.GUID}) end)

And by analyzing '..\Caves\server_log.txt' and '..\Master\server_log.txt' realized that object created using this Prefab 'hear' only Events from caves if it is placed in caves and Events from upper world if it is placed in upper world.
Thats probably because those objects in caves have other 'TheWorld' than those from upper world.
But I want them to hear each other.


Looking forvard to hearing someone, who can clarify question from title for me.

As of yet, and as far as I am informed, mods cannot send custom RCPs, but Zupalex and I think it should be possible to communicate via temporary text files. It works like this:

  1. recipient periodically checks if file exists
  2. sender creates the file to send a signal
  3. recipient finds file, reads it and deletes it
  4. recipient does whatever it is supposed to do upon the signal, using data from within the file

You need to set this system up once for each connection, so in your case Forest->Caves and Caves->Forest. Using the standard Lua IO library should be sufficient.

On a sidenote, it is probably best if the sender cannot write the file again while it exists, so there's no stream (file access) conflicts.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...