Jump to content

Template Modification Without ScreenListeners


eXecator

Recommended Posts

I can iterate over all the templates which were created to change them, and then add my own. This example doesn't refer to non-static functions, but the same technique would apply, and it can avoid the need of copy/pasting hundreds of lines of code.

 

 

Strange. Don't you get a ton of Redscreen errors when entering Main Menu? When I tried doing it almost exactly the same way, I got a bunch of redscreens about "templates rejected due to having the same name" or something.

 

I suspect its due to CreateTemplates being called twice and Templates array returning duplicates. I had to call up template manager and add modified templates manually, and simply return empty Templates array.

Link to comment
Share on other sites

No redscreens for me. /u/fxsjosh says that CreateTemplate() called twice this way, with no arguments, will do nothing the second time.

 

Which is why the code you posted should only partially work. It will only return your new templates. But the ones you've modified will be rejected. I also don't understand why it's not showing you any redscreen warnings. By any chance, are you launching the game from Steam instead of ModBuddy?

 

Admittedly, I've tried this method before the patch, and I am not sure if anything has changed since then.

Edited by CaveRat
Link to comment
Share on other sites

I am running the game through steam, and searching in the logfile for any redscreen messages. I doubt the patch changed anything. For the purpose of my mod, deleting the other templates is actually fine, but I don't think that is happening. Is it possible that my call to super.CreateTemplates is generating the templates, and the *other* call to CreateTemplates is being rejected? Anyway I should see redscreen messages in the log file if some templates are rejected, right?

Link to comment
Share on other sites

I thought that without the debug mode, redscreens will be suppressed altogether. I'd suggest you simply try to run it via ModBuddy's debug option. (at least once, to test it).

 

As for the order of execution of these functions, I'm not entirely sure. But I've always assumed that if class B extends class A, then class A must be processed before class B. But like you say, I suppose it is possible that it's the "other" CreateTemplates() being rejected. Whichever the case, it's a pretty easy fix. You just need to add those modified templates to the template manager manually. This is what Josh recommended as well in your reddit conversation.

Edited by CaveRat
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...