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 - Garwel

#1
I want to share the most epic story that happened to me in RimWorld since I started playing roughly 3 years ago.

I wanted to give myself a challenge. So I played in Tundra. As a tribal. In Naked Brutality. In Ironman mode. To top it off, I use lots of mods to further spice up the experience.

So I started with my lonely colonist, Llama. He was soon joined by Alexandria, who I first captured, then enslaved and then recruited as a colonist. Not long after, the two happily married. There were also other colonists: the colony was growing well, although every winter was a challenge. For a long time, there were no losses (not counting a few prisoners).

Four game years later, Alexandria was attacked by a hungry Megawolverine. Unfortunately, she was far from the base and from other colonists. She fired at the beast and seriously injured it, but didn't have time to escape. She was eaten alive in front of the colonists who were rushing to help, but were too late. Of course, Llama was overwhelmed with grief and from that point, he would often have mental breakdowns.

Another year passed, and the colony survived another winter. In the spring of 5505, Llama had a catatonic breakdown (not his first one since the loss of Alexandria). While he was recovering in an infirmary, a group of 10 guests from a friendly faction showed up, complete with the faction's chief. A couple days later, Lex, one of the colony's veterans, casually tried to convert Tolque, one of the guests, to his ideoligion. Tolque didn't like it and started a social fight.

What began as a little brawl, quickly turned into a brutal, genocidal war. All of Tolque's faction started attacking my colonists, whose two best fighters Llama and Craesky were catatonic and another two rejected any violence at all. In a few minutes, the fight was over: 6 colonists and 3 guests were on the floor of the base, bleeding out. Five their enemies were lurking around the base. Two others, like I said, were in a coma and the only active one, Bry, was incapable of violence and (for now) safe in the hospital (a separate building). Two angry enemies were patrolling the area aroung the hospital and wouldn't let her out. What should I do?

Suddenly, Llama comes back from his catatonic sleep. He was also in the hospital, but he had no weapons! He waited for the enemies to wander some distance from the hospital and, together with Bry, beelines outside the colony's gates. He leaves the door to the killbox open, and one of the enemies runs after Llama and comes under fire from a turret. Together, the two enemies destroy the turret, but its explosion kills one. Meanwhile, Llama set up a spike trap near the exit gate, opens it and runs away. The second enemy (it was Tolque, the one who started the brawl) runs and gets into the trap, dying immediately.

The area outside the base is safe! But inside, the colonists are dying. I manage to rescue two: one was lying outside and another one inside the base, but close to the door. This latter one is Lex. They are now in the hospital. But I don't dare to venture inside the base and face five angry enemies, my former guests. I can only watch helplessly as my colonists bleed out and die.

So what should I do know? Try to storm the base and face off the enemies outnumbered five to one or two (if Lex wakes up)? Or should I wait and see what they will do when they get tired and hungry? Or perhaps abandon this colony, take what I can and travel elsewhere to found a new one? But how can I abandon Craesky, another veteran, who is lying there on the floor of the base, unconscious?
#2
Is there any guide how to add RimHUD presets?
#3
Help / Re: A quick tutorial of xpathing and patching
March 10, 2021, 03:12:57 PM
I'm trying to write a patch to add a comp to all items (i.e. ThingDefs with category set to "Item"). I use what seems to be an obvious solution:
<Operation Class="PatchOperationSequence">
<success>Always</success>
<operations>
<li Class="PatchOperationTest">
<xpath>/Defs/ThingDef[category="Item"]/comps</xpath>
<success>Invert</success>
</li>
<li Class="PatchOperationAdd">
<xpath>/Defs/ThingDef[category="Item"]</xpath>
<value>
<comps/>
</value>
</li>
</operations>
</Operation>
<Operation Class="PatchOperationAdd">
<success>Always</success>
<xpath>/Defs/ThingDef[category="Item"]/comps</xpath>
<value>
<li>
<compClass>DestroyItem.CompDestructible</compClass>
</li>
</value>
</Operation>


However, it mysteriously only applies to few items such as Apparel_ShieldBelt. I also tried to target abstract ThingDefs (e.g. with @Name="ApparelBase"), but the result is the same. Any ideas?

PS: I did some research and found that this code actually kind of works. But there are some ThingDefs it won't affect no matter what you do, because they are apparently not present in any XML files and are generated dynamically by the game. These include various types of meat, corpses, skill trainers etc. So I had to use C# instead to add the comp in code:
foreach (ThingDef def in DefDatabase<ThingDef>.AllDefs.Where(def => typeof(ThingWithComps).IsAssignableFrom(def.thingClass) && def.category == ThingCategory.Item).ToList())
    def.comps.Add(new CompProperties(typeof(CompDestructible)));

