OSP Code QoL "I want to eat food" and HP Regenaration.

Users who are viewing this thread

Hi!It is a "Tavernkeeper_talk" dialogue...We want to food and if We have enough money, we eat and characters hp is regeneration.

-Open Module_dialogs and find "#Tavernkeepers"
-Paste this code in this part.(I am open to developments :grin: )
###Food
[anyone|plyr, "tavernkeeper_talk", [], "I want to eat food.", "eat_food",[]],
[anyone, "eat_food", [
(store_troop_health, ":troop_hp", "trp_player"),
(try_begin),
(lt, ":troop_hp", 100),
(store_div, ":new_value", ":troop_hp", 4),
(val_max, ":new_value", 4),
(assign, reg1, ":new_value"),
(try_end),
], "Please give {reg1} denars.", "tavernkeeper_talk2", [
]],
[anyone|plyr, "tavernkeeper_talk2", [(store_troop_gold, ":g", "trp_player"),
(ge, ":g", reg1),
], "Here.", "close_window", [
(store_troop_health, ":troop_hp", "trp_player"),
(try_begin),
(lt, ":troop_hp", 100),
(store_div, ":new_value", ":troop_hp", 4),
(val_max, ":new_value", 4),
(troop_remove_gold, "trp_player", ":new_value"),
(try_end),
(troop_set_health, "trp_player", 100),
]],

[anyone|plyr, "tavernkeeper_talk2", [(store_troop_gold, ":g", "trp_player"),
(lt, ":g", reg1),
], "I haven't got that much money.", "close_window", []],

[anyone|plyr, "tavernkeeper_talk2", [], "Hmm, I thought for a while. I will not buy food.", "close_window", []],

SupaNinjaMan said:
Code:
 	(heal_party, "p_main_party"),

Here's a version I drafted up for you.
Code:
[anyone|plyr, "tavernkeeper_talk", [], "I want to feed my men.", "eat_food_party",[]],

[anyone, "eat_food_party", [
	(party_get_num_companions, ":player_troop_count", "p_main_party"),
	(store_mul, reg10, ":player_troop_count", 15),
	(val_add, reg10, 100),
], "That'll cost you {reg10} denars.", "tavernkeeper_food_party", [
]],

[anyone|plyr, "tavernkeeper_food_party", [
	(store_troop_gold, ":g", "trp_player"),
	(ge, ":g", reg10),
], "Here.", "close_window", [

	(heal_party, "p_main_party"),
	(troop_set_health, "trp_player", 100),
	
	(troop_remove_gold, "trp_player", reg10),
	

]],

[anyone|plyr, "tavernkeeper_food_party", [
	 (store_troop_gold, ":g", "trp_player"),
	 (lt, ":g", reg10),
], "I can't afford that.", "close_window", []],

[anyone|plyr, "tavernkeeper_food_party", [], "You know what, never mind. I'm good.", "close_window", []],
If use this mod,please give me to credits.See you next time...

Credits:

For Player HP:
Kortlcha
Ethred

For Troops HP:
Players Hp Credits +
SupaNinjaMan
 
Corbul said:
Sorry to necro, here's a question:
Will this replenish companions'/ troops' health as well, or just the player's?
It does not but you can easily make it so that it will heal your party as well by adding

Code:
 	(heal_party, "p_main_party"),

Here's a version I drafted up for you.
Code:
[anyone|plyr, "tavernkeeper_talk", [], "I want to feed my men.", "eat_food_party",[]],

[anyone, "eat_food_party", [
	(party_get_num_companions, ":player_troop_count", "p_main_party"),
	(store_mul, reg10, ":player_troop_count", 15),
	(val_add, reg10, 100),
], "That'll cost you {reg10} denars.", "tavernkeeper_food_party", [
]],

[anyone|plyr, "tavernkeeper_food_party", [
	(store_troop_gold, ":g", "trp_player"),
	(ge, ":g", reg10),
], "Here.", "close_window", [

	(heal_party, "p_main_party"),
	(troop_set_health, "trp_player", 100),
	
	(troop_remove_gold, "trp_player", reg10),
	

]],

[anyone|plyr, "tavernkeeper_food_party", [
	 (store_troop_gold, ":g", "trp_player"),
	 (lt, ":g", reg10),
], "I can't afford that.", "close_window", []],

[anyone|plyr, "tavernkeeper_food_party", [], "You know what, never mind. I'm good.", "close_window", []],

I don't check if there is an actual need for it, but it's fine. You could also add something to have it enhance your morale.
 
SupaNinjaMan said:
Corbul said:
Sorry to necro, here's a question:
Will this replenish companions'/ troops' health as well, or just the player's?
It does not but you can easily make it so that it will heal your party as well by adding

Code:
 	(heal_party, "p_main_party"),

Here's a version I drafted up for you.
Code:
[anyone|plyr, "tavernkeeper_talk", [], "I want to feed my men.", "eat_food_party",[]],

[anyone, "eat_food_party", [
	(party_get_num_companions, ":player_troop_count", "p_main_party"),
	(store_mul, reg10, ":player_troop_count", 15),
	(val_add, reg10, 100),
], "That'll cost you {reg10} denars.", "tavernkeeper_food_party", [
]],

[anyone|plyr, "tavernkeeper_food_party", [
	(store_troop_gold, ":g", "trp_player"),
	(ge, ":g", reg10),
], "Here.", "close_window", [

	(heal_party, "p_main_party"),
	(troop_set_health, "trp_player", 100),
	
	(troop_remove_gold, "trp_player", reg10),
	

]],

[anyone|plyr, "tavernkeeper_food_party", [
	 (store_troop_gold, ":g", "trp_player"),
	 (lt, ":g", reg10),
], "I can't afford that.", "close_window", []],

[anyone|plyr, "tavernkeeper_food_party", [], "You know what, never mind. I'm good.", "close_window", []],

I don't check if there is an actual need for it, but it's fine. You could also add something to have it enhance your morale.

So, I just replace the OP code with this, or do I add it to the end of the OP code?
 
Back
Top Bottom