Ludeon Forums

Ludeon Forums

  • August 05, 2021, 06:34:20 AM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2] 3 4 ... 7

Author Topic: [Tutorial] How to Make a RimWorld Mod, Step by Step  (Read 171538 times)

WalkingProblem

  • Colonist
  • ***
  • Posts: 618
  • GOD KING
    • View Profile
    • Mod download and updates!
Re: [Tutorial] How to Make a RimWorld Mod, Step by Step
« Reply #15 on: June 03, 2017, 02:27:04 PM »

Camping

Tynan

  • Developer
  • Administrator
  • Transcendent
  • *****
  • Posts: 12474
    • View Profile
    • Tynan's Blog
Re: [Tutorial] How to Make a RimWorld Mod, Step by Step
« Reply #16 on: June 03, 2017, 11:17:03 PM »

This is really great! But it might be even more useful on the wiki. The wiki is designed as a long-term info repository, while forums are for temporary discussion. If you put it on the wiki, others can also participate it and improve it, or add other tutorials alongside, and so on. Consider wiki-ing it!
Logged
Tynan Sylvester - @TynanSylvester - Tynan's Blog

jecrell

  • Colonist
  • ***
  • Posts: 497
  • Detective
    • View Profile
Re: [Tutorial] How to Make a RimWorld Mod, Step by Step
« Reply #17 on: June 03, 2017, 11:42:51 PM »

This is really great! But it might be even more useful on the wiki. The wiki is designed as a long-term info repository, while forums are for temporary discussion. If you put it on the wiki, others can also participate it and improve it, or add other tutorials alongside, and so on. Consider wiki-ing it!

*glows*

My good man. I'm working right now to convert this beast into Markdown and then I'll put it up on the wiki.

*gets back to work*
Logged
...Psst. Still there? If you'd like to support
me and my works, do check out my Patreon.
Someday, I could work for RimWorld full time!

https://www.patreon.com/jecrell

kaptain_kavern

  • Planetologist
  • ****
  • Posts: 2074
  • started 10 mods in one tick.
    • View Profile
    • RimWorldMod Slack - A place for live chatting about RimWorld modding
Re: [Tutorial] How to Make a RimWorld Mod, Step by Step
« Reply #18 on: June 04, 2017, 12:54:21 AM »

Markdown is more universal even, you know for like ... posterity.

After all of this, When you'll have a bit of free time Jecrell, reminds me to show you the beauty of static site generators like Jekyll. This baby is eating Markdown (or even plaintext) files and outputs you a valid website directly from a github repo for free hosting even ;D

I could also set this up for you. If it can be of any interest for you.
« Last Edit: June 04, 2017, 12:56:05 AM by kaptain_kavern »
Logged

DrGenghis

  • Muffalo
  • *
  • Posts: 2
  • Refugee
    • View Profile
Re: [Tutorial] How to Make a RimWorld Mod, Step by Step
« Reply #19 on: June 04, 2017, 01:06:08 AM »

Having some trouble with this, can't seem to figure out what the problem is and I've gone through the tutorial several times just in case I missed something.

Keep getting these errors.
Code: [Select]
Error CS1061 'ThingDef' does not contain a definition for 'AddHediffChance' and no extension method 'AddHediffChance' accepting a first argument of type 'ThingDef' could be found (are you missing a using directive or an assembly reference?) PlagueGun D:\SteamLibrary\SteamApps\common\RimWorld\Mods\PlagueGun\Source\PlagueGun\PlagueGun\Projectile_PlagueBullet.cs 36 Active
Error CS1061 'ThingDef' does not contain a definition for 'HediffToAdd' and no extension method 'HediffToAdd' accepting a first argument of type 'ThingDef' could be found (are you missing a using directive or an assembly reference?) PlagueGun D:\SteamLibrary\SteamApps\common\RimWorld\Mods\PlagueGun\Source\PlagueGun\PlagueGun\Projectile_PlagueBullet.cs 51 Active
Error CS1061 'ThingDef' does not contain a definition for 'HediffToAdd' and no extension method 'HediffToAdd' accepting a first argument of type 'ThingDef' could be found (are you missing a using directive or an assembly reference?) PlagueGun D:\SteamLibrary\SteamApps\common\RimWorld\Mods\PlagueGun\Source\PlagueGun\PlagueGun\Projectile_PlagueBullet.cs 63 Active
Error CS1061 'ThingDef' does not contain a definition for 'AddHediffChance' and no extension method 'AddHediffChance' accepting a first argument of type 'ThingDef' could be found (are you missing a using directive or an assembly reference?) PlagueGun D:\SteamLibrary\SteamApps\common\RimWorld\Mods\PlagueGun\Source\PlagueGun\PlagueGun\Projectile_PlagueBullet.cs 75 Active

Any help would be much appreciated. Just in case here is a gist with both .cs files and the xml. https://gist.github.com/anonymous/47f35abe717ce37aed28ae952983b3c1
Logged

UncleIROH

  • Drifter
  • **
  • Posts: 37
    • View Profile
Re: [Tutorial] How to Make a RimWorld Mod, Step by Step
« Reply #20 on: June 04, 2017, 01:08:07 AM »

I'm attempting to go through this but the C# file refuses to compile.
The line Visual Studio has issues with is:
Code: [Select]
if (Def != null && hitThing != null && hitThing is Pawn hitPawn) //Fancy way to declare a variable inside an if statement. - Thanks Erdelf.
I've changed it to this to get it to compile:
Code: [Select]
Pawn hitPawn = hitThing as Pawn;
if (this.Def != null && hitPawn != null)

With this change I am able to load up the gun in game equip and fire it. But notarget ever gets the plague. I've even edited the XML and C# AddHediffChance to 0.98f;
Logged