It seems to work ok.
#4
Ideas / Re: Private property in RimWorld
March 10, 2021, 03:02:43 PM
Quote from: Hilvon1984 on March 03, 2021, 06:30:31 AM
Well... obvious question:
If a pawn gets beaten senseless and has to spend days in bed, who is paying for their food?
Like in a real world, there are various options. The colony ("government") may pay for their food and medicine while they are downed/sick (in other words, they won't be charged for that). Or they can be given a loan that they'll have to repay later.
#5
Ideas / Private property in RimWorld
February 12, 2021, 07:07:32 AM
The economy of a RimWorld colony is effectively "primitive communism": everything belongs to the commune (and managed by the player), which has total control over both production and consumption. So your colonist doesn't even own the shirt they are wearing or the meal they are eating. This is roughly the way prehistoric societies were organized (and some modern-day primitive tribes still are).

I have a concept of a mod that would overhaul this system to bring in a bit more private property, specifically personal property, and some elements of markets. This might work like this:

- Every pawn has some virtual money ("credits") that don't directly correspond with silver but are used for internal exchange.

- Pawns pay credits to the colony for consuming items, putting on clothes etc. If they return the item, they are paid back.

- Pawns can earn money by doing work. Instead of assigning priorities to different work types, you set their pay rates, either per hour, per work unit or something like that. There may also be other sources of income, e.g. some minimum daily wage.

This may also be extended with ownership of furniture, rooms or other items, family-owned property etc.

This system is still not capitalism, because all the means of production (and all produce) would be owned by the colony. It would be closer to socialism as existed in the USSR and other Eastern Bloc countries. But at least it would create a more interesting and dynamic economy and open up completely new ways of managing the colony.

What do you think? Would such an overhaul be interesting? What would you add or change?
#6
Help / Re: Handling Button (widget) clicks
July 23, 2020, 12:33:34 PM
Quote from: LWM on July 23, 2020, 11:52:01 AM
Look at any of the Dialog_.... classes in RimWorld (you've decompiled the code,yes?)

It's all

if (Widgets.ButtonText()) {...do soemthing }


Go look at the Dialog_....windows anyway - it's a useful way to see what you can do easily.

PS - if you want to do fancy things or highlighting, you probably don't want listing_standards.
Thanks, you ninja'd me.
#7
Help / Re: Handling Button (widget) clicks
July 23, 2020, 12:30:15 PM
I also figured it out. Here is the code:

class MyTabWindow : MainTabWindow
{
  void DoSomething()
  { ... }

  public override void DoWindowContents(Rect inRect)
  {
    if (Widgets.ButtonText(inRect, "Click me"))
      DoSomething();

  }
}
#8
Help / Handling Button (widget) clicks
July 23, 2020, 03:30:05 AM
I have what looks like a basic question: how do you process a click on a button (the Widgets.Button or Listing_Standard.Button)? Most APIs have something like an onClick event that you provide when creating the button, but not RimWorld.

In other words, let's say I have this code:

class MyTabWindow : MainTabWindow
{
  void DoSomething()
  { ... }

  public override void DoWindowContents(Rect inRect)
  {
    Widgets.ButtonText(inRect, "Click me");
  }
}


How, do I make it so that when the user clicks the "Click me" button, DoSomething() is called?
#9
Help / Re: How to change pawn's work effectiveness
June 11, 2020, 11:15:39 AM
I figured it out myself. Just in case someone needs it too, here is a quick explanation:

1. Create a class that extends StatPart, e.g.:
public class StatPart_MyClass : StatPart

2. Override its two methods: ExplanationPart and TransformValue

3. In ExplanationPart, return a string that will show the player how this modifier affects the value. Like this:
public override string ExplanationPart(StatRequest req) => "My modifier: x1.50";

4. In TransformValue, modify the provided value as needed, e.g.:
public override void TransformValue(StatRequest req, ref float val) => val *= 1.5f;

5. Add your class to a part via an XML patch (it should go into Patches folder in your mod's folder):
<?xml version="1.0" encoding="utf-8" ?>
<Patch>
   <Operation Class="PatchOperationAdd">
      <xpath>/Defs/StatDef[defName="WorkSpeedGlobal"]/parts</xpath>
      <value>
         <li Class="MyNamespace.StatPart_MyClass"/>
      </value>
   </Operation>
</Patch>


And you're good to go!
#10
Help / How to change pawn's work effectiveness
June 11, 2020, 05:21:21 AM
Hi there. I'm looking for a way to dynamically (from C#) change effectiveness of certain jobs done by a pawn (a colonist, if it matters). For instance, I want to add a modifier to a pawn that will make it cook (or harvest plants, or perform operations) better than it normally does, but without permanently changing their skill. How can I do it?