Jump to content

How to Use "self.freeTraits" Option in CharacterCreationProfession.lua


Wveth

Recommended Posts

I see the option there to give my character free traits... but I can't figure out the names of the traits I want (the profession-specific ones) in terms of their coding names, and I don't know the format for spacing them or how that works.

 

Anyone wanna enlighten me?

Link to comment
Share on other sites

%gamedir%\media\lua\shared\NPCs\MainCreationMethods.lua

Line 390: securityguard:addFreeTrait("NightOwl");
Line 421: veteran:addFreeTrait("Desensitized");
Line 432:  lumberjack:addFreeTrait("Axeman");

Something that my notepad++ puked out. Those all are three Profession traits and their names as the game seems to see them. 

Edit: That file is awesome, you can even go and reactivate traits like Light\Heavy Drinker :P You could go and mod the Unemployed profession to give you all profession traits there if you wanted to. And give yourself XP boost to everything when you're at it.
Link to comment
Share on other sites

Thank you!  But I tried adding them and... it doesn't seem to be working?  What would the format be to type them in there?  I've tried some different permutations but I can't figure it out.

Here's a half assed code that could work as a mod

 

require('NPCs/MainCreationMethods');local function initProfessions()	local cheaterman = ProfessionFactory.addProfession("cheaterman", getText("UI_prof_cheaterman"), "profession_cheaterman", 1000);		cheaterman:addFreeTrait("Desensitized");		cheaterman:addFreeTrait("NightOwl");		cheaterman:addFreeTrait("Axeman");endEvents.OnGameBoot.Add(initProfessions);

It adds a profession to the game that gives 1000 free trait points and all profession traits.

You can make a mod just make sure this code is located in media\lua\client\cheaterman.lua part of the mod. UI text is broken but again, half-assed but it works

Link to comment
Share on other sites

You're being so helpful, I hate asking more questions -_-

 

But how exactly would I make this into a mod?  I have no idea.  ^//^

Place Cheaterman folder from within the zip to your C:\Users\%username%\Zomboid\mods folder and activate it within the game.

Also, thank you, now I know how to create custom professions :D

Edit: The mod is as half-assed as the code but it works.

Cheaterman.zip

Link to comment
Share on other sites

I'd like that ten more times if I could.  But now I want to know how to add skill levels to that new profession, like starting with Aiming 3 and the related XP boost for it.  How do you do that?

Version 2 Officially Released - It's still half assed and it still works!

125% Boost to All skills. Served. I'm learning so much :D

Cheaterman V2.zip

Link to comment
Share on other sites

I enjoyed this immensely.  Can I get an "Inspired by Wveth" credit? ^_~

 

If you're interested about your mod though, you missed many skills.  Sprinting, Lightfooted, Nimble, Sneaking, Blade Guard, Blade Maintenance, Blunt Accuracy, Blunt Guard, Blunt Maintenance, Carpentry, and Trapping.

 

EDIT: Or wait, you didn't miss them, according to the .lua file.  Maybe those aren't the right names for them?

 

EDIT EDIT: No they're the right names.  I tried to change the name of the profession, so maybe I borked it up somewhere.

 

EDIT EDIT EDIT: I figured out what I did wrong and now I altered your mod so it's a "Special Forces Veteran" profession with relevant skills only, and got it working.  So this has been a learning experience.  Thanks again!

Edited by Wveth
Link to comment
Share on other sites

I enjoyed this immensely.  Can I get an "Inspired by Wveth" credit? ^_~

 

If you're interested about your mod though, you missed many skills.  Sprinting, Lightfooted, Nimble, Sneaking, Blade Guard, Blade Maintenance, Blunt Accuracy, Blunt Guard, Blunt Maintenance, Carpentry, and Trapping.

 

EDIT: Or wait, you didn't miss them, according to the .lua file.  Maybe those aren't the right names for them?

 

EDIT EDIT: No they're the right names.  I tried to change the name of the profession, so maybe I borked it up somewhere.

 

EDIT EDIT EDIT: I figured out what I did wrong and now I altered your mod so it's a "Special Forces Veteran" profession with relevant skills only, and got it working.  So this has been a learning experience.  Thanks again!

No problem, I learned a lot myself :P

 

And I'll add credit later today when I'm home and not forced to be on mobile ;)

Edit: Added credit on pz-mods page.

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