Jump to content

Finding Trait Functions


blackhat91

Recommended Posts

Thank you for taking the time to read this.

 

I am trying to add new traits via a mod and am trying to find the default traits for reference. I found that they are added via MainCreationMethods, but I cannot find where they are called for their function, such as Agoraphobic's panic-inducing function while outdoors. Could anyone point me in the right direction? Thank you.

Link to comment
Share on other sites

Thank you for taking the time to read this.

 

I am trying to add new traits via a mod and am trying to find the default traits for reference. I found that they are added via MainCreationMethods, but I cannot find where they are called for their function, such as Agoraphobic's panic-inducing function while outdoors. Could anyone point me in the right direction? Thank you.

 

You can take a look at my lockpicking mod. It uses traits on the lua side. Creating a new trait is pretty simple:

----- Create custom traits.--local function initTraits()TraitFactory.addTrait("nimblefingers", Lockpicking_Text.traitNimbleFingers, 0, Lockpicking_Text.traitNimbleFingersDescription, true);end ----- Create custom professions.--local function initProfessions()local burglar = ProfessionFactory.addProfession("rm_Burglar", Lockpicking_Text.professionBurglar, "Prof_nk_Burglar");burglar:addFreeTrait("nimblefingers");burglar:addFreeTrait("NightOwl");end

 

Using it in your code can be tricky depending on what you want to do, but here is a simple example:

-- Lower the chance for success for players with the nimblefingers trait.if player:HasTrait("nimblefingers") then    chance = 12;else    chance = 8;end
Link to comment
Share on other sites

Thank you for your replies.

 

@RoboMat:

 

I actually have used your mod, as well as others, as source material for creating my own. It has been very helpful. The issue I'm running into now is not knowing how to call certain functions. For instance, I wish to know how to call a trait when outdoors, when inside, when it is raining, etc. I was hoping to look at the vanilla traits for this, but if @EnigmaGrey is right and they are in Java, I may have issues figuring out those commands.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...