Announcement

Collapse
No announcement yet.

DMT Modding Tool

Collapse
This is a sticky topic.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #76
    Originally posted by sphereii View Post
    Those two errors are from building the mod against 18.3. they will need a patch before they'll work with that experimental
    what a patch?

    Comment


      #77
      Originally posted by belfegor View Post
      what a patch?
      https://github.com/SphereII/SphereII...tree/Alpha18.3

      There is my 18.3 repo. You just need 0-SphereIICore to get it to compile.

      Comment


        #78
        thank you !

        Comment


          #79
          Solved: Harmony doesn't seem able to patch static methods.
          Besides, my requirement meant checking the instance type, which isn't possible in a static method.

          I solved this by patching a different, non-static method to achieve what I wanted to do




          Is there something special I need to do to patch static methods?

          Take this example


          Spoiler: 
          Code:
          class Tim_Test {
              public class Tim_Test_Init : IHarmony {
                  public void Start () {
                      Debug.Log (" Loading Patch: " + this.GetType ().ToString ());
                      var harmony = HarmonyInstance.Create (GetType ().ToString ());
                      harmony.PatchAll (Assembly.GetExecutingAssembly ());
                  }
              }
          
              [HarmonyPatch (typeof (BlockPoweredDoor))]
              [HarmonyPatch ("Init")]
              public class Tim_BlockPoweredDoor_Init {
                  public static bool Prefix (BlockPoweredDoor __instance) {
                      Debug.Log ("Type: " + __instance.GetType ().Name);
                      return true;
                  }
              }
          
              [HarmonyPatch (typeof (BlockPoweredDoor))]
              [HarmonyPatch ("IsDoorOpen")]
              public class Tim_BlockPoweredDoor_IsDoorOpen {
                  public static bool Prefix (BlockPoweredDoor __instance) {
                      Debug.Log ("Type: " + __instance.GetType ().Name);
                      return true;
                  }
              }
          }
          In this case, the patch for "Init" works, as the log can be seen in the console, however the patch for "IsDoorOpen", does not, as under no circumstance does a log appear in the console (placing, turning on power, etc).

          The only difference between the two methods is vanilla "Init" is:
          Code:
          public override void Init()
          whereas vanilla "IsDoorOpen" is:
          Code:
          public static bool IsDoorOpen(byte _metadata)


          Any help pointing me in the right direction would be greatly appreciated
          Last edited by timbeswick; 01-20-2020, 08:07 PM. Reason: Solved

          Comment


            #80
            This is the Discord forum is where most of the C# modders hangout and will answer your questions much faster than on these forums: https://discord.gg/gKdwBmH

            Comment


              #81
              Hello,

              In "MyMod/Script/some_folder/", I have a VScode project executing some Main() (for testing purpose). When I build using DMT, some dll (produced by me running test) in "MyMod/Script/some_folder/obj/" are written to the root folder of 7D, causing the game to crash (probable cause: different c# version between the 2 dll).
              Is there a way to prevent such files to be moved (or maybe better practice for me when running test) ?


              Also a random suggestion: could the tool manage the order of mods by renaming them (eg "0_", 1_" ...) before applying them ? There would be some config file storing order for the build. (I did not run into order issue myself yet though)

              Comment


                #82
                hey guys been having a problem with DMT not working I don't know what to do the error message is this

                Running BackupFiles
                Backup dll found: D:\DMT/Backups/SP/18.3b4/Assembly-CSharp.dll
                Running DeployDlls
                Deploying DLLs
                Running LocalisationPatch
                PatchFile: D:\DMT\DMT Mods\0-SphereIICore/Config/Localization.txt
                D:\DMT\DMT Mods\0-SphereIICore/Config/Localization.txt detected BOM in file

                Unhandled Exception: System.ArgumentException: An item with the same key has already been added.
                at System.ThrowHelper.ThrowArgumentException(Exceptio nResource resource)
                at System.Collections.Generic.Dictionary`2.Insert(TKe y key, TValue value, Boolean add)
                at LocalisationTable.ReadFromStream(BinaryReader br, String path)
                at LocalisationTable.Load(String path)
                at DMT.Tasks.LocalisationPatch.PatchTextFile(PatchDat a data, String sourcePath, String destPath, String patchFilePath)
                at DMT.Tasks.LocalisationPatch.Patch(PatchData data)
                at DMT.PatchData.Patch()
                at DMTViewer.Program.Main(String[] args)

                process exited with error code -532462766

                please help

                Comment


                  #83
                  Originally posted by Chaos7h30ry View Post
                  hey guys been having a problem with DMT not working I don't know what to do the error message is this

                  Running BackupFiles
                  Backup dll found: D:\DMT/Backups/SP/18.3b4/Assembly-CSharp.dll
                  Running DeployDlls
                  Deploying DLLs
                  Running LocalisationPatch
                  PatchFile: D:\DMT\DMT Mods\0-SphereIICore/Config/Localization.txt
                  D:\DMT\DMT Mods\0-SphereIICore/Config/Localization.txt detected BOM in file

                  Unhandled Exception: System.ArgumentException: An item with the same key has already been added.
                  at System.ThrowHelper.ThrowArgumentException(Exceptio nResource resource)
                  at System.Collections.Generic.Dictionary`2.Insert(TKe y key, TValue value, Boolean add)
                  at LocalisationTable.ReadFromStream(BinaryReader br, String path)
                  at LocalisationTable.Load(String path)
                  at DMT.Tasks.LocalisationPatch.PatchTextFile(PatchDat a data, String sourcePath, String destPath, String patchFilePath)
                  at DMT.Tasks.LocalisationPatch.Patch(PatchData data)
                  at DMT.PatchData.Patch()
                  at DMTViewer.Program.Main(String[] args)

                  process exited with error code -532462766

                  please help
                  Are you using the latest version of DMT, available in the first post?

                  Comment


                    #84
                    I've had a decent amount of time to play around with DMT and Alpha 18.1 through 18.3, and I just wanted to thank whoever made DMT, Harmony, SDX, and the tutorials for all three. They're excellent tools. It's been challenging but fun to create the few little mods I'd been wanting, and I'd never have been able to get anywhere if it weren't for the documentation that was written, so thanks a lot for all the work that's been put in.

                    Comment


                      #85
                      Originally posted by sphereii View Post
                      Are you using the latest version of DMT, available in the first post?
                      i'll give this a test now I think I have been but haven't tried for a week so will check now

                      Comment


                        #86
                        Originally posted by sphereii View Post
                        Are you using the latest version of DMT, available in the first post?
                        i'll give this a try now I think I have used the latest but i'm quite noobish at setting this up is there a tutorial for using it because i'd love to get the npc's in there

                        Comment


                          #87
                          Ask for help.How shoule I use System.IO.File.Exists to search the Dedicated Server rather than search my local game save folder? The same about File.WriteAllText and File.Delete.I host My server on a server .But when I Use file opration,It did on my own personal PC. Help Thanks

                          Comment


                            #88
                            I seem to be having some problems getting DMT to work. I followed the video overview tutorial to the T, made a separate DMT mods folder inside of my 7D2D directory and put just SphereII-Core inside of it. I copied the DMT files into a subdirectory inside my 7D2D root called DMT, started the program and successfully compiled a build with just SphereII-Core selected. However, whenever I start the game with this build, I get a red error in console about a missing Mono.Cecil.dll. I saw the earlier post in this thread about that issue and tried copying the 4 mono.cecil dlls into the 7D2D Managed folder, as well as newtonsoft.dll as it would throw that as a missing dll error as well. With those dlls inside of Managed, the game loads without a red error, however upon starting a new game, I get spammed with "There are no graphs on the scene" in console, all creatures do not move, I have a weird health bar that shows up when I look at enemies.

                            I don't understand what the problem is here. In the video tutorial he does not copy any dll files to managed and it works just fine.

                            Edit: I am using the most recent version of DMT, 1.5.7239.23150, and I tried both the SphereII-Core in the root github as well as the "patch version" for 18.3 under the 18.3 subdirectory.

                            Edit 2: After emptying my mods folder and re-patching so that JUST SphereII-Core is inside of my mods folder (making it the only mod that is loading), this issue continues happening. It definitely seems to be some issue with DMT. I am just baffled as to what it is as I did everything exactly like the video in OP.

                            Edit 3 with more details: The game also doesn't save output logs when I have the patch applied, so I can't copy-paste the output log. But I noticed two lines above the line complaining about mono.cecil, saying "Skipping missing assembly: mscorlib" and "Skipping missing assembly: System.Core". Not sure if that's related but it's the only other thing in the console that seems abnormal to me.

                            Edit 4: Now wondering if it has something to do with the .NET framework version installed on the machine. However, I initially ran into the problem while playing on my personal server, which is also having the same exact issue.

                            Edit 5: I can confirm that this behavior is happening on two separate machines. Some help would be greatly appreciated...

                            Edit 6: In edit 3 I mentioned that the console was complaining about missing assemblies, system.core and mscorlib. They are both present inside of the 7D2D managed folder, on both machines. This is very weird behaviour and very frustrating as well, I've literally spent hours trying to get this to work so I could use the NPC mod. I give up. Hopefully my save is okay. Also, I'm not sure if the root of this issue is DMT or SphereII-Core, hopefully this was the right place to post this.
                            Last edited by Sykriss; 03-01-2020, 08:32 PM.

                            Comment


                              #89
                              Hi, I had the same issues as Sykriss and gone through all his/her steps before too. But somehow after several re-installations through steam it worked with A18.3 exp eventually.

                              Today I tried to update to A18.4 exp. I installed DMT and unfortunately the Mono.Cecil.dll error is now back and I can not get rid of it anymore too. Same as before, see Sykriss post above and my earlier posts.

                              I tried so many things again and verified the game files through steam 10 times now. I even deleted all my saves and config folders. Only one time I was able to get DMT running and I don't even know why it worked in A18.3 once.

                              I have Windows 7 (malware 10 is not an option for me). Maybe this is the culprit? For most people DMT works I suppose, but I seem to be not the only one having this problem. I do not know what to do anymore. Maybe something comes to light in the future. Never had any problems with SDX in the past.

                              Comment


                                #90
                                This is my method for a good install. Been loading this way for SDX and DMT for over 2 years and it always works.

                                Step 1: Load and validate a 7Daytodie Steam install. If you already have the game installed, make sure the Mods folder is empty. If no Mods folder is there, that is ok too.
                                Step 2: Make a copy of the game install folder which is usually at C:\Program Files (x86)\Steam\steamapps\common\7 Days To Die
                                Step 3: Paste that copy to a new location, such as F:\ resulting in a folder location of F:\7 Days To Die
                                Step 4: Make a new directory folder for DMT with a name such as named C:\DMT and off that add a Mods folder C:\DMT\Mods
                                Step 5: Download the DMT .zip file and copy all its contents into the C:\DMT folder
                                Step 6: Run DMTViewer.exe and click on the settings tab
                                Step 7: Set the path to the Mods folder by clicking on the 3 dot button and point to C:\DMT\Mods
                                Step 8: Set the path to you copy of the game by clicking on the 3 dot button in the Game Loactions window and point to F:\7 Days To Die
                                Step 9: Click the build button with no modlets in the mod folder yet. Verify the build completed with no errors
                                Step X: Add a modlet to the c:\DMT\Mods folder and build again. Verify the build completed with no errors

                                Let me know if you still have issues.

                                Comment

                                Working...
                                X