I am a complete beginner regarding a) unreal engine b) Conan Exiles modding, so please forgive me if I might ask stupid questions or express myself in a way which is not understandable.
ModController & ActorComponent
I have set up the ModController
subclass & Actor component subclass as shown in several tutorials. That is, my ModController subclass attaches the component MyMod_ActorComponent
to the Base Player Char
.
What I want to do:
Upon an event, I want to store a struct in a list for a given player. Each player shall have its own list of said struct, and the list shall be saved, so that when the player logs in again, the list is persisted and can be accessed again.
Currently, I am triggering this event by mouse click in one of the UI menus. Here, I can get the owning player pawn, cast it to BasePlayerChar
, then get my actor component via GetComponentByClass
, and then I call a function of MyMod_ActorComponent
, lets say AddStructToList
.
My confusion
In the technical manual of Conan Exiles I can read:
8.1 Step One - The ModController
It will also be saved to the DataBase. If you create new variables on it, and tag them with the
“SaveGame” flag, it will be saved and loaded when the server restarts. So persistent data can
also be stored here for your mod.
This leads me to believe that I need to have the list of structs inside my ModController. I have tested this with a simple bool variable, and indeed it is saved & restored.
Now what I don’t understand, is several aspects:
- My starting point is the player pawn, or, as described above, the
MyMod_ActorComponent
. I don’t know how I can get a reference to theModController
from there, so I am unable to forward the trigger to theModController
where then the struct should be added to the list. - It is my understanding that the
ModController
is something which is instanciated upon server start once, and not per player. This means, it will hold the list of structs for all players, so a list of lists. How would I add objects to a list and keep a reference to the player who triggered the event, so I can later retrieve it from said list, and assign it again to the correct player?