dagobaking Posted June 6, 2018 Share Posted June 6, 2018 Is there an event somewhere that fires when the game gets saved? If not, is there some other Event that fires reliably after a save is done? Maybe player onload fires again? Link to comment Share on other sites More sharing options...
Reneer Posted June 6, 2018 Share Posted June 6, 2018 (edited) No, there is no event that fires when the game is saved, only when it is loaded. And that only fires when the game is actually loaded. Edited June 6, 2018 by Reneer Link to comment Share on other sites More sharing options...
shavkacagarikia Posted June 6, 2018 Share Posted June 6, 2018 There is no such event in papyrus. But you can try using SaveLoadMessageStringEvent global event from native f4se plugin. I havent tested but it seems it should fire when save/load message appears on screen. Link to comment Share on other sites More sharing options...
dagobaking Posted June 6, 2018 Author Share Posted June 6, 2018 On 6/6/2018 at 3:19 PM, shavkacagarikia said: There is no such event in papyrus. But you can try using SaveLoadMessageStringEvent global event from native f4se plugin. I havent tested but it seems it should fire when save/load message appears on screen. I can't find anything about this type of event. Is there a place where this is documented? Link to comment Share on other sites More sharing options...
shavkacagarikia Posted June 7, 2018 Share Posted June 7, 2018 (edited) Unfortunately no. Global events are type of events you can use with event dispatcher without need to have their addresses in memory. But you stil need to know the members of struct it contains when fired, dump it with dumpclass. Usage is following: struct SaveLoadMessageStringEvent { UInt32 Unk00 //fill with members after you use dumpclass in event body. Members will be dumped in f4se logs folder in file with your plugin name };class SaveLoadMessageStringEventSink : public BSTEventSink<SaveLoadMessageStringEvent> { public: virtual ~SaveLoadMessageStringEventSink() { }; virtual EventResult ReceiveEvent(SaveLoadMessageStringEvent * evn, void * dispatcher) override { //event will happend here, do whatever you want. You access members like this: evn->unk00 return kEvent_Continue; } }; SaveLoadMessageStringEventSink saveLoadMessageStringEventSink;Then to add your event sink in event dispatcher, add this code somewhere where your plugin loads (in plugin_load or messaging interface's data ready) auto eventDispatcher = GET_EVENT_DISPATCHER(SaveLoadMessageStringEvent); if (eventDispatcher) { eventDispatcher->AddEventSink(&saveLoadMessageStringEventSink); }Almost forgot, write following somewhere in beginning of your file to use global events like I suggested, this is reg2k code btw: BSTEventDispatcher<void*>* GetGlobalEventDispatcher(BSTGlobalEvent* globalEvents, const char * dispatcherName) { for (int i = 0; i < globalEvents->eventSources.count; i++) { const char* name = GetObjectClassName(globalEvents->eventSources[i]) + 15; // ?$EventSource@V if (strstr(name, dispatcherName) == name) { return &globalEvents->eventSources[i]->eventDispatcher; } } return nullptr; } #define GET_EVENT_DISPATCHER(EventName) (BSTEventDispatcher<EventName>*) GetGlobalEventDispatcher(*g_globalEvents, #EventName);P.S I suppose, as one of your mods use f4se plugin dll, you are familiar with them, otherwise all this may not make much sense Edited June 8, 2018 by shavkacagarikia Link to comment Share on other sites More sharing options...
dagobaking Posted June 7, 2018 Author Share Posted June 7, 2018 Thank you for this. The dll that my mods use was built by someone else. Unfortunately, I don't know c++ well enough to use this. Link to comment Share on other sites More sharing options...
Recommended Posts