Pila dilemma

Started by Alistaire, January 26, 2015, 01:37:24 PM

Previous topic - Next topic

Alistaire

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.

Alistaire

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.

Rikiki

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>

Alistaire

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.

SlimeCrusher

#4
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.

Alistaire

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.

skullywag

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..
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

Alistaire

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?

skullywag

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)
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

Alistaire

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.

skullywag

cant you make your faction use a new made up category, im not near the code so cant check how its held together.
Skullywag modded to death.
I'd never met an iterator I liked....until Zhentar saved me.
Why Unity5, WHY do you forsake me?

Alistaire

#11
Alright, so I think I've fixed it now:


  • BaseFactionDefs.xml has a faction with <techLevel>Classical</techLevel> and <spawnGroups><li>Hastatus</li></spawnGroups>;
  • Weapons_Melee.xml defines <defName>MeleeWeapon_GladiusClassical</defName> with <label>gladius</label>, <techLevel>Classical</techLevel> and <weaponTags><li>ClassicalMeleeGladius</li></weaponTags>;
  • Weapons_RangedClassical.xml defines <defName>PilaClassical</defName> with <label>pila</label>, <techLevel>Classical</techLevel> and <weaponTags><li>ClassicalRangedPila</li></weaponTags>;
  • Weapons_VanillaOverrides.xml redefines the <defName>Pila</defName> and <defName>MeleeWeapon_Gladius</defName>'s <label> with <label>javelins</label> and <label>short sword</label>, which should only change the names of these items in-game and shouldn't cause problems;
  • PawnKinds.xml's <defName>Hastatus</defName> uses <weaponTags><li>ClassicalRangedPila</li><li>ClassicalMeleeGladius</li></weaponTags>.

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!