Ludeon Forums

Ludeon Forums

  • July 02, 2022, 03:31:32 AM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 8 9 [10]
 on: May 26, 2022, 12:44:16 AM 
Started by K4nna - Last post by K4nna
So I used the good syntax, but it doesn't work as I think with the abstract thing and inheritance.
Even the costList I can't do it works...

<xpath>Defs/ThingDef[minifiedDef="MinifiedThing" and (not(comps/li/compClass="CompQuality")) and (not(@Abstract="True")) and (not(thingCategories="BuildingsSecurity")) and costList]</xpath>
Doesn't work   (I tried with only Abstract, or only costList...)

<xpath>Defs/ThingDef[minifiedDef="MinifiedThing" and (not(comps/li/compClass="CompQuality")) and (not(@Name="FurnitureBase")) and (not(thingCategories="BuildingsSecurity")) and (not(@ParentName="BuildingNaturalBase")) and (not(defName="AnimusStone")) and (not(defName="MonumentMarker"))]</xpath>
Works as I want (with additional patch for the 'drape')

 on: May 25, 2022, 04:10:02 PM 
Started by Basker_ville - Last post by Basker_ville
Yes I've been looking through a bunch of classes connected to the web of name generation. The source of the error message is in the NameGenerator class. The relevant section is toward the end of this block:

Code: [Select]

public static string GenerateName(GrammarRequest request, Predicate<string> validator = null, bool appendNumberIfNameUsed = false, string rootKeyword = null, string untranslatedRootKeyword = null)
if (untranslatedRootKeyword == null)
untranslatedRootKeyword = rootKeyword;
string text = "ErrorName";
if (appendNumberIfNameUsed)
for (int i = 0; i < 100; i++)
for (int j = 0; j < 5; j++)
text = GenText.CapitalizeAsTitle(GrammarResolver.Resolve(rootKeyword, request, null, false, untranslatedRootKeyword, null, null, true));
if (i != 0)
text = text + " " + (i + 1);
if (validator == null || validator(text))
return text;
return GenText.CapitalizeAsTitle(GrammarResolver.Resolve(rootKeyword, request, null, false, untranslatedRootKeyword, null, null, true));
for (int k = 0; k < 150; k++)
text = GenText.CapitalizeAsTitle(GrammarResolver.Resolve(rootKeyword, request, null, false, untranslatedRootKeyword, null, null, true));
if (validator == null || validator(text))
return text;
Log.Error("Could not get new name (first rule pack: " + request.Includes.FirstOrDefault<RulePackDef>().ToStringSafe<RulePackDef>() + ")");
return text;

I'm still trying to make sense of what I'm looking at and how exactly it ties together. The Log.Error() seems to be triggered after a few different commands: two if-statements and then a for-loop.
I guess that error is reached when the preceding bits of code fail?

I've no idea how to do anything in your 5th point. Could you point me toward some kind of tutorial or example for one of those things?

 on: May 25, 2022, 12:59:07 PM 
Started by K4nna - Last post by K4nna
I will try it tomorrow, but it's weird, I'm sure that I tried (not(@Abstract="True")).
For costList, I'm not sure if I copied/paste from file or not.

With that I can already do my patch with full compatibility with buildings from mods I think.
If I look for <minifiedDef>MinifiedThing</minifiedDef>, it's because the mod I patch looks for buildings this way (via C#).

Thank you again, I will look about discord another time.

 on: May 25, 2022, 12:21:02 PM 
Started by Basker_ville - Last post by RawCode
1 dnspy (or any other disassembler you like)
2 string search or similar command
3 "Could not get new name"
4 check conditions that cause that specific error string to appear
5 insert trace\debug output directly into classes, or implement runtime patch, or setup debugger

after that you will be able to discover exact cause of that issue and will be able to solve it in efficient manner

special note, it's possible to invoke methods that are not directly related to unity without starting the game, this require some (a lot actually) work to setup, but really useful for errors like this.

 on: May 25, 2022, 11:49:44 AM 
Started by K4nna - Last post by Multistream
Thank you, the syntax is good.
But it doesn't works as intended, I think I have to filter by 'Abstract="True"'
Abstract is an attribute like Name so it needs @ before it, like this:  (not(@Abstract="True")).
In (not(CostList)) you have a wrong capitalisation, its (not(costList)).

So looking at what you want to do, it won't select the desired defs in a number of cases where an abstract base defines <minifiedDef>MinifiedThing</minifiedDef>, and a concrete def that inherits from it defines <compClass>CompQuality</compClass>. They are still separate defs, each one of them is checked individually only, so "and" won't work.
There are still ways to do it almost completely reliably, for example all defs with minifiedDef must have statBases/Mass that is inherited much more rarily, but you would need to add checks if the def is a building because items can also have mass stat. You would probably have to do more than that though.

I recommend asking this question on rimworld discord, the modding channel is very active there. It also has a bot you can access with !xpath command, it lets you instantaneously test what a given xpath will select in vanilla rimworld.

 on: May 25, 2022, 08:48:38 AM 
