bassair Posted September 14, 2015 Share Posted September 14, 2015 So, what I have is... require('NPCs/MainCreationMethods');local function initPersonalTraits() local chronicfatigue = TraitFactory.addTrait("ChronicFatigue", getText("UI_trait_ChronicFatigue"), -5, getText("UI_trait_ChronicFatiguedesc"), false, false); endPersonalTraits.EveryTenMinutes = function() if getSpecificPlayer(0):HasTrait("ChronicFatigue") then getSpecificPlayer(0):getStats():setFatigue(getSpecificPlayer(0):getStats():getFatigue()-0.015); else getSpecificPlayer(0):getStats():setFatigue(getSpecificPlayer(0):getStats():getFatigue()+0.015); end end PersonalTraits.OnGameStart = function()endEvents.OnGameBoot.Add(initPersonalTraits);Events.EveryTenMinutes.Add(PersonalTraits.EveryTenMinutes);Events.OnPlayerUpdate.Add(PersonalTraits.OnPlayerUpdate);Events.OnGameStart.Add(PersonalTraits.OnGameStart);but it doesn't. If I takePersonalTraits.EveryTenMinutes = function() if getSpecificPlayer(0):HasTrait("ChronicFatigue") then getSpecificPlayer(0):getStats():setFatigue(getSpecificPlayer(0):getStats():getFatigue()-0.015); else getSpecificPlayer(0):getStats():setFatigue(getSpecificPlayer(0):getStats():getFatigue()+0.015); end end PersonalTraits.OnGameStart = function()endout the trait will show up! But what I want it to do is make you get hella tired and need to sleep/rest a lot. What am I doing wrong? D: (Also I tried it without the else first. I want it to JUST make you tired until you rest, really, but I was just... trying to make it work o-o) Link to comment Share on other sites More sharing options...
EasyPickins Posted September 14, 2015 Share Posted September 14, 2015 Look in your console when the game starts up for errors. Probably you're missing this:PersonalTraits = {}PersonalTraits.EveryTenMinutes = function()end Link to comment Share on other sites More sharing options...
bassair Posted September 20, 2015 Author Share Posted September 20, 2015 I adjusted that in my code and it boots now! The traits don't actually inflict pain or fatigue, but I can work on that. Thank you! 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