Jump to content

Trait effects modding?


Jopo80

Recommended Posts

OK, I´m trying to learn how to make new traits and professions.

 

I would need a step-by-step beginner (for dummies) tutorial for coding these effects in lua, so I can get a hang of it.

 

 

For example, here are a few traits and the effects I had in mind;

 

- Rare genes; genetically immune to the zombie infection, a very rare trait or very expensive in points. How would I code the effect?

 

- Epileptic; Epileptic seizures have a random chance of stopping the character in place for say 10-30 sec or slowing him/her down. Can be prevented with antiepileptics (must be taken regularly) or say digitalis tea (forageable natural remedy, toxic if overdosed) There could also be a modifier to seizures, say stress and fatigue would provoke them more easily.

 

- Psychotic; If left unhappy for too long the character has a random chance to become psychotic which would have some nasty effects (any ideas?) like impaired functionality (can´t do many tasks etc.)

 

Profession Trait; Teaching; Can give other characters an xp boost like books with the cost of giving both sides boredom etc. Ideally the teacher would give a higher bonus when his/her skill in the subject is higher, but could only teach as high as his/her own skill level.

 

Any ideas on how to code these, help would be much appreciated.

Link to comment
Share on other sites

OK, I´m trying to learn how to make new traits and professions.

 

I would need a step-by-step beginner (for dummies) tutorial for coding these effects in lua, so I can get a hang of it.

 

 

For example, here are a few traits and the effects I had in mind;

 

- Rare genes; genetically immune to the zombie infection, a very rare trait or very expensive in points. How would I code the effect?

 

- Epileptic; Epileptic seizures have a random chance of stopping the character in place for say 10-30 sec or slowing him/her down. Can be prevented with antiepileptics (must be taken regularly) or say digitalis tea (forageable natural remedy, toxic if overdosed) There could also be a modifier to seizures, say stress and fatigue would provoke them more easily.

 

- Psychotic; If left unhappy for too long the character has a random chance to become psychotic which would have some nasty effects (any ideas?) like impaired functionality (can´t do many tasks etc.)

 

Profession Trait; Teaching; Can give other characters an xp boost like books with the cost of giving both sides boredom etc. Ideally the teacher would give a higher bonus when his/her skill in the subject is higher, but could only teach as high as his/her own skill level.

 

Any ideas on how to code these, help would be much appreciated.

If you're an absolute beginner at lua (as in, you have no idea how to use it), I'd recommend RoboMatts guide found here:

http://theindiestone.com/forums/index.php/topic/61-robomats-modding-tutorials-updated-12112013/

It'll tell you the basics of lua, how to create a mod, and the correct file structure.

 

Anyways, here's some example trait mod lua files:

 

Place this file in a new folder in Client named "Professions".:

require('NPCs/MainCreationMethods');

local function DoTraits()

    TraitFactory.addTrait("exampleTrait", "Example Mod", -1, "Example Description.", false) --[[ "exampleTrait" is the trait ID, which will be important later. "Example Mod" will be the name, "-1" will be how much it costs (negative for added trait points, non-negative for deducted trait points. I don't get it either :P), and "Example Description" will be the tooltip you get when you hover over the trait.

--]]

end

Events.OnGameBoot.Add(DoTraits);

 

Place this one where ever:

local function CheckForTraits()

    if getPlayer():HasTrait("exampleTrait") then --[[ if the player has the trait with the ID "exampleTrait", it'll launch this code --]]

          -- Your code here!

           print("example code!")

    end

end

Events.OnTick.Add(CheckForTraits); -- for every tick it launches the function CheckForTraits

 

If you want a trait to have an image, you must make a new folder in the media folder named "ui".

You will have to name the image something like this: "trait_exampleTrait" exampleTrait will be the trait ID that you're giving the image.The image size for traits is 18x18.

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