Dethraker Posted July 18, 2015 Share Posted July 18, 2015 I want to start off by saying thanks to all those that have helped me so far, I wouldn't have reached the current understanding I have of both coding and Hex Editing without your help. What I'm trying to do may be a bit ambitious for me, but surprisingly I have met with a good deal of success thanks to help from some more knowledgeable individuals. Thanks to the LW team for adding additional 2nd Wave options that aren't being used yet, saves me a ton of searching through the existing code to make changes to an existing 2nd Wave option. So what I'm attempting is a completely new Tech Tree that will eventually have choices, do you want to go with beam technology or focus on what you know and advance ballistics? Gene mods, or MEC variations? Currently I have figured out how to add this as a 2nd Wave option and it's functioning! Really exciting for me. But the next step I need to figure out is how to add variables in the upks, speaking with johnny on the subject I was told it's a more complicated process, but I would really like to be able to do this. My goal is to add both more foundry projects as well as possibly more GeneMods(I'll have to make GeneMods something worth choosing over MECs) Right now I'm still in the planning/organizing stage on where I want to go with techs and foundry projects, but essentially techs will just provide foundry project options instead of unlocking all the weapons as it currently does. Thanks in advance for any help in this! Link to comment Share on other sites More sharing options...
tracktwo Posted July 18, 2015 Share Posted July 18, 2015 Adding new variables is possible but it is a little difficult to do and is only possible for some of the classes. Basically a variable needs to have two things: an entry in the name table and the export table. The name table entry is what adds the name of the variable to the file, and if there is already some variable somewhere with that name you don't need to re add it again. The export entry is basically what makes the variable a variable and it defines the type of the variable and what class it lives in. You can add both of these through the patchupk patch files, but I found them a little finnicky to get right, especially the export table entries. There is a PDF floating around that I can't link to right now that has the layout of these tables so you know what to add. There are also examples of doing this in WGhost's mutators project on github. When I've tried it I spent a lot of time inspecting the table entry for the new variables in ue explorer to make sure it looked exactly the same as a vanilla one and going back to the patch file to tweak it until it did. Be careful not to try to add any variables to classes marked native, that probably will not work. These classes have interactions with the native c++ code of the game and if you change the class in unrealscript bad things will probably happen cause they're out of sync. Another thing to consider is not modifying the existing classes to add new variables but instead creating all new classes, such as the mutators WGhost has created, or using the streaming map and custom actor technique I talk about in my flash ui and campaign summary threads. This is easier cause you can write the code in real unrealscript and compile the new package using the udk. You can create as many classes and variables as you want. But you still need some way to get the existing classes to talk to your new class, e.g. by making a new mutators call or streaming a map. Communication from the original classes to the new ones is tricky cause of this, but the new classes can just call into anything in the base game easily. Check out the threads on mutators and the github project for some examples. This works best if there are only a few 'entry points' into your new code from the base game, but your new code is fairly complex and requires lots of variables. Hope that helps! Link to comment Share on other sites More sharing options...
wghost81 Posted July 18, 2015 Share Posted July 18, 2015 I agree with tracktwo.I wouldn't go that route. I mean adding new variables to existing upks. It's unreliable and doesn't work under Linux and Mac. If you absolutely need to use more variables and functions, I suggest looking into mutators for XCOM project. Link to comment Share on other sites More sharing options...
Dethraker Posted July 18, 2015 Author Share Posted July 18, 2015 (edited) @tracktwo, that does help allot, could I get links to the different threads realting to the mutators as well as the specific github projects? I'm sure I can figure out the export entrys in the patchupk files, the only problem being determining which of them houses the information I need to edit...trial and error has been my method so far, I guess that much will continue. As far as creating new classes, that sounds really interesting, but might be above my pay grade at present, definitely something I'll be happy to research into though. I remember reading that you're gonna be away for the week, anyone else have those links that tracktwo is referencing? The PDF, threads, and projects EDIT: Alright found the thread(Scripting with UDK) and also the related mutator project on github. Can't seem to find the PDF relating to adding variables to existing classes though. Edited July 18, 2015 by Dethraker Link to comment Share on other sites More sharing options...
wghost81 Posted July 18, 2015 Share Posted July 18, 2015 (edited) >Can't seem to find the PDF relating to adding variables to existing classes though.Because it crashes 90% of the time, so no one is ready to write a tutorial yet. :smile: You can find some explanations and examples in PatchUPK readme file. And you will also need to familiarize yourself with UPK data structure (pdf is available for download from UPKUtils nexus page). Personally, I tried this approach several times, but decided not to use it finally. Adding new names to namelist is fine, everything else is just too glitchy. Edited July 18, 2015 by wghost81 Link to comment Share on other sites More sharing options...
Amineri Posted July 18, 2015 Share Posted July 18, 2015 I'm quite happy to see more mods coming on-line -- I think it bodes well for an XCOM 2 modding scene :) Unfortunately vanilla didn't provide us with difficulty/separate FoundryBalance/TechBalance config lines, so to make it as a second wave options might require a bit more finesse to get working. Currently LW has 46 Foundry projects and 75 Tech projects. In both cases this is more than vanilla. You are limited by the enum size (byte) to no more than 255 entries (hence why we got capped at 255 items), but there's some wiggle room still. My suggestions would be to create a new set of tech and foundry projects in the range 128-255. Unfortunately, working up all of the rest of the code to utilize this separate block looks like no small endeavor. I don't think anything is technically impossible, but there may be quite a few coding changes :) Link to comment Share on other sites More sharing options...
Dethraker Posted July 18, 2015 Author Share Posted July 18, 2015 So I'm going to show my inexperience here. How do I create functions through UDK? It looks similar to the worldeditor from warcrat/starcraft, but the terms within have me confused. I can't seem to find where I'm supposed to write in the variables and functions to create a new class for replacement in the .upk files. Link to comment Share on other sites More sharing options...
Dethraker Posted July 18, 2015 Author Share Posted July 18, 2015 I'm quite happy to see more mods coming on-line -- I think it bodes well for an XCOM 2 modding scene :smile: Unfortunately vanilla didn't provide us with difficulty/separate FoundryBalance/TechBalance config lines, so to make it as a second wave options might require a bit more finesse to get working. Currently LW has 46 Foundry projects and 75 Tech projects. In both cases this is more than vanilla. You are limited by the enum size (byte) to no more than 255 entries (hence why we got capped at 255 items), but there's some wiggle room still. My suggestions would be to create a new set of tech and foundry projects in the range 128-255. Unfortunately, working up all of the rest of the code to utilize this separate block looks like no small endeavor. I don't think anything is technically impossible, but there may be quite a few coding changes :smile:Hey Amineri! Good to have your input on the matter, really good to have all of your help so far. I do foresee quite a bit of work both in using UDK to write new functions/variables, as well as Hex Editing to get the game to read my new stuff. So to make sure I'm understanding this correctly, you're agreeing with the others to go with a mutator instead of doing things the way that was used for adding variables in LW? Also, what's the part about the range 128-255? if creating a new set of variables wouldn't I essentially be able to create a full set of 255? The trouble of course having the rest of the program read the new variables. Link to comment Share on other sites More sharing options...
wghost81 Posted July 19, 2015 Share Posted July 19, 2015 I suggested mutators only because you said you needed new variables. But you can still find a way to code your mod completely in hex and using existing classes/variables/functions only. In most of the cases it is possible, but requires a lot of work. First thing you should do, IMO, is to write down a detailed plan on what you want to do and how you want it to be configured. Then look at how it is done currently. After that you will be able to decide which approach to use. Link to comment Share on other sites More sharing options...
Dethraker Posted July 20, 2015 Author Share Posted July 20, 2015 I'm currently going through all the existing code related to how the LW mod utilizes research techs and foundry projects. Also I'm establishing a plan for how I want my tech tree to work, perquisites and such, so I know what I want to edit and how. I could do all that through hex editing, but I like the mutator idea more and more. Only problem being I'm still struggling just with where to start. I understand that I have to still hex edit, but only to call for the new upk/class I create, correct? My issue comes in trying to figure out the UDK. I don't see anything called classes, functions, or anything related. I'm currently reading through the "how to program with UDK" on their site, but from what I'm understanding it sounds like I just write the code in a text editor...sounds too easy so I feel I'm missing something. This is only my 2nd time working with an editor/engine and the first was world editor with Warcraft/Starcraft where I mostly just used existing code/functions to change gameplay. I've done some limited coding/programming but only in class several years ago, and only a small amount when modding Warcraft/Starcraft. Link to comment Share on other sites More sharing options...
Recommended Posts