Rather odd as it seems some sieges dont have a problem, but I get this error:
I assume it has something to do with some sort of higher tier weapon selection as, really low point stuff doesnt have an issue and will spawn sometimes.
NullReferenceException: Object reference not set to an instance of an object
at Verse.Pawn_EquipmentTracker.AddEquipment (Verse.ThingWithComps newEq) [0x00000] in <filename unknown>:0
at RimWorld.PawnWeaponGenerator.TryGenerateWeaponFor (Verse.Pawn pawn) [0x00000] in <filename unknown>:0
at Verse.PawnGenerator.GeneratePawn (Verse.PawnKindDef kindDef, RimWorld.Faction faction, Int32 tries) [0x00000] in <filename unknown>:0
at Verse.Dialog_DebugActionsMenu+<DoListingItems_GameModeMap>c__AnonStorey2A7.<>m__417 () [0x00000] in <filename unknown>:0
at Verse.DebugTool.DebugToolOnGUI () [0x00000] in <filename unknown>:0
at Verse.DebugTools.DebugToolsOnGUI () [0x00000] in <filename unknown>:0
at RimWorld.UIRoot_Map.UIRootOnGUI () [0x00000] in <filename unknown>:0
at Verse.Root.OnGUI () [0x00000] in <filename unknown>:0
(Filename: Line: -1)
NullReferenceException: Object reference not set to an instance of an object
at Verse.Pawn_EquipmentTracker.AddEquipment (Verse.ThingWithComps newEq) [0x00000] in <filename unknown>:0
at RimWorld.PawnWeaponGenerator.TryGenerateWeaponFor (Verse.Pawn pawn) [0x00000] in <filename unknown>:0
at Verse.PawnGenerator.GeneratePawn (Verse.PawnKindDef kindDef, RimWorld.Faction faction, Int32 tries) [0x00000] in <filename unknown>:0
at Verse.Dialog_DebugActionsMenu+<DoListingItems_GameModeMap>c__AnonStorey2A7.<>m__417 () [0x00000] in <filename unknown>:0
at Verse.DebugTool.DebugToolOnGUI () [0x00000] in <filename unknown>:0
at Verse.DebugTools.DebugToolsOnGUI () [0x00000] in <filename unknown>:0
at RimWorld.UIRoot_Map.UIRootOnGUI () [0x00000] in <filename unknown>:0
at Verse.Root.OnGUI () [0x00000] in <filename unknown>:0
(Filename: Line: -1)
Exception filling window for Verse.Dialog_DebugOptionListLister: System.NullReferenceException: Object reference not set to an instance of an object
at Verse.Pawn_EquipmentTracker.AddEquipment (Verse.ThingWithComps newEq) [0x00000] in <filename unknown>:0
at RimWorld.PawnWeaponGenerator.TryGenerateWeaponFor (Verse.Pawn pawn) [0x00000] in <filename unknown>:0
at Verse.PawnGenerator.GeneratePawn (Verse.PawnKindDef kindDef, RimWorld.Faction faction, Int32 tries) [0x00000] in <filename unknown>:0
at RimWorld.PawnGroupMaker+<GenerateArrivingPawns>c__Iterator81.MoveNext () [0x00000] in <filename unknown>:0
at RimWorld.PawnGroupMakerUtility+<GenerateArrivingPawns>c__Iterator82.MoveNext () [0x00000] in <filename unknown>:0
at System.Collections.Generic.List`1[Verse.Pawn].AddEnumerable (IEnumerable`1 enumerable) [0x00000] in <filename unknown>:0
at System.Collections.Generic.List`1[Verse.Pawn]..ctor (IEnumerable`1 collection) [0x00000] in <filename unknown>:0
at System.Linq.Enumerable.ToList[Pawn] (IEnumerable`1 source) [0x00000] in <filename unknown>:0
at RimWorld.IncidentWorker_Raid.TryExecute (RimWorld.IncidentParms parms) [0x00000] in <filename unknown>:0
at Verse.Dialog_DebugActionsMenu.DoRaid (RimWorld.IncidentParms parms) [0x00000] in <filename unknown>:0
at Verse.Dialog_DebugActionsMenu+<DoListingItems_GameModeMap>c__AnonStorey2A0+<DoListingItems_GameModeMap>c__AnonStorey29C+<DoListingItems_GameModeMap>c__AnonStorey29E+<DoListingItems_GameModeMap>c__AnonStorey29F.<>m__42E () [0x00000] in <filename unknown>:0
at Verse.Dialog_DebugOptionLister.DrawDebugAction (System.String label, System.Action action) [0x00000] in <filename unknown>:0
at Verse.Dialog_DebugOptionListLister.DoListingItems () [0x00000] in <filename unknown>:0
at Verse.Dialog_OptionLister.FillWindow (Rect inRect) [0x00000] in <filename unknown>:0
at Verse.Layer_Window.DoWindowContents () [0x00000] in <filename unknown>:0
(Filename: C:/buildslave/unity/build/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 56)

My XML files for the factions/pawnkinds are as so:
https://www.dropbox.com/s/fb9e4n0z4v79tma/Apparel_MetroHats.xml?dl=0
https://www.dropbox.com/s/umqr0g2gxnzcj9w/Factions_Metro.xml?dl=0
https://www.dropbox.com/s/guauzx595mg3x5b/PawnKind_Metro.xml?dl=0
https://www.dropbox.com/s/mh142ucgx1hywon/Weapons_Explosives.xml?dl=0
https://www.dropbox.com/s/udpv4vyrbl38xcu/Weapons_Guns.xml?dl=0
https://www.dropbox.com/s/cew9euiw0hdn0jl/Weapons_Melee.xml?dl=0
Whats the cost of the items its trying to add to the pawns? is there any scope where it wouldnt find at least at one item in an allowed category?
Quote from: skullywag on June 13, 2015, 12:23:42 PM
Whats the cost of the items its trying to add to the pawns? is there any scope where it wouldnt find at least at one item in an allowed category?
There was some issues previously where it notified me that their minimum spendings were set too low on some of the classes to get the cheapest weapon avail to them, I fixed that.
I could try setting their min maxes both really high to see what happens further though. There is something odd related going on, because, if you spawn like a really cheap poor equipped raid by like the cultists or satanists, theres no problem.
EDIT: So the more points given to the raid the less likely it is to work. 25PT raids work most of the time regaurdless of faction, 8k raids don't ever work. I gave them all way higher price counts though and that didn't help. I've added all the thingdef XMLs to OP.
Directly spawning pawn types does not have any issues.
Ok so a little debugging with the live code and ive narrowed it down to:
public static void TryGenerateWeaponFor(Pawn pawn)
{
if (pawn.kindDef.weaponTags == null || pawn.kindDef.weaponTags.Count == 0)
{
return;
}
if (!pawn.RaceProps.ToolUser)
{
return;
}
float weaponMoney = pawn.kindDef.weaponMoney.RandomInRange;
IEnumerable<ThingStuffPair> source =
from w in PawnWeaponGenerator.potentialWeapons
where w.Price <= weaponMoney && (pawn.Faction == null || pawn.Faction.def.techLevel.CanSpawnWithEquipmentFrom(w.thing.techLevel)) && pawn.kindDef.weaponTags.Any((string tag) => w.thing.weaponTags.Contains(tag))
select w;
if (!source.Any<ThingStuffPair>())
{
return;
}
ThingStuffPair thingStuffPair = source.RandomElementByWeight((ThingStuffPair w) => w.Commonality * w.Price);
ThingWithComps thingWithComps = (ThingWithComps)ThingMaker.MakeThing(thingStuffPair.thing, thingStuffPair.stuff);
PawnGenerator.PostProcessGeneratedGear(thingWithComps, pawn);
pawn.equipment.AddEquipment(thingWithComps);
}
Its getting to the last line of that without an object somehow (it shouldnt obv), the debug_ stuff is a red herring due to how the raid was spawned. Im gonna keep going and see if i cant find how its breaking here.
Quote from: skullywag on June 13, 2015, 01:49:12 PM
Ok so a little debugging with the live code and ive narrowed it down to:
public static void TryGenerateWeaponFor(Pawn pawn)
{
if (pawn.kindDef.weaponTags == null || pawn.kindDef.weaponTags.Count == 0)
{
return;
}
if (!pawn.RaceProps.ToolUser)
{
return;
}
float weaponMoney = pawn.kindDef.weaponMoney.RandomInRange;
IEnumerable<ThingStuffPair> source =
from w in PawnWeaponGenerator.potentialWeapons
where w.Price <= weaponMoney && (pawn.Faction == null || pawn.Faction.def.techLevel.CanSpawnWithEquipmentFrom(w.thing.techLevel)) && pawn.kindDef.weaponTags.Any((string tag) => w.thing.weaponTags.Contains(tag))
select w;
if (!source.Any<ThingStuffPair>())
{
return;
}
ThingStuffPair thingStuffPair = source.RandomElementByWeight((ThingStuffPair w) => w.Commonality * w.Price);
ThingWithComps thingWithComps = (ThingWithComps)ThingMaker.MakeThing(thingStuffPair.thing, thingStuffPair.stuff);
PawnGenerator.PostProcessGeneratedGear(thingWithComps, pawn);
pawn.equipment.AddEquipment(thingWithComps);
}
Its getting to the last line of that without an object somehow (it shouldnt obv), the debug_ stuff is a red herring due to how the raid was spawned. Im gonna keep going and see if i cant find how its breaking here.
Hm, and like I said, I went and tried spawning every pawn type on it's own about 30 times, no issues at all generating gear, or spawning. There's some really weird cross issue going on somewhere.
ok so does it with just 1 faction with 1 pawnkind in it....continuing...
edit - doesnt do it if you change the weapontags to "gun" (i.e. back to core weapons) it must be some kind of logic error where it gets no results for weapons it can use or something...continuing...
Interestingly enough, If I set the pawn kinds to grab from the overarching MetroGun tag instead of their specific class tags that are attributed to each weapon, I get errors on some of the pawn spawns but not all of them.
NullReferenceException: Object reference not set to an instance of an object
at Verse.Pawn_EquipmentTracker.AddEquipment (Verse.ThingWithComps newEq) [0x00000] in <filename unknown>:0
at RimWorld.PawnWeaponGenerator.TryGenerateWeaponFor (Verse.Pawn pawn) [0x00000] in <filename unknown>:0
at Verse.PawnGenerator.GeneratePawn (Verse.PawnKindDef kindDef, RimWorld.Faction faction, Int32 tries) [0x00000] in <filename unknown>:0
at Verse.Dialog_DebugActionsMenu+<DoListingItems_GameModeMap>c__AnonStorey2A7.<>m__417 () [0x00000] in <filename unknown>:0
at Verse.DebugTool.DebugToolOnGUI () [0x00000] in <filename unknown>:0
at Verse.DebugTools.DebugToolsOnGUI () [0x00000] in <filename unknown>:0
at EdB.Interface.UIRoot_Map.UIRootOnGUI () [0x00000] in <filename unknown>:0
at Verse.Root.OnGUI () [0x00000] in <filename unknown>:0
(Filename: Line: -1)EDIT: Actually this happens for them regardless of which tag I use, maybe one gun is broken or something.
EDIT2: I have narrowed it down, there is something broken in the grenades/melee things. Well. It stops the single pawn errors from happening, but raids still break. NVM
EDIT3: Okay so if I replace their metroclass weapon tag in pawnkinds with gun, the error happens a shitload, if I then remove the melee/explosive and keep it to only gun, it doesn't happen at all. Seems like some sort of issue with multiple tag choices? That doesn't make any sense though. If you use JUST the class it happens a lot more rarely. Using JUST MetroGun had an issue earlier, and now with Bandits it's not an issue, I don't even.
EDIT4: Using JUST MetroGun for pawnkind weapon tags allowed an 8000 raid to finally happen, also what a drop point
hmm so if i have 1 pawn kind in the faction and have that pawn kind use metrogun and remove the lower level guntag and just use metrogun on the weapon itself I am not getting the error (or its very rare, spawned about 30 8000 point raids and no errors)
So the way the xml works as it works its way back up through its parents its adding the weapontags so is there an issue with multiple weapon tags, does core have multiples?...
edit - haha yeah my surface pro 3 is VERY hot right now after 30 raids loaded up, decided to spawn in a friendly 8000 pointer and let them go to town, was a good fight.
Quote from: skullywag on June 13, 2015, 03:06:41 PM
hmm so if i have 1 pawn kind in the faction and have that pawn kind use metrogun and remove the lower level guntag and just use metrogun on the weapon itself I am not getting the error (or its very rare, spawned about 30 8000 point raids and no errors)
So the way the xml works as it works its way back up through its parents its adding the weapontags so is there an issue with multiple weapon tags, does core have multiples?...
edit - haha yeah my surface pro 3 is VERY hot right now after 30 raids loaded up, decided to spawn in a friendly 8000 pointer and let them go to town, was a good fight.
lol yeah I had some huge fights with sieges and then got a bunch of sandbag building errors but I assume that's probably what happens when 200 guys against 200 fight near the construction area.
The factions can use multiple pawn types there's no issue there, as long as they just use MetroGun instead of the class tag which is already applied to all weapons via the parent thing.
There must be some sort of issue with multiple tags added to weapons because I wanted to try and seperate the weapons into classes via more specific tags for each and every single weapon(So you didn't have snipers using shotguns and shit like that, heavy troops would stick to the really big shit, etc.), and by trying to use those, there's an issue apparently. Despite my understanding that as long as a person matches just one of the tags he can "grab" it, and multiple tags shouldn't be an issue.
Maybe it's a bug?
EDIT: Core weapons do have their own unique tags too, so I really have no clue. You can see some pawn kinds using it as well, as well as multiple tags.
Well thats how i understood it, perhaps remove the metrogun tag and run with the lower level ones, slightly clunkier but it might get around this issue, would be nice to get Tynan in here and see if he can shed some light on it though.
Hang on core has "gun" and "sniperrifle" the sniperrifle should therefore have 2 tags....right?
Quote from: skullywag on June 13, 2015, 03:20:23 PM
Hang on core has "gun" and "sniperrifle" the sniperrifle should therefore have 2 tags....right?
If you look at the merc pawnkind who uses it, he only uses the sniperrifle tag.
I got rid of the Basehumangun with the weapons tag part and attached all the weapons to just basegun to use the weapon class tags without metrogun being a thing. Works with some pawn classes, but not others it seems.
AHA, ok this is what I think is happening, so 1 faction from your list active with 1 pawnkind from your list in it, that pawnkind is allowed "metroscout" weapons 150-300 cash available. I left only the lowlife weapon available which had both "metroscout" and "metrogun" tags, spawning a raid with this setup results in errors....changing the marketvalue above 150 (as its 120 by default) stops the errors. Gonna continue testing with more weapons and pawn kinds to be sure.
Quote from: skullywag on June 13, 2015, 03:27:36 PM
AHA, ok this is what I think is happening, so 1 faction from your list active with 1 pawnkind from your list in it, that pawnkind is allowed "metroscout" weapons 150-300 cash available. I left only the lowlife weapon available which had both "metroscout" and "metrogun" tags, spawning a raid with this setup results in errors....changing the marketvalue above 150 (as its 120 by default) stops the errors. Gonna continue testing with more weapons and pawn kinds to be sure.
Now that really doesn't make any sense. I get more money then this item so I break?
dammit, now it doesnt do it, this is REALLY inconsistent.
So ive replaced the lolife gun with the sniperrifle and changed the weapon tag to metroscout and the parent to metrogun, I copied the mercenary sniper pawnkind and renamed it mscout, i copied the outlander faction and renamed it hansa and added mscout as its only pawn kind....it still errors...this is the craziest error ive ever experienced in RW.....
Yeah I don't know. I will tweet to tynan or something.
Hey guys, I'm having a bit of trouble following the whole discussion. Can anyone summarize real quick?
1. What's going wrong
2. What you expected to happen
3. What did happen
4. Suggested fix, if there is any
I can release a fix in the upcoming hotfix.
ok so created a new faction (renamed a core one)
created a new pawnkind (again renamed a core one)
Added pawnkind to faction spawn list deleted the rest so its the only one that spawns
Made pawn kind use weapontag "MetroScout"
created a new weapon (copied the sniper rifle)
tagged the new sniper rifle with "MetroScout" it also gets "MetroGun" from the parent (exactly like the sniper rifle where it gets "gun" as well as "SniperRifle")
Spawn high point raid from new faction and it errors.
Change MetroScout to MetroGun in pawnkind def and it works fine.
I think that was it.
Yeah basically as skullywag said,
The game breaks and spits an error while trying to spawn a modded pawn kind in a modded faction, with modded weapons. It has been narrowed down to something very weird going on with weapon tags. This is obviously an issue when trying to start sieges/raids or directly spawning pawns via debug.
Should just spawn/generate properly, as the files have been scrutinized quite enough for any sort of minor errors, hopefully.
After a lot of toying around with the tags, as I've said it's been narrowed down to the use of the weapontags for some reason. I have a bunch of weapons set up with multiple and different tags for each so that, when I say spawn a sniper or a heavy trooper, they are picking from a proper assortment of weapons. For some reason, doing this causes massive errors to break out. If I change all the "class" tags to just the overhead "MetroGun" tag, the game works fine.
This is the equivalent of Using the sniper rifle tag being broken, but then using just gun working perfectly fine. There's something odd happening somewhere and we have yet to figure out why or how to fix it.
Ok, could you just post a zip with the mod that causes the error? I'll just install the mod and debug from there. It's almost certainly some dumb mistake in my code. Thanks.
Quote from: Tynan on June 13, 2015, 09:06:16 PM
Ok, could you just post a zip with the mod that causes the error? I'll just install the mod and debug from there. It's almost certainly some dumb mistake in my code. Thanks.
No problem, thank you as well.
https://www.dropbox.com/s/78tiys1gkgoq8us/MetroT.zip?dl=0
Luckily it's a simple issue. Some of your weapons don't have CompEquippables. I just added a config error check for this. Here's the list for now:
Oh wow, it was something stupid on my part, thanks