OSP Code QoL Beer drinking for Warband!

Users who are viewing this thread

(This is to be taken semi-seriously... :wink:)
So, here I was yesterday, sitting at the computer with a mug of beer, and all of a sudden I got an awesome idea - make beer drinking be an option in Warband. Today I got to working on it and here's the product of about 10-20 minutes. Tested and working.
Why did I do it? Well, (almost) everyone loves beer, and an army of soldiers would perhaps also like to drink beer once in a while.
This code allows your army to drink up to 9 beers each every 18 hours. You have to go to any tavern and buy beers for your army. Each beer costs 7 denars. Each drinking of beers improves your party's morale by 2. You can easilty change all of these fixed values. It's a rather pathetic attempt in terms of making logical sense and being realistic in any way, shape, or form, but I still think it's a mildly amusing option to have. Feel free to tweak it around and make something more sensible!

The code: I wanted it to be clean and simple, and it is. (Well, it's also not very feature-rich, but I still think it's a fun addition.)
Code:
#-## TBS - Beer drinking
  [anyone|plyr,"tavernkeeper_talk", [
	  (neq, "$sneaked_into_town", 1), # It'd be suspicious to order 200 or so beers while undercover
	  (neg|troop_slot_ge, "trp_player", slot_beers_for_the_day, 9), # Maximum of 9 beers per day
	  (store_party_size, reg1, "p_main_party"),
	  (store_mul, reg2, reg1, 7), # 7 denars per beer - making it more expensive to counter the big amount of morale possible to gain
      ], "I want {reg1} beers for my company. ({reg2} denars.)", "tavernkeeper_drink_beer",[]],
	  
  [anyone,"tavernkeeper_drink_beer",
   [
	(store_troop_gold, ":player_cash", "trp_player"),
	(store_party_size, ":party_size", "p_main_party"),
	(store_mul, ":beer_cost", ":party_size", 7),
	(try_begin),
		(ge, ":player_cash", ":beer_cost"),
		(troop_remove_gold, "trp_player", ":beer_cost"),
		(display_message, "@Your army's morale has improved!", 0x33ff33),
		(call_script, "script_change_player_party_morale", 2),
		(troop_get_slot, ":cur_beers", "trp_player", slot_beers_for_the_day),
		(val_add, ":cur_beers", 1),
		(troop_set_slot, "trp_player", slot_beers_for_the_day, ":cur_beers"),
		(store_current_hours, ":cur_hrs"),
		(troop_set_slot, "trp_player", slot_last_beers_time, ":cur_hrs"),
		(str_store_string, s1, "@Of course, {sir/madam}. I shall have them delivered to your company as soon as possible."),
	(else_try),
		(str_store_string, s1, "@You don't have enough money, {mate/lass}..."),
	(try_end),
    ], "{s1}", "close_window",[]],
#-## TBS - Beer drinking end
Code:
#-## TBS - Beer drinking
# These are troop slots, so check for conflicting numbers in your mod.
slot_beers_for_the_day = 420
slot_last_beers_time   = 421
#-## TBS - Beer drinking end
Code:
#-## TBS - Beer drinking
   (1, [
	(troop_get_slot, ":last_beers_time", "trp_player", slot_last_beers_time),
	(store_current_hours, ":cur_hrs"),
	(val_sub, ":cur_hrs", ":last_beers_time"),
	(ge, ":cur_hrs", 18), # If 18 hours have passed since you drank beers
	(troop_set_slot, "trp_player", slot_beers_for_the_day, 0),
   ]),
#-## TBS - Beer drinking end

Enjoy, have fun and drink more of that wonderful liquid - the beer!
 
Now we need drinking contests! With slurred speech afterward and a hangover that causes you to end up in prison  :lol:

Seriously though, nice job with the script
 
Gah, I was hoping for a beer-drinking animation. :smile:

You can easily replace the slots with globals. Those slots are used only for the player troop, so it doesn't matter if they are troop slots or something else.

Why:
When you raise the number of slots used per troop, memory is reserved for all troops and their slots too. This impacts both running memory and save games.
So, if you add two new troop slots, the memory increase is 2*8*total_number_of_troops bytes. If you use globals, it's 2*8 bytes.
Just nitpicking. :smile:
 
nice  :grin:

Can one make so that the player are thirst and hunger?

I think it's no difficult...create a conssomable for the player...
If he have no drink  for X time ,display message "i'm thirsty/hungry" and remove 1 point to stats...

