Can someone check over my mod?

Started by IndustryStandard, June 19, 2017, 02:43:06 AM

Previous topic - Next topic

IndustryStandard

I apologize if this isn't the place to ask for this. It's 2:30am and I'm super exhausted.

I am trying to take a better crack at modding, and I simply added a "Luger" to the game following this wiki http://rimworldwiki.com/wiki/Modding

And referencing other weapon mods.

With my initial test I managed to get no errors in the dev console, the weapon appears with pirate raids, can be crafted and overall seems to work.

However if a better/easier way to write the mod exists, or I missed something crucial, or any other odd thing. I'd like to know.

The mod is not meant to ever see the light of day, just to tinker and mess with for personal usage until I can do something more proper. I'd like to figure out how to change sounds, adjust crafting time/resources, and maybe make it hidden behind a research wall. Like having colonist require something researched before creating it.

Again, apologies if this is wrong area or bad to ask. If anyones bored give the mod a check if you want.

[attachment deleted by admin due to age]

jamaicancastle

One change I would make, though it's not critical: you don't need to include copies of core abstracts in your mod (and it's probably better not to, if only to avoid the slight chance of accidentally making changes to them). In your case that would be the four blocks above the === line.

I don't know if the tutorial covered this, but you can find all of the core XML in Rimworld/Mods/Core/Defs (if you're using a Steam install, this folder is in Steam/SteamApps/common/; if not, you'll have to dig it up on your own). The subfolders are pretty self-explanatory. If you're ever curious about how to duplicate or modify a property of some in-game object, looking up its def is a good place to start.

For instance, let's take research as an example. If you want your Luger to require a research project, you can start by looking for a core gun that needs research, such as the charge rifle. If you look in ThingDefs_Misc -> Weapons_Guns and search for the charge rifle def, you'll see it has this section which the pistol lacks:
  <recipeMaker>
    <researchPrerequisite>ChargedShot</researchPrerequisite>
  </recipeMaker>


This is exactly what's needed to add a research requirement to the recipe. (The recipeMaker block is used by a special piece of code that automatically writes recipes for craftable items, saving you from having to do it yourself. You could also custom-make a recipeDef if you wanted to, but in this case there's not much point.) Inside the tag is the defName of the research project you want to require. If you want a different one, or to add your own, you can find them in the ResearchProjectDefs folder, as you might expect.

Using this same kind of process, you can usually tease out the in-game effect of most fields, and vice-versa (although a lot of more complex objects, buildings especially, have associated C# code that's much harder to get at).

IndustryStandard

That's basically what I did, look at the core defs and carry over. Surprisingly learn a lot from doing it.

I can't find any tutorials regarding sounds, would you happen to know if adding sounds to the gun would be as simple as throwing them into the sounds folder I have and having the Luger use those?

Fregrant

You need to write a file for sounds too, look into Core\Defs\SoundDefs