Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - rogerbacon

#1
Help / Cure disease code help please
March 09, 2018, 08:43:05 PM
I have the following code that is causing an error.

var treatableInjuries = tracker.pawn.health.hediffSet.hediffs;
                if (treatableInjuries != null && treatableInjuries.Count() > 0)
                {
                    var sleepingSickness = treatableInjuries.FirstOrDefault(x => x.def.defName == "SleepingSickness"); // this line causes an error
                    if (sleepingSickness != null)
                    {
                        tracker.pawn.health.hediffSet.hediffs.Remove(sleepingSickness);
                    }
                }


For testing I've placed it on the Tick() event of the Doorpat mod. I use that for testing code because I can trigger it whenever a pawn walks on the door mat. This process has worked well in the past so I know it is not the problem. For example, the following code works fine


var traitPyro = pawn.story.traits.GetTrait(TraitDefOf.Pyromaniac);
                if (traitPyro != null)
                {
                    pawn.story.traits.allTraits.Remove(traitPyro);
                }


I forget the exact error message; it seemed fairly generic and not useful but I can look it up and post it if nobody can tell what I'm doing wrong from the code I've posted.
Thanks.
#2
When trying to load a game saved with this mod in effect I get the following null reference exception:
Exception in SetupToils (pawn=Angel, job=InstallWeaponOnTurretBase A=Thing_Gun_LMG835009 B=(139, 0, 249)): System.NullReferenceException: Object reference not set to an instance of an object
  at TurretWeaponBase.JobDriver_HaulToCellAndDoWork.Toils_TryToAttachToWeaponBase (Verse.Pawn actor, TargetIndex thingInd, TargetIndex cellInd) [0x00000] in <filename unknown>:0
  at TurretWeaponBase.JobDriver_HaulToCellAndDoWork+<MakeNewToils>d__4.MoveNext () [0x00000] in <filename unknown>:0
  at Verse.AI.JobDriver.SetupToils () [0x00000] in <filename unknown>:0
#3
Is there a way to change from dictatorship to democracy without starting a new colony?
#4
Help / Re: Code to remove a scar?
February 09, 2017, 10:22:33 PM
OK, I found the sample code in the dermal regenerator mod here https://ludeon.com/forums/index.php?topic=14177.0
#5
What is the advantage of using MonoDevlop over something like Visual Studio?
#6
Help / Re: Code to remove a scar?
February 09, 2017, 07:11:17 PM
Quote from: BlackSmokeDMax on February 09, 2017, 06:47:25 PM
You should be able to look in the mod DESurgeries for an example.

I looked at that mod https://ludeon.com/forums/index.php?topic=22120.0 but there is no code ( or dll). It's onbly xml. I also downloaded Medical Complication v0.4.2 and used Agent Ransack to search for any reference to "scar" but found nothing.
#7
Help / Code to remove a scar?
February 09, 2017, 05:45:49 PM
Could someone provide me with an example of code that will remove a scar from a pawn?
#8
How can I place things in the guests' room so they will buy it? I can't figure a way to tell my colonists to pick up something (other than equiping it) and carry it around.
#9
How do you order a colonist to pick up something? I'm not talking about equiping or wearing something. I mean picking up a stack of cloth and dropping it off somewhere, or just carrying it around?
I know they will do it when forming a caravan but how to do it without forming a caravan?
#10
Outdated / Re: [A16] Riot Shield
January 30, 2017, 08:16:04 PM
Thank you JaxelT and Sir Q. I missed the thingClass in the xml file and the fact that apparel has a CheckPreAbsorbDamage as a method. It is all clear now.
#11
Outdated / Re: [A16] Riot Shield
January 29, 2017, 08:53:47 PM
Very nice mod.
I'm curious though where the game calls your code. I've looked at some mods and it seems altered functionality is injected by short-circuiting existing method calls. Your code doesn't have that. How does the game know when to call your code?
#12
Is anyone else getting an XML error on start? Also, how do you craft them? I only get the option to craft a few of the ranged weapons.

Edit. Never mind. I found out how to make the items.
#13
Outdated / Re: [A16] DoorMat
January 12, 2017, 05:43:10 PM
Thanks for this mod. I just started using it (A16) but I'm still getting dirt and, especially, sand.
I added a debug statement after your reflective call to TryDropFilth and it showed my pawns still had sand on them. Is there any way to eliminate the sand?
You can see the problem with Debug.Log(pawn.Name + " stepped on a doormat." + Environment.NewLine + "current filth: " + pawn.filth.FilthReport);

Of course, this assumes you are in a sandy region like I am.