This script exists???

and of course i like the beer too  :mrgreen: :mrgreen:


 
MadVader said:
Gah, I was hoping for a beer-drinking animation. :smile:

You can easily replace the slots with globals. Those slots are used only for the player troop, so it doesn't matter if they are troop slots or something else.

Why:
When you raise the number of slots used per troop, memory is reserved for all troops and their slots too. This impacts both running memory and save games.
So, if you add two new troop slots, the memory increase is 2*8*total_number_of_troops bytes. If you use globals, it's 2*8 bytes.
Just nitpicking. :smile:
This was a 20-minute job, but it was designed with expanding in mind - I've used slots because on a later stage the AI lords might also choose to get beer for their troops. Getting drunk should also be implemented. And other stuff, and yeah - a specific animation.
All of that I won't do, though. Not in the foreseeable future, at least. :smile:
 
glitch :sad:!!

when im using this and im out of food instead of saying party has no food u lose 3 morale it says (no fiefs) your party loses 3 morale
 
Gambino said:
glitch :sad:!!

when im using this and im out of food instead of saying party has no food u lose 3 morale it says (no fiefs) your party loses 3 morale
I'm pretty certain that the beer drinking is not the cause of your problem. It simply has no possible way of being the cause. :smile:
 
Sorry to necro.

I just love this! A good way to improve morale!
Here's a question: I tried changing beer to wine, but whenever the tavernkeeper is supposed to deliver, the dialogue freezes, and I have to force-stop the game. :cry:
Any suggestions?
 
You shouldn't have any problem replacing the dialog bits, which is what matters anyway. Don't replace the "beer" text in the variables, operations and such, just the dialog text and you should be fine. For example:
#-## TBS - Beer drinking
  [anyone|plyr,"tavernkeeper_talk", [
  (neq, "$sneaked_into_town", 1), # It'd be suspicious to order 200 or so beers while undercover
  (neg|troop_slot_ge, "trp_player", slot_beers_for_the_day, 9), # Maximum of 9 beers per day
  (store_party_size, reg1, "p_main_party"),
  (store_mul, reg2, reg1, 7), # 7 denars per beer - making it more expensive to counter the big amount of morale possible to gain
      ], "I want {reg1} bottles of wine for my company. ({reg2} denars.)", "tavernkeeper_drink_beer",[]],
 
#-## TBS - Beer drinking
  [anyone|plyr,"tavernkeeper_talk", [
  (neq, "$sneaked_into_town", 1), # It'd be suspicious to order 200 or so beers while undercover
  (neg|troop_slot_ge, "trp_player", slot_wine_for_the_day, 9), # Maximum of 9 beers per day
  (store_party_size, reg1, "p_main_party"),
  (store_mul, reg2, reg1, 7), # 7 denars per beer - making it more expensive to counter the big amount of morale possible to gain
      ], "I want {reg1} beers for my company. ({reg2} denars.)", "tavernkeeper_drink_beer",[]],
 
 
Antonis said:
You shouldn't have any problem replacing the dialog bits, which is what matters anyway. Don't replace the "beer" text in the variables, operations and such, just the dialog text and you should be fine. For example:
#-## TBS - Beer drinking
  [anyone|plyr,"tavernkeeper_talk", [
  (neq, "$sneaked_into_town", 1), # It'd be suspicious to order 200 or so beers while undercover
  (neg|troop_slot_ge, "trp_player", slot_beers_for_the_day, 9), # Maximum of 9 beers per day
  (store_party_size, reg1, "p_main_party"),
  (store_mul, reg2, reg1, 7), # 7 denars per beer - making it more expensive to counter the big amount of morale possible to gain
      ], "I want {reg1} bottles of wine for my company. ({reg2} denars.)", "tavernkeeper_drink_beer",[]],
 
#-## TBS - Beer drinking
  [anyone|plyr,"tavernkeeper_talk", [
  (neq, "$sneaked_into_town", 1), # It'd be suspicious to order 200 or so beers while undercover
  (neg|troop_slot_ge, "trp_player", slot_wine_for_the_day, 9), # Maximum of 9 beers per day
  (store_party_size, reg1, "p_main_party"),
  (store_mul, reg2, reg1, 7), # 7 denars per beer - making it more expensive to counter the big amount of morale possible to gain
      ], "I want {reg1} beers for my company. ({reg2} denars.)", "tavernkeeper_drink_beer",[]],
 

Thanks
 
Back
Top Bottom