[Mod Request] Elite enemies with power armors with up to legendary gear.

Started by N0xiety, December 29, 2015, 07:53:48 PM

Previous topic - Next topic

N0xiety

As i see it there is no enemy out there that wears power armor or has gear over superior quality. I tried modding it myself and found that there are price ranges put for armor and weapon spawning and that seems to be the reason why they can never spawn with power armor. I tried changing these values but it changed nothing. So i am asking experienced modders out there to take a look at it. It should be quite easy to do really but i just couldn't pull it off. If you could also make it so enemies can rarely spawn with power armor in Ice cap maps that would be great. Every enemy seems to be spawning with parka. I mean yeah thats how it should be since they need the cold protection but i want atleast some of the elite units to have power armor instead of their parka which should give them enough cold protection.

Alistaire

PawnKindDef handles item quality through, well, the "itemQuality" tag. Same for costs and apparelTags.

N0xiety

Quote from: Alistaire on December 29, 2015, 07:56:36 PM
PawnKindDef handles item quality through, well, the "itemQuality" tag. Same for costs and apparelTags.

I changed item quality and price ranges and added soldier appareal tag to elite mercenaries which should contain power armor but they still spawn with shitty quality gear and parkas. No power armor. I don't know what i should do now so help would be great.

chp2001

Apparently they'll die to the cold if they use power armor instead of parkas... Maybe you should edit parkas to act like power armor? :D

N0xiety

Quote from: chp2001 on December 29, 2015, 09:54:52 PM
Apparently they'll die to the cold if they use power armor instead of parkas... Maybe you should edit parkas to act like power armor? :D

I allready made it so the power armor protects -100C since it was stupid while a wool parka could protect for -200C... So i am still waiting for help on this, anyone?

Alistaire

You will want to log apparel generation in debug mode. There's a piece of code that decided whether your character has warm enough clothing
by getting the highest value of cold protection on your clothing then checking if that's warm enough and if it isn't the game will let that pawn
wear a parka (always a parka) and to make that happen it will remove any clothing from the pawn that interferes with the parka.

It should show up as "Trying to give free warm layer." in the log and it can be circumvented through the apparelIgnoreSeasons tag which is
one of the checks for adding a parka.

Basically if a pawn has any piece of clothing that isn't completely cold resistant the game will treat its cold resistance value as the overall cold
resistance of its clothing then it'll add a parka which will replace the one piece that is cold resistant (good job Tynan).

N0xiety

Thanks for the help i did it. But now the problem is they never spawn with something over superior. I set them to spawn with good quality gear and they started spawning with awfull - superior quality but doesn't go over superior. What i want to do is to make them ocasionally spawn with exellent while rarely spawning with master and very rarely with legendary loot. Problem is if i set them to spawn with legendary they all spawn with legendary or master quality gear. I want these to be rare but my options seems to be either them not spawning at all with legendary loot or all of them spawning with legendary loot there is no middle point... So how can i do this?

Alistaire

Quality is decided in a gaussian distribution and itemQuality decides the center of it. It's deliberately weighted to the left as 1.5:1.07 then a
random float point is taken and it's rounded to the nearest integer which decides its quality. Setting itemQuality higher makes it easier to
obtain higher qualities:


public enum QualityCategory : byte
{
Awful, =0
Shoddy, =1
Poor, =2
Normal, =3
Good, =4
Superior, =5
Excellent, =6
Masterwork, =7
Legendary =8
}


Going 1.5 down from 4 (Good) gives you Poor/Shoddy while going 1.07 up from 4 gives Superior/Excellent. Gaussian distributions never have
a 0% chance to hit one of the qualities (though the game limits between 0 and 8.5 - which frankly could hit a 9 and break someone's game)
therefore you will see 0 (Awful) when you set itemQuality to Legendary though it will be a very, very small percentage.

I would suggest setting itemQuality to Excellent since it seems to match most of what you want.




Furthermore it is possible to bypass this gaussian to spawn a single pawn by calling a modified PawnGenerator clone. Raids do however call
an iterator block (=IEnumerable =you have to manually decompile this which is a bitch) which calls PawnGenerator and therefore the
existing quality generation.

Another way to fix it would be to add a Comp on your pawns (ensures compatibility with other mods which check for Pawn cause you don't
have to create custom Pawn class) with a PostSpawnSetup() which changes a pawn's weapon quality or even replaces the weapon entirely.
I would suggest doing that since rewriting large portions of code is nobody's favourite.