Ludeon Forums

RimWorld => Mods => Help => Topic started by: Alistaire on January 26, 2015, 01:37:24 PM

Title: Pila dilemma
Post by: Alistaire on January 26, 2015, 01:37:24 PM
Hello,

I want to use the vanilla pila in a faction mod, but I don't want the greatbow or bow. How would I make it so that a certain unit ONLY uses the pila from the NeolithicRanged weaponTag? If that's not possible, should I make my mod overwrite the basegame pila so it uses a weaponTag, and how would that work best? If neither is a good option, should I make a 100% copy of the pila and use that? If none of these are an option, should I add a heavy pila weapon instead, as substitute?

Yup. I really want a pila in my mod.
Title: Re: Pila dilemma
Post by: Alistaire on January 27, 2015, 09:58:44 AM
Alright, so currently I've fixed it by giving my PawnKinds the exact amount of silver to buy Pila. They cost 60, and are luckily the only NeolithicRanged that cost that exact amount of marketValue.

However. I want my pawns to be able to carry a Gladius too, which they can't with the current setup. I don't know how I could get the game to ONLY spawn Gladius or Pila without it being able to spawn any other melee weapon, without overwriting their vanilla ThingDefs.
Title: Re: Pila dilemma
Post by: Rikiki on January 27, 2015, 11:13:35 AM
I believe you have to put a specific tag in your custom weapons definition and put the same tag in your custom pawn definition.

i.e.:
=> in your weapon ThingDef

    <weaponTags>
      <li>MyCustomWeaponTag</li>
    </weaponTags>

and
=> in your PawnKindDef

<PawnKindDef>
<defName>MyCustomFactionWarrior</defName>
<label>warrior</label>
<race>Human</race>
<pointsCost>38</pointsCost>
[...]
<weaponMoney>
<min>20</min>
<max>200</max>
</weaponMoney>
<weaponTags>
<li>MyCustomWeaponTag</li>
</weaponTags>
</PawnKindDef>
Title: Re: Pila dilemma
Post by: Alistaire on January 27, 2015, 11:28:29 AM
Yes, but I want to use only the vanilla Pila and nothing else from the NeolithicRanged weaponTag, and the Gladius and nothing else from the Melee weaponTag.
Title: Re: Pila dilemma
Post by: SlimeCrusher on January 27, 2015, 11:37:52 AM
What i would do:
Copy the "Weapons_Melee.xml" and paste it on your ThingDefs folder, delete every weapon that isn't the pila and gladius, then change the name of both to something different, for example "Melee_Pilatwo" and "Melee_Gladiustwo", then add the weaponTags to those 2 "new" weapons.
You can save alot of trouble doing that, but you will have 2 pilas and 2 gladius, wich shouldn't be a problem if they have the same damage values and that stuff.
Title: Re: Pila dilemma
Post by: Alistaire on January 29, 2015, 12:13:28 PM
Would that make the game add a second Pila and Gladius entry to a stockpile's list of weaponry? If there's anything like that going on I'd rather make both a different kind of weapon entirely, like "Military Pila" and "Military Gladius". Or, if it won't completely break compatibility, I would overwrite the base weapons.
Title: Re: Pila dilemma
Post by: skullywag on January 29, 2015, 12:19:19 PM
cant you add a new weapontag to the weapons you want and make your faction pick from only that new weapontag? it means overwriting the core weapons but you are only adding a weapon tag..
Title: Re: Pila dilemma
Post by: Alistaire on January 30, 2015, 10:34:50 AM
Another problem I found is that the Gladius is part of the Midworld techlevel, and the Pila are part of the Neolithic techlevel, which means one pawnkind from one faction would never be able to use both. How would one deal with that?
Title: Re: Pila dilemma
Post by: skullywag on January 30, 2015, 12:11:55 PM
if you create a new weapon tag and add it to both weapons can you not make your faction pick from that category. I could be wrong but this seems really easy if you are willing to overwrite the originals (which isnt a bad thing)
Title: Re: Pila dilemma
Post by: Alistaire on January 30, 2015, 12:19:56 PM
Yes, but if my faction is Neolithic it won't use Midworld items and if it's Midworld it won't use Neolithic items. I want it to use both, and if I added either of them to another techlevel it would make it impossible for certain pawns from certain factions to use a Pila or a Gladius.
Title: Re: Pila dilemma
Post by: skullywag on January 30, 2015, 12:29:45 PM
cant you make your faction use a new made up category, im not near the code so cant check how its held together.
Title: Re: Pila dilemma
Post by: Alistaire on January 31, 2015, 10:03:41 AM
Alright, so I think I've fixed it now:


So in the end I had to override vanilla code, add my own substitute Pila, use a custom techLevel and custom weaponTags.

Thanks for the help, every single bit helped towards this solution!