Open LNx2 opened 1 week ago
The penalty for being addicted also seems to be Perception -2, while most wikis seem to suggest -1 Agility and -1 Charisma.
Attach a save.
Yep, can confirm. It seems that the addiction actually has no effect but the nagging message. I think it makes sense to match the other games for penalty. Current script is simplistic, just straight 10% chance to get addicted. Maybe it's worth implementing something more complicated, taking CON and drug-related perks into account, + leaky bucket algo to count amounts.
I think this part of the script "scripts_src/main/obj_dude.ssl" is implementing the alcohol addiction right now. I guess the "procedure use_obj_on_p_proc" only gets called when an item is used from outside the inventory.
procedure use_obj_on_p_proc begin
variable temp;
//added by killap - expansion
//- player has 10% chance of becoming addicted to alcohol
if ( (obj_pid(obj_being_used_with) == PID_BEER) or (obj_pid(obj_being_used_with) == PID_BOOZE) or
(obj_pid(obj_being_used_with) == PID_GAMMA_GULP_BEER) or (obj_pid(obj_being_used_with) == PID_ABBEY_BOOZE) or
(obj_pid(obj_being_used_with) == PID_ROENTGEN_RUM) ) then begin
if (random(1,100) <= 10) then begin
if (alcohol_addict == 0) then begin
display_msg(mstr(500));
set_critter_stat(dude_obj, STAT_pe, -2);
//code from Timeslip to force the addiction tag to appear
if not(is_iface_tag_active(4)) then
show_iface_tag(4);
set_global_var(GVAR_ALCOHOL_ADDICT,1);
alcohol_addict := 1;
end
end
end
//end added
Is there a procedure that gets called when an item is used from inside the inventory? Or would it be better to modify the proto files of the alcoholic beverages and implement the addiction that way?
It seems that the addiction actually has no effect but the nagging message.
The addiction does lower the perception by 2 points, that just gets hidden by the immediate effect of the consumed alcohol, but once that wears off, the perception stays lowered by 2 points.
Damn I attibuted almost all commits to the wrong issue.
gl_k_alcohl.int.zip @LNx2 try this.
Was too lazy to do proper leaky bucket implementation, did just primitive chance increase with repeated drinking.
@burner1024 thanks for the patch. When I test the patch, I only get the word "Error" instead of the messages from "k_alcohl.msg" . The addiction wouldn't go away after several weeks either. (In case it makes a difference I build rpu from commit 0e69217, instead of using your pre-compiled script )
Forgot to include the file into archive. See last commit, drop it into data/text/english/game
Forgot to include the file into archive. See last commit, drop it into data/text/english/game
That seems to have fixed the messages, but the times when the messages are shown still seem wrong.
Looking at the code from scripts_src/global/gl_k_alcohl.ssl:
#define TIME_TWO_DAYS 10368000
#define TIME_THREE_DAYS 15552000
#define TIME_ONE_WEEK 36288000
All seem to assume, that there are 60 ticks in a second, but afaik there are only 10.
Also here last_drink_date
should be earlier than game_time
, so at least I think game_time - last_drink_date >= TIME_ONE_WEEK
etc. should be the result we are looking for, if I am not mistaken.
// regular drinking increases chances
if (last_drink_date - game_time >= TIME_ONE_WEEK)
then chance = 1;
else if (last_drink_date - game_time >= TIME_THREE_DAYS)
then chance = 5;
else chance = 10;
roll = random(1, 100);
Yes, you're right on both items. I added fixes. Current builds can be downloaded from actions artifacts, by the way.
Yes, you're right on both items. I added fixes.
I merged your fixes with the stuff I did to fix some more bugs, etc. If you get around to it, you can take a look at my pull request.
Current builds can be downloaded from actions artifacts, by the way. That's good to know thanks, might be easier if I want to test upstream patches.
What happened
If you drink alcohol from within your inventory you never seem to be able to get addicted. If you use the same alcohol on yourself (from outside the inventory), the addiction mechanic seems to works as expected.
What you expected to happen
Drinking alcohol from the inventory and using the alcohol on yourself should work the same way