Question about <skillRequirements>

Started by rhtstm, August 11, 2016, 07:37:41 PM

Previous topic - Next topic

rhtstm

Hello!
Is there a way to add a specific level requirement for using a weapon?
Tried to add these lines into a weapon's RecipeDef file but colonist below that min Level can also use the weapon.

<skillRequirements>
<li>
    <skill>Shooting</skill>
    <minLevel>5</minLevel>
</li>
</skillRequirements>


Anything I missed in the code? Or is there another way to do it?
Thanks!

robotguy4

#1
I'm pretty sure it doesn't work like that. I'm pretty sure skillRequirements only works for RecipeDefs. That's what the XML Auto-Documentation is telling me, at least.

It's likely you'll need a DLL mod for this and maybe detours.

EDIT: RecipeDef generally refers to the recipe for MAKING an item, not using it. If I'm reading it right, all you did was make it so only colonists with a shooting level above 5 can CRAFT it. You probably want to look at the ThingDefs for the actual item's XML file, but I don't think there's a minimum level portion in Vanilla. If there isn't one already implemented in vanilla, DLLs and probably detours would be needed.

EDIT2: It may also depend on the weapon. Is this a vanilla gun? If it is then you'll probably want to look at the ThingDef. If it isn't, we might need more info depending on what mod it is from. Depending on what kind of mod it is, things might be handled differently.

rhtstm

Quote from: robotguy4 on August 11, 2016, 07:51:32 PM
I'm pretty sure it doesn't work like that. I'm pretty sure skillRequirements only works for RecipeDefs. That's what the XML Auto-Documentation is telling me, at least.

It's likely you'll need a DLL mod for this and maybe detours.

EDIT: RecipeDef generally refers to the recipe for MAKING an item, not using it. If I'm reading it right, all you did was make it so only colonists with a shooting level above 5 can CRAFT it. You probably want to look at the ThingDefs for the actual item's XML file, but I don't think there's a minimum level portion in Vanilla. If there isn't one already implemented in vanilla, DLLs and probably detours would be needed.

EDIT2: It may also depend on the weapon. Is this a vanilla gun? If it is then you'll probably want to look at the ThingDef. If it isn't, we might need more info depending on what mod it is from. Depending on what kind of mod it is, things might be handled differently.

Yeah..I also thought that would be a dll thing. Thanks!