Download

Inter-mod communication

Is it possible to send & receive variables between mods? I want to create a new energy system so that a single generator can’t power 100 fridges but I don’t want it to break other existing mods.

I do not believe that this is possible.

I’m just shooting in the dark here, but you need something that both mods can access. I’ve been using cast to in order to pull
data from the ini file using the game mode, but similar technique might work to pull any data from it.

Not knowing what order a server admin will load a particular mod could cause issues if you get this to work. You would need to ensure that the mod load order ends with the right mod’s game mode getting used. I am completely ignorant of what values can be set/get this way, but you might be able to figure out a way to bounce data back and forth between two bp’s using the game mode as an intermediary.

I’ve had success on different platforms/engines with one mod creating an invisible, indestructible object/actor somewhere in the world, then having another mod, (that knows the location of my other mod’s object), look for any object of that type in the area. Once you find the right object, you can get variables from it through cast to. That’s usually a one way street, but making one mod the master that dictates a value to other mods might work using the same idea.

If both mods have a blueprint (‘energyRequester’ or something) would I be able to cast the structure to energyRequester and then access the variables?

I don’t know a way for mods to communicate directly. In some unreal engine set ups you could try a blackboard, but when I tried to implement one with the gamemode it breaks the game. Generally, Ark is based around each blueprint overwriting any previous ones of the same name. That’s why you get mod conflicts when someone tinkers with the Smithy or changes things in their gamemode so it would make sense if that same conflict would happen.

You could try my idea above where mod A creates an invisible, indestrucible energyRequester and places it at X,Y,Z.
The second mod could try to find the actor of type energyRequester at X,Y,Z, cast to that and that should allow you to access the values inside the first requester. You would just need a delay of a few seconds or a loop between the first mod placing and the second one looking.