Cyrrent Eiledoll Posted October 10, 2015 Share Posted October 10, 2015 Hi. My question or suggestion: Is it possible to make a disease like diabetes. I mean something you must take a medicine every day or you just die. I think this would make PZ more harder. Link to comment Share on other sites More sharing options...
MisterInSayne Posted October 10, 2015 Share Posted October 10, 2015 Ah, you mean chronic diseases! I assume you mean like a trait such as the Claustrophobic trait? The trait system isn't something I've looked into, but I know other modders have added new ones into it, so that part I know is possible, but haven't looked into myself on how to do. The functional part of this however I do know and is pretty simple to do actually.You'll need a item, with the same base as painkillers for example, the right click 'use' option is something you'll have to add a custom context menu for however, which is explained in these 2 links:http://pz-mods.net/guide/how-to-create-inventory-context-menus/http://theindiestone.com/forums/index.php/topic/16624-giving-custom-options-to-items-when-you-right-click-them/ now the function you want to have the item do is something along the lines of this: (which goes in the client lua files side)getSpecificPlayer(player):getModData()["Insuline"] = getSpecificPlayer(player):getModData()["Insuline"] + 6;item:Use();(You'll need to add a bit more code ofcourse, and eventually might want to add a timebasedaction to using it, but this is the base of things) Next you'll need a custom function that check and lowers the insuline levels each hour or so. (which goes in the server lua files side)doInsulineThing = function() if isClient() then return end if isServer() then for i,player in ipairs(getOnlinePlayers()) do if player:getTraits():contains("Diabetic") then player:getModData()["Insuline"] = player:getModData()["Insuline"] - 1; if player:getModData()["Insuline"] < 0 then -- make player get sick or whatever you want. end end end else local player = getPlayer(); if player:getTraits():contains("Diabetic") then player:getModData()["Insuline"] = player:getModData()["Insuline"] - 1; if player:getModData()["Insuline"] < 0 then -- make player get sick or whatever you want. end end endendEvents.EveryHours.Add(doInsulineThing);You'll have to add yourself what will happen if the player doesn't take the insuline, but this is a base to start on for whomever wants to give this a go. It is possible, and not even too difficult to do. Good luck! <3 Cyrrent Eiledoll 1 Link to comment Share on other sites More sharing options...
Cyrrent Eiledoll Posted October 10, 2015 Author Share Posted October 10, 2015 Wow thank you. With that info i can try to make something like chronic diseases. I remember a Zombiefilm there was a girl with a chronic diseas and she run the entire movie to found some medicine ... i think having such kind of diseases (and survive the zombieapokalypse) are not funny. MisterInSayne 1 Link to comment Share on other sites More sharing options...
MisterInSayne Posted October 10, 2015 Share Posted October 10, 2015 Wow thank you. With that info i can try to make something like chronic diseases. I remember a Zombiefilm there was a girl with a chronic diseas and she run the entire movie to found some medicine ... i think having such kind of diseases (and survive the zombieapokalypse) are not funny. Just remember, the code is from the top of my head, so there may be some errors in there. but if there are any, it'd be a simple syntax error. If you need more help, or need me to double check some things or refine the code at some point let me know ^__^ <3 Cyrrent Eiledoll 1 Link to comment Share on other sites More sharing options...
Cyrrent Eiledoll Posted October 10, 2015 Author Share Posted October 10, 2015 Until now its just a idea in my head. Better ask before i try to make something and later it dont work. Now i know this could be working. I know a little little little bit about lua ... but i think enough for simple things. When i make some its more try and error and learning by doing. Thank you again for the quick and very good answer. 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