Started by stars1302 - Last post by AWildman
I'd love to be able to intercept raids while they're travelling to my base.

 on: May 24, 2022, 05:05:23 PM 
Started by Basker_ville - Last post by Basker_ville
Back in 2016 there was a forum post titled: "Could not get new name" endless loop in Vanilla. It was posted here in Mod Bugs but was found to be a vanilla issue. Has this bug reared its ugly head again?

In the parameters of vanilla RimWorld I couldn't replicate this error, but the problem sometimes arises when mods use custom RulePackDefs referenced in CultureDefs or PawnKindDefs. Is this an underlying vanilla issue or a shared mod error?

After a certain buffer number of spawns, when a PawnKindDef is spawned which references a nameMaker/nameMakerFemale (via PawnKindDef) or a pawnNameMaker/pawnNameMakerFemale (via CultureDef), a red error appears in the console. Consecutive spawns past that present more red errors. The first line of the stack trace for one example reads:

Could not get new name (first rule pack: VFEC_NamerPersonClassicalFemale)

Despite the error, the pawn IS named correctly. The trouble is the barrage of red errors in the console.

To replicate:
0. Use either Qux's "Faction Samurai" or "Vanilla Factions Expanded - Classical"
1. Start New Game
2. Debug mode
3. Execute raid with faction...
4. Any of the Roman or Samurai factions (x10000 points)

After that bulk of spawns, this "buffer" will either be almost or slightly overcome. After repeating step 4, the console will be absolutely flooded with red errors.

Full StackTrace (of one VFEC example):

HugsLib Log (after doing step 4 twice):

This error presents itself in several mods: "Vanilla Factions Expanded - Classical" and "Faction Samurai" are two examples, and it's a problem I myself ran into while making a mod. While VFEC and Faction Samurai use CultureDefs to name their units, I tried using CultureDefs, PawnKindDefs, and "Humanoid Alien Race" AlienRace.ThingDefs. I experienced the same issue as the two aforementioned mods with Culture and PawnKind Defs, but the race-based nameGenerator worked as expected with no such error.

Other Notes:
  • The buffer of spawns before any errors are generated. Generally one 10000 pt raid will slightly overcome the buffer, and it can also be overcome by individually spawning pawns. Adding more names in the string text file does not seem to affect this, but when I tried giving a PawnKindDef just one unique name, that PawnKindDef produced an error after just one spawn. Then after adding thousands of more entries to that file, that PawnKindDef still produced an error after only one spawn. Whatever size the buffer, errors don't occur until it is overcome, and then errors occur after every new spawn.
  • While rarely a pawn spawns with the wrong name, the pawn will almost always spawn with the correct name despite this error message.
  • Sometimes this error occurs multiple times per spawn.
  • The error log frequently refers to RulePackDefs for previously spawned units rather than for the unit that was just spawned. I was able to notice this point in my own unreleased mod with a variety of custom PawnKindDefs and RulePackDefs.

One example with VFEC's Central Republic:
First x10000 pt raid
   0 errors out of 108 new pawns
Second x10000 pt raid
   190 errors out of 178 new pawns

"Vanilla Factions Expanded - Vikings" after 15 x10000 point raids does NOT present this error. VFEV just uses pawnNameMaker through a CultureDef to name its units, unlike Faction Samurai and VFEC which use both pawnNameMaker and pawnNameMakerFemale. However, when I tried commenting out VFEC's pawnNameMakerFemale, the very first x10000 point raid uncharacteristically generated 78 red errors out of 174 spawns.

Name Generation - Referring to RulePackDefs:
   CultureDefs use <pawnNameMaker> and <pawnNameMakerFemale>
   PawnKindDefs use <nameMaker> and <nameMakerFemale>
   Races use <nameGenerator> and <nameGeneratorFemale>
*Many mods use <nameGenerator> in Humanoid Alien Races to generate names without this issue.

Normally it would take a long amount of time to hit the spawn buffer, so it's difficult to test this error without using debug mode commands. Has anyone using these mods with a long-running save file experienced this error?

 on: May 24, 2022, 10:53:03 AM 
Started by Basker_ville - Last post by Basker_ville
PawnKindDef fields allow for a lot of customization with variables like forcedHair, fixedGender, etc. but I'd like to also set body types, head tattoos, body tattoos, and facial hair for some custom PawnKindDefs. Is that something that can be done? If not would it be possible to make a comp for PawnKindDef that could achieve the same ends?

 on: May 24, 2022, 06:28:06 AM 
Started by songyj11 - Last post by songyj11
My words can be weird because I use a translator.

1) Circumstances
An error occurred when the pawn created in debug mode or the pawn that first appeared on the map was enslaved.
No mod. Just use Royalty and Ideology DLCs.
I tried reinstalling the game, doing steam integrity check, restoring to default setting, and tested it on other computers.

2) What Happened
An error log has occurred.
Error occurred in both normal play and debug mode.
The error occurred only on the newly appeared pawn before saving. If I load the saved file after the pawn appears, there is no error.

3) Expectation
Error logs should not occur.

4) To enslave pawns created in debug mode or newly created pawns on maps.

5) I want to attach the saved file, but as described, there was no error in the saved file, so I couldn't attach it.