UncleIROH

  • Drifter
  • **
  • Posts: 37
    • View Profile
Re: [Tutorial] How to Make a RimWorld Mod, Step by Step
« Reply #21 on: June 04, 2017, 01:13:26 AM »

@DrGenghis

I was having the same issue. The forum post looks like it might have a mistake in it because it doesn't match the example C# file.

The post has this line:
Code: [Select]
public ThingDef Def
{
     get { return this.def as ThingDef_PlagueBullet; }
}

But it should be:
Code: [Select]
public ThingDef_PlagueBullet Def
{
       get { return this.def as ThingDef_PlagueBullet; }
}

Logged

DrGenghis

  • Muffalo
  • *
  • Posts: 2
  • Refugee
    • View Profile
Re: [Tutorial] How to Make a RimWorld Mod, Step by Step
« Reply #22 on: June 04, 2017, 01:28:27 AM »

@UncleIROH

You rule! Thank you for fixing my problem! Not having any issues with compiling now.
Logged

Spdskatr

  • Colonist
  • ***
  • Posts: 383
  • Practically lives in the Discord server
    • View Profile
Re: [Tutorial] How to Make a RimWorld Mod, Step by Step
« Reply #23 on: June 04, 2017, 03:32:01 AM »

This needs to go on the wiki...
Logged
My mods

If 666 is evil, does that make 25.8069758011 the root of all evil?

jecrell

  • Colonist
  • ***
  • Posts: 497
  • Detective
    • View Profile
Re: [Tutorial] How to Make a RimWorld Mod, Step by Step
« Reply #24 on: June 04, 2017, 04:19:04 AM »

@DrGenghis

I was having the same issue. The forum post looks like it might have a mistake in it because it doesn't match the example C# file.

The post has this line:
Code: [Select]
public ThingDef Def
{
     get { return this.def as ThingDef_PlagueBullet; }
}

But it should be:
Code: [Select]
public ThingDef_PlagueBullet Def
{
       get { return this.def as ThingDef_PlagueBullet; }
}

Bless you fellow RimWorlder and my apologies! I'm not sure how that slipped through.
I fixed it in the post.
Logged
...Psst. Still there? If you'd like to support
me and my works, do check out my Patreon.
Someday, I could work for RimWorld full time!

https://www.patreon.com/jecrell

mrofa

  • Planetologist
  • ****
  • Posts: 1668
  • Squirrel Hunter
    • View Profile
Re: [Tutorial] How to Make a RimWorld Mod, Step by Step
« Reply #25 on: June 04, 2017, 04:38:37 AM »

Some errors are becouse of the unneded dlls in your mods assembly, this is in regard to point 21 of the guide.
Here is my suggestion:
Leave output path as it was ( default "bin\Debug\") and instead use Build Events
In build events use Post-build with xcopy, post build will run its macro after you compile a build(press F7 on default settings)
Code: [Select]
xcopy "YourDllFile" "OutputDirectory" /i /y-YourDllFile is a path and file name
-OutputDirectory full path where the file should end up
-/i if OutputDirectory dont exist it will be created
-/y dont show file override propmpt and auto accept it

Here is how my looks:
Code: [Select]
xcopy "C:\Users\Mrowa\Documents\Visual Studio 2013\Projects\ClutterFurniture\ClutterFurniture\bin\Debug\ClutterFurniture.dll"
"C:\Program Files (x86)\Steam\steamapps\common\RimWorld\Mods\Clutter Furniture\Assemblies" /i /y
Logged
All i do is clutter all around.

UncleIROH

  • Drifter
  • **
  • Posts: 37
    • View Profile
Re: [Tutorial] How to Make a RimWorld Mod, Step by Step
« Reply #26 on: June 04, 2017, 11:14:16 AM »

Anyone get this gun to actually give someone the plague? I've killed bunches of pawns with it, no plague.
Logged

jecrell

  • Colonist
  • ***
  • Posts: 497
  • Detective
    • View Profile
Re: [Tutorial] How to Make a RimWorld Mod, Step by Step
« Reply #27 on: June 04, 2017, 12:42:31 PM »

Anyone get this gun to actually give someone the plague? I've killed bunches of pawns with it, no plague.

You probably forgot to set your ProjectileDef inside the PlagueGun def to your new Bullet def.

Hope that helps you find what you're looking for.

Otherwise, set the hediffChance to 1.0 in XML for 100% chance of giving the plague.
« Last Edit: June 04, 2017, 12:51:02 PM by jecrell »
Logged
...Psst. Still there? If you'd like to support
me and my works, do check out my Patreon.
Someday, I could work for RimWorld full time!

https://www.patreon.com/jecrell

steeveebr

  • Muffalo
  • *
  • Posts: 1
  • Refugee
    • View Profile
Re: [Tutorial] How to Make a RimWorld Mod, Step by Step
« Reply #28 on: June 04, 2017, 12:58:03 PM »

Jecrell,

This is great ty! 

Out of curiosity:  Step 11 states to copy all of the ThingDef Parents and Bases to your XML...

Quote
11) Repeat and copy all of the ThingDef Parents and Bases for Bullet_Pistol and Pistol to your XML file.

And then your code snippet also includes BaseHumanGun.  Is that inclusion necessary?  I don't see it as a parent in either the Pistol Bullet or the Pistol Gun.  If it is necessary how would I determine that while working on another say another "Thing"?

Logged

UncleIROH

  • Drifter
  • **
  • Posts: 37
    • View Profile
Re: [Tutorial] How to Make a RimWorld Mod, Step by Step
« Reply #29 on: June 04, 2017, 02:28:21 PM »

@Jecrell Thanks that was it!
« Last Edit: June 04, 2017, 02:52:29 PM by UncleIROH »
Logged
Pages: 1 [2] 3 4 ... 7