i need help compiling a source code mod

Started by Svullo, February 24, 2015, 08:27:44 AM

Previous topic - Next topic

Svullo

i used ILspy to decompile the "assembly-csharp.dll", then i made some tiny changes to skill experience gains (i basically made skills level up faster). but when i try to compile it i get hundreds of errors.

i am using visual studio express 2010, because the 2013 version has expired and won't let me use it anymore, and when i try to log in with my account it gives me an error. does anyone have any idea what the problem is? it is because i'm using the 2010 version of visual studio express? or is it something else.

thanks in advance.

soulkata

Doesnt work like that! You should look for ILSpying help...

You should look at Defs sections and make a mod wich works with the current game, not trying create you own game!

Svullo

i don't understand what you mean. what defs sections? i'm a noob when it comes to modding. all i want to do is change a few things that can't be changed via XML editing. that's why i had to change the source code. so how exactly do i make a dll mod? if you could explain in more detail i would really appreciate it.

Latta

Read sticky: [Tutorial] ( Alpha 8 ) How to make a .dll-mod

It's for Alpha 8, but it remains all same, and explains you from the very beginning: What namespaces to use, what to override, and what is that overrided method doing(like tick()), so on.

For that errors, I think you didn't added your Assembly and Unity dll to the project.

Svullo

i already read that thread. it doesn't really explain anything. i need a step by step tutorial. here's what i've done so far:

1. i decompiled "assembly-csharp.dll".
2. i opened the project using visual studio express 2010.
3. i changed a few variables to make experience increase faster.

now i have no idea what to do. how do i get my changes in the game? could someone please explain?

thank you.

Haplo

Why don't you start with something easier? Like programming some new AI code? :P

Just kidding. But what you want to do is not that easy as you think.
Changing a few variables only works if you have the sourcecode of the game, so that you can recompile it yourself.
As a modder it is a huge load harder to get your code to be accepted by the game.
True there are a few tricks where you can change specific variables in the game, but you need to know exactly what you're doing there.

A small info about how rimworld handles your code:
-You write your code, compile it as a dll and insert it into the Assembly folder of your mod.
-Now when you activate your mod, RimWorld loads the classes into it self.
-At this point you have the code inside RimWorld, but it does absolutely nothing there (except when you use some special classes, but that's as I said, special.)
-Now you have a definition of your stuff somewhere in the xml files in your mod folder.
-RimWorld reads these definitions and, if you've done it correctly, loads your code as an active Building/Thing/Incident/... into the game. There your code works as you want.

The problem that you want to do is copy the source class, change variables and overwrite the source class with your stuff, correct?
That is not possible. It is possible to change some variables with some tricks, but I don't know of a way to suppress a class so that the game uses your class instead of the original class.
I would suggest you start with something simpler to first get some experience how it works until you try something like this..

But that are just my 2 cents of silver  8)

(If someone finds that something I said is utter rubbish, please tell me.)

Svullo

#6
i don't WANT to overwrite the source code or whatever. i just tried that because i thought that's how you're supposed to do it. so how exactly do i make my own dll and get the code into the game? can i copy code from the source code and change the variables and then get the code into the game without overwriting anything? if so, how? and if my code is the same as the source code, will my modded dll take precedence over the game's own source code? anyway, it doesn't matter to me how to do it, just as long as it gets done. i just want to speed up the skill increases, and change the decay rate of skills once you reach a high level. i found the code to do that, and changed it. now i just need to get it into the game. can someone please explain how to do that?

Rikiki

I found Haplo's message very clear. What don't you understand? ???

You CANNOT modify those values. It is hardcoded in the core dll and you can't change it.
The game only accepts extra stuff (like extra apparel: Apparelo, extra pawns:MAI, extra buildings: MMS and so on, or modified core things).

And for the step-by-step tutorial go here and experiment with it then come back to the forum if you have precise questions. :)