6) Error Logs
When colonist enslave pawn:
JobDriver threw exception in initAction for pawn Joshua driver=JobDriver_EnslavePrisoner (toilIndex=10) driver.job=(PrisonerEnslave (Job_4910) A=Thing_Human36685)
System.NullReferenceException: Object reference not set to an instance of an object
  at RimWorld.Pawn_ApparelTracker.UnlockAll () [0x00000] in <99518a644a3e4a7ea3fde566568df84a>:0
  at RimWorld.GenGuest.EnslavePrisoner (Verse.Pawn warden, Verse.Pawn prisoner) [0x000b5] in <99518a644a3e4a7ea3fde566568df84a>:0
  at RimWorld.InteractionWorker_EnslaveAttempt.Interacted (Verse.Pawn initiator, Verse.Pawn recipient, System.Collections.Generic.List`1[T] extraSentencePacks, System.String& letterText, System.String& letterLabel, Verse.LetterDef& letterDef, Verse.LookTargets& lookTargets) [0x001ff] in <99518a644a3e4a7ea3fde566568df84a>:0
  at RimWorld.Pawn_InteractionsTracker.TryInteractWith (Verse.Pawn recipient, RimWorld.InteractionDef intDef) [0x00186] in <99518a644a3e4a7ea3fde566568df84a>:0
  at RimWorld.Toils_Interpersonal+<>c__DisplayClass11_0.<TryEnslave>b__0 () [0x00041] in <99518a644a3e4a7ea3fde566568df84a>:0
  at Verse.AI.JobDriver.TryActuallyStartNextToil () [0x001de] in <99518a644a3e4a7ea3fde566568df84a>:0
UnityEngine.StackTraceUtility:ExtractStackTrace ()
Verse.Log:Error (string)
Verse.AI.JobUtility:TryStartErrorRecoverJob (Verse.Pawn,string,System.Exception,Verse.AI.JobDriver)
Verse.AI.JobDriver:TryActuallyStartNextToil ()
Verse.AI.JobDriver:ReadyForNextToil ()
Verse.AI.JobDriver:TryActuallyStartNextToil ()
Verse.AI.JobDriver:ReadyForNextToil ()
RimWorld.Toils_Interpersonal/<>c__DisplayClass0_0:<GotoInteractablePosition>b__0 ()
Verse.AI.JobDriver:TryActuallyStartNextToil ()
Verse.AI.JobDriver:ReadyForNextToil ()
Verse.AI.JobDriver:Notify_PatherArrived ()
Verse.AI.Pawn_PathFollower:PatherArrived ()
Verse.AI.Pawn_PathFollower:StartPath (Verse.LocalTargetInfo,Verse.AI.PathEndMode)
RimWorld.Toils_Interpersonal/<>c__DisplayClass1_0:<GotoPrisoner>b__0 ()
Verse.AI.JobDriver:TryActuallyStartNextToil ()
Verse.AI.JobDriver:ReadyForNextToil ()
Verse.AI.JobDriver:DriverTick ()
Verse.AI.Pawn_JobTracker:JobTrackerTick ()

When Use Debug Enslave function:
Root level exception in OnGUI(): System.NullReferenceException: Object reference not set to an instance of an object
  at RimWorld.Pawn_ApparelTracker.UnlockAll () [0x00000] in <99518a644a3e4a7ea3fde566568df84a>:0
  at RimWorld.GenGuest.EnslavePrisoner (Verse.Pawn warden, Verse.Pawn prisoner) [0x000b5] in <99518a644a3e4a7ea3fde566568df84a>:0
  at Verse.DebugToolsPawns.Enslave (Verse.Pawn p) [0x0002f] in <99518a644a3e4a7ea3fde566568df84a>:0
  at Verse.Dialog_DebugOptionLister+<>c__DisplayClass8_0.<DebugToolMapForPawns>b__0 () [0x00063] in <99518a644a3e4a7ea3fde566568df84a>:0
  at Verse.DebugTool.DebugToolOnGUI () [0x00018] in <99518a644a3e4a7ea3fde566568df84a>:0
  at Verse.DebugTools.DebugToolsOnGUI () [0x00007] in <99518a644a3e4a7ea3fde566568df84a>:0
  at RimWorld.UIRoot_Play.UIRootOnGUI () [0x000be] in <99518a644a3e4a7ea3fde566568df84a>:0
  at Verse.Root.OnGUI () [0x0003d] in <99518a644a3e4a7ea3fde566568df84a>:0
UnityEngine.StackTraceUtility:ExtractStackTrace ()
Verse.Log:Error (string)
Verse.Root:OnGUI ()[/size]

 on: May 24, 2022, 05:09:43 AM 
Started by K4nna - Last post by K4nna
So, (not(Abstract="True")) doesn't work. I have almost the same result by using (not(@Name="FurnitureBase")) (only the 'drape' is not patched, without mods). But it could be good to know the syntax for filter Abstract.

Edit: I also search to add a condition 'don't have <CostList>', (not(CostList)) doesn't work :/

Pages: 1 ... 8 9 [10]