Suomiboi Posted August 11, 2013 Share Posted August 11, 2013 Hey, I was wondering if there is a way of changing the defines.lua ZomboidGlobals with a function and without editing the file itself? For example:function KnifeTest(); local player = getPlayer(0); local weapon = player:getPrimaryHandItem(); if weapon:getType() == "KitchenKnife" then -- this would be where it would change the info in ZomboidGlobals CatchAColdIncreaseRate = 0.000, --this is normally 0.003 Events.OnPlayerUpdate.Add (KnifeTest);Now I know this code doesn't work and it's just an example to demonstrate what I'd like to do. I've tried multiple ways of getting the info from the ZomboidGlobals and change it but nothing seems to work.(Too many to list and remember. I'm in the point where I just try anything that pops to my head that would have a 1% chance of working.) This is probably either because it can't be done or because I'm stupid and don't know the code... So if anyone knows anything that might help or that it can't be done, I'd be extremely grateful! Link to comment Share on other sites More sharing options...
RoboMat Posted August 11, 2013 Share Posted August 11, 2013 Well I don't have time to look at the defines.lua at the moment so this is just a guess but if you follow this tutorial: http://lua-users.org/wiki/TablesTutorial and if it is what I imagine it to be you should be able to do it like this:ZomboidGlobals["CatchCold"] = 0.000;Just don't forget to put the needed "require" at the top! Link to comment Share on other sites More sharing options...
Suomiboi Posted August 11, 2013 Author Share Posted August 11, 2013 Allright! I'll start testing with it. It didn't work straight as it is but I'll try and figure out the system behind it. Thanks! EDIT: I've gotten it to change the numbers but the effect doesn't seem to be working yet. Gonna continue testing 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