Pann Posted February 10, 2018 Share Posted February 10, 2018 I have a functioning profession mod that I intend on releasing soon. I have figured out how to make positive skill traits simple enough. Where I am confused at is how to make new negative traits to help balance out. For example, I'd like to make a skill: Amputee: The person would have their prosthetic, but I'd like to have a negative trait modifier of -2 to axe and blunt skills. If a character chooses it who has positive, it would simply lower it by two, but how would this work with someone who has a 0 start with? With positive traits, you can increase the xp gain of these skills, is there a way to DECREASE the xp gains of these skills and like it to a trait? Link to comment Share on other sites More sharing options...
Fenris_Wolf Posted February 11, 2018 Share Posted February 11, 2018 If you notice, the only traits that provide negative values to skill levels are for fitness and strength, which start at 5. While it is possible to do it, you would have to wait til the character reaches lvl 1, then remove the level. And again a second time. Personally I think your thinking about the trait wrong. Remember both blunt and axes can be swung 1 handed in game. And while prosthetics are fine for simple tasks, swinging weapons is not one of them. Also bear in mind your dealing with 1993 era prosthetics, not modern day. I think a better alternative would be simply limiting the use of weapons. If a weapon requires both hands, for unequip it. If it can be used one handed, but the player equips it in both, force a unequip and equip it one handed only, possibly force unequiping any item that goes into the secondary hand as well, maybe depending on the weight of the item. RealHumanBeing 1 Link to comment Share on other sites More sharing options...
Pann Posted February 11, 2018 Author Share Posted February 11, 2018 55 minutes ago, Fenris_Wolf said: If you notice, the only traits that provide negative values to skill levels are for fitness and strength, which start at 5. While it is possible to do it, you would have to wait til the character reaches lvl 1, then remove the level. And again a second time. Personally I think your thinking about the trait wrong. Remember both blunt and axes can be swung 1 handed in game. And while prosthetics are fine for simple tasks, swinging weapons is not one of them. Also bear in mind your dealing with 1993 era prosthetics, not modern day. I think a better alternative would be simply limiting the use of weapons. If a weapon requires both hands, for unequip it. If it can be used one handed, but the player equips it in both, force a unequip and equip it one handed only, possibly force unequiping any item that goes into the secondary hand as well, maybe depending on the weight of the item. That was simply one example of an optional trait. I am in need of some negative traits to balance out some of the point costs of some of the positive traits and professions I'm adding. From what you are saying - unless a skill starts off in the positive, there is no way currently to make it go in the negative, which I understand. There are several traits that add positive values to xp gain, I'm really looking into how to slow xp gain based on a "flaw". Link to comment Share on other sites More sharing options...
Fenris_Wolf Posted February 11, 2018 Share Posted February 11, 2018 Slowing a xp gain maybe possible using player:getXp():addXpMultiplier(), this is the function called when reading books. http://projectzomboid.com/modding/zombie/characters/IsoGameCharacter.XP.html#addXpMultiplier-zombie.characters.skills.PerkFactory.Perks-float-int-int- It accepts a float value for the multipler, so it seems reasonable enough that you could use a multipler less then 1. I'm unsure if doing something like reading will overwrite the value however, not something I've ever played with. Pann 1 Link to comment Share on other sites More sharing options...
Pann Posted February 14, 2018 Author Share Posted February 14, 2018 Ok Fenris, I've got a question. I've tested this with Dub's Profession mod, and the same issue is springing up. When you select a class with a trait added to it using :addFreeTrait(), a player can select and remove that trait, and then get the points for it refunded. After this, they can then select off of the class, reselect the class, and the trait is available again to be removed. This can be repeated stacking up LOTS of points in the process. Any chance there is a way to make a trait locked onto a profession so that it can't be removed? Link to comment Share on other sites More sharing options...
Fenris_Wolf Posted February 14, 2018 Share Posted February 14, 2018 Yes, sort of..from what I'm reading (in the PZ code)...we'll take a look at the nutritionist trait as our example here. Its a selectable trait, but also comes free with the Fitness Instructor profession. Nutritionist is not one trait, but actually 2. In shared/NPCs/MainCreationMethods.lua: (note I'm looking at the 38.30 build file, so depending on build, line numbers may vary) at line 150, and 151 we can see: TraitFactory.addTrait("Nutritionist", getText("UI_trait_nutritionist"), 4, getText("UI_trait_nutritionistdesc"), false); TraitFactory.addTrait("Nutritionist2", getText("UI_trait_nutritionist"), 0, getText("UI_trait_nutritionistdesc"), true); If we look up the API documention for the addTrait function http://projectzomboid.com/modding/zombie/characters/traits/TraitFactory.html#addTrait-java.lang.String-java.lang.String-int-java.lang.String-boolean- We can see the 4 and 0 are the point costs, and that last true/false argument specifies its a profession trait (can't be removed). So to do it properly you'd need to make a second trait that is given free. This may present problems with some traits such as lucky/unlucky as checking for these traits will be hardcoded in many places in the lua files and possibly java as well. Also note line 305: TraitFactory.setMutualExclusive("Nutritionist", "Nutritionist2"); Specifying you can't have both, once you select fitness instructor, the other nutritionist is removed from the list. And the final line 517 fitnessInstructor:addFreeTrait("Nutritionist2"); Hope it helps Link to comment Share on other sites More sharing options...
Pann Posted February 14, 2018 Author Share Posted February 14, 2018 I thank you for your help. I think I get what I was doing wrong, and will test it. Once I get it working, I'll send you the link to my mod. I appreciate all the help you've been! Fenris_Wolf 1 Link to comment Share on other sites More sharing options...
Fenris_Wolf Posted February 15, 2018 Share Posted February 15, 2018 @Pann I just had a thought that's probably worth sharing... On 2/13/2018 at 5:47 PM, Fenris_Wolf said: So to do it properly you'd need to make a second trait that is given free. This may present problems with some traits such as lucky/unlucky as checking for these traits will be hardcoded in many places in the lua files and possibly java as well. This problem can be by-passed! Taking "Lucky" as a example which we know is hardcoded in all the java and lua. Creating a second trait such as 'Lucky2' that's defined as a occupation trait, all those hardcoded checks of course won't know to look to see if the character has the new Lucky2 trait. The work around is really quite simple, I'm surprised I didn't think of it sooner. Events.OnNewGame.Add(function(player, square) if player:hasTrait("Lucky2") then player:getTraits():remove("Lucky2") player:getTraits():add("Lucky") end end) Link to comment Share on other sites More sharing options...
Pann Posted February 16, 2018 Author Share Posted February 16, 2018 Thanks for the heads up Fenris, and thanks for your advice on the server as well. Your help is invaluable. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now