Ludeon Forums

RimWorld => Mods => Help => Topic started by: jjr on September 24, 2017, 10:57:11 AM

Title: How to make a trader caravan drop certain amount of silvers on ground ?
Post by: jjr on September 24, 2017, 10:57:11 AM
A trader caravan usually consists of a trader, several carriers/packed animals, many guards, and maybe their prisoners. I'm making a JoyGiver for their people such that they should drop some silvers if one of their people followed the corresponding JobDriver.
This would involve 2 key parts:
1)How to check if the caravan has enough silvers(say, larger than k).
2)How to select the pawns with a certain combined total amount of silvers, and make them drop the silvers.

Unfortunately, I don't have many ideas on how to get these things done.
I wrote something like these:
IEnumerable<Pawn> guests = myColonistPawn.map.mapPawns.AllPawnsSpawned.Except(x=>x.Faction==null ||x.Faction==Faction.OfPlayer)
guests=guests.Where(x=>x.trader!=null && x.trader.Goods!=null)

Then,I'm lost... :'(
Title: Re: How to make a trader caravan drop certain amount of silvers on ground ?
Post by: Chicken Plucker on September 26, 2017, 12:11:23 AM
You can assign how much silver you want a caravan to carry, the def file is inside the "TraderKindDefs" there you can determine how much silver a trader would have
Title: Re: How to make a trader caravan drop certain amount of silvers on ground ?
Post by: jjr on September 26, 2017, 09:41:56 PM
Well, what I asked is how to make them drop certain amount of silvers.. It's true one can determine how much silver they would have, but I'm coding c# and try to make them drop a desired number of silvers when members of a caravan perform some jobs in my colony.