Project Zomboid

Project Zomboid

648 个评价
Quit Smoking
5
3
2
   
奖励
收藏
已收藏
取消收藏
文件大小
发表于
更新日期
199.333 KB
2020 年 6 月 25 日 下午 5:50
1 月 1 日 上午 10:13
9 项改动说明 ( 查看 )

订阅以下载
Quit Smoking

描述
Allows you to eventually lose the smoker trait over time from abstaining from cigarettes. The chance to quit increases as you approach 4 weeks. If you were a smoker, quit, and smoke again you will regain the smoker trait.

https://github.com/crispiboi/QuitSmoking

Update
2025-01-01 - B42 functional.
2020-12-22: fixed incremental operand issue and smoker trait not actually being removed. Added cross version compatibility.
2020-12-07: Fixed non-smoker gaining smoker trait bug. Made it more fair to quit as player approaches threshold.
2020-10-01 :Fixed permanent stress bug

It's possible, but unlikely to quit in less than 2 weeks.
If your character is lucky, you will quit in about 2 weeks.
If your character is unlucky, you will quit in about 6 weeks.
If your character is neither lucky nor unlucky, you will quit in about 4 weeks.

Mechanics:
Every hour, a tiny incremental value is added to the chance to quit, which grows over time at a rate based on the chart above.
Every day, a selection roll is done based on the chance to quit. This value is rounded to the nearest whole number.
formula : selection = 100 - math.floor(playerdata.chancetoquit * 100);
Every day, a magic number is rolled based on a range from 0 to the selection number.
formula : magicnumber = ZombRand(0,selection);
If selection and magic number match, you quit smoking.

You will hear the level up sound if you quit smoking.

This is definitely a work in progress, please report issues if you experience any.

Workshop ID: 2142069709
Mod ID: QuitSmoking
Mod ID: QuitSmoking
热门讨论 查看全部(2)
1
2020 年 10 月 1 日 上午 5:50
[bug?] Can be stuck with permanent stress after quitting
shobble
0
4 月 28 日 上午 4:16
[bug] Lucky bonus
LairesRellik
185 条留言
hasufel_lionheart 11 小时以前 
If that help:
- "player:HasTrait("Smoker")" is now "getPlayer():hasTrait(CharacterTrait.SMOKER)"

- Lucky and Unlucky traits have been removed from the game

- player:getTraits():remove("Smoker"); is now : getPlayer():getCharacterTraits():remove(CharacterTrait.SMOKER)

- player:getTraits():add("Smoker"); is now : getPlayer():getCharacterTraits():add(CharacterTrait.SMOKER)
hasufel_lionheart 11 小时以前 
I have repaired the mod for myself, and it works perfectly in 42.13, do you need help for the update?
hasufel_lionheart 15 小时以前 
Broke in 42.13 !

-----------------------------------------
STACK TRACE
-----------------------------------------
function: quitChanceUpdate -- file: QuitSmoking.lua line # 32 | MOD: Quit Smoking
ERROR: General f:3146, t:1765741194308> ExceptionLogger.logException> Exception thrown
java.lang.RuntimeException: Object tried to call nil in quitChanceUpdate at KahluaUtil.fail(KahluaUtil.java:99).
Fredink. 10 月 22 日 上午 9:26 
Can i add this to an already existing b42 singleplayer?
The Thundershock Boi 10 月 16 日 下午 2:35 
This mod might not be working on Build 41 MP. I have twice now heard the level up sound effect, yet the smoker trait is not being removed.
Sir Ya-Drak Vollt 10 月 16 日 下午 12:38 
Is this mod compatible with Multiplayer? I currently have this mod on my Personal Server. Mainly asking because there is no talks about MP in the description. Thanks in advance.
blamebleue 9 月 17 日 下午 5:42 
hey, the mod seems to be working. but even once my character quit smoking, my stress is still rising as if i was a smoker.
Lurmey 9 月 12 日 上午 4:15 
Does this only work by completely abstaining for the 2-6 weeks? I.e. quitting cold turkey. Or does it also work by slowly reducing your intake?
ishikkayabas 8 月 13 日 下午 2:48 
Omg that's so funny. I quit out right before sleeping on day 51 to post that question. Logged back in and went to sleep and immediately got the level up sound from quitting. Heads up to others, the estimates in the mod description are definitely only estimates.
ishikkayabas 8 月 13 日 下午 2:34 
Is there any chance that a neither lucky nor unlucky character would still have not quit after close to two months? I'm concerned I bugged it out because I installed the mod before changing to B42.