OSP Code SP Donation

Users who are viewing this thread

Tüfekçi Başı

Grandmaster Knight
Hello M&B nation. I made a new small code for donating villages(I added it for towns too at bottom of message. Town codes are simple and clear but needs develop. ). This is my first open source code.  :smile:

I'm working on WFaS module system. WFaS MS is a bit old.  But codes are simple and clear.

You can warn if you find some mistakes.

Clear but open to develop as you can see. :smile:

module_constants

For WFaS

Find this:
Code:
slot_center_last_recruting_time	= 345

After add this:
Code:
slot_donate_party= 346

For Warband

Find this:
Code:
slot_center_last_reconnoitered_by_faction_time 				= 350

After add this:
Code:
slot_donate_party = 351



module_game_menus

Find this:
Code:
      ("village_hostile_action",[(party_slot_eq, "$current_town", slot_village_state, 0),
                                 (neg|party_slot_ge, "$current_town", slot_village_infested_by_bandits, 1),],"Take a hostile action.",
       [(jump_to_menu,"mnu_village_hostile_action"),
           ]),

After add this:
Code:
  (
    "village_donation",mnf_disable_all_keys," ",
    "none",
    [],
    [
      ("village_donation_inside",[
(party_slot_eq, "$current_town", slot_village_state, 0),
                                 (neg|party_slot_ge, "$current_town", slot_village_infested_by_bandits, 1),],"Make a donation(2000 Thaler).",
       [
        (party_get_slot, ":prosperity", "$current_town", slot_town_prosperity),
		(store_troop_gold, ":gold", "trp_player"),
		(store_random_in_range, ":zero_one", 0,2),
		(store_random_in_range, ":one_two", 1,3),
		(store_random_in_range, ":two_three", 2,4),
		(try_begin),
			(neg|party_slot_eq, "$current_town", slot_donate_party, 1),
			(try_begin),
				(ge, ":gold", 2000), ## donation is 2000 Thaler, you can easily change this.
				(troop_remove_gold, "trp_player", 2000),
				(try_begin),
					(is_between, ":prosperity", 0, 20),
					(call_script, "script_change_player_relation_with_center", "$current_town", ":two_three"),
					(val_add, ":prosperity", ":two_three"), 
				(else_try),
					(is_between, ":prosperity", 20, 40),
					(call_script, "script_change_player_relation_with_center", "$current_town", 2),
					(val_add, ":prosperity", 2),
				(else_try),
					(is_between, ":prosperity", 40, 60),
					(call_script, "script_change_player_relation_with_center", "$current_town", ":one_two"),
					(val_add, ":prosperity", ":one_two"), 
				(else_try),
					(is_between, ":prosperity", 60, 80),
					(call_script, "script_change_player_relation_with_center", "$current_town", 1),
					(val_add, ":prosperity", 1), 
				(else_try),
					(call_script, "script_change_player_relation_with_center", "$current_town", ":zero_one"),
					(val_add, ":prosperity", ":zero_one"), 
			    (try_end),
				(display_message,"@You donated 2000 Thaler.",0xFFFF00), # Yellow. You can change the colour what you want.
				(party_set_slot, "$current_town", slot_donate_party, 1),
			(else_try),
				(display_message,"@You don't have enough money to donate.",0x888888), # Gray. You can change the colour what you want.
			(try_end),
		(else_try),
			(display_message,"@They didn't accept your donation. You can ask them after one week.",0xAA0000), #I said "one week". This is controlling by a simple trigger. You must match words with digits. Simple trigger has given at bottom of codes. # Dark red. You can change the colour what you want.
		(try_end),   
]),
    ]
  ),



module_simple_triggers

Go to end of codes and find the last ] sign.

Add this to the top of last ] sign :
Code:
 (24*7, # 24*7 means one week. I said at bit top. You must match words with digits for your mods health.
   [
		(try_for_parties, ":party"),
			(party_slot_eq, ":party", slot_donate_party, 1),
			(party_set_slot, ":party", slot_donate_party, 0),
		(try_end),
   ]),



I coded it for towns, too.

module_game_menus

Find this:
Code:
      ("trade_with_merchants",
       [
           (party_slot_eq,"$current_town",slot_party_type, spt_town)
        ],"Go to the marketplace.",
         [
           (try_begin),
             (call_script, "script_cf_enter_center_location_bandit_check"),
           (else_try),
             (jump_to_menu,"mnu_town_trade"),
           (try_end),
          ]),

After add this:
Code:
   (
    "town_donation",mnf_disable_all_keys," ",
    "none",
    [],
    [
      ("village_donation_inside",[
                                 (neg|party_slot_eq, "$current_town", slot_village_state, svs_under_siege), # Disabling donation if there is siege.
								 ],"Make a donation(10000 Thaler).",
       [
        (party_get_slot, ":prosperity", "$current_town", slot_town_prosperity), 
		(store_troop_gold, ":gold", "trp_player"),
		(store_random_in_range, ":zero_one", 0,2),
		(store_random_in_range, ":one_two", 1,3),
		(store_random_in_range, ":two_three", 2,4),
		(try_begin),
			(neg|party_slot_eq, "$current_town", slot_donate_party, 1),
			(try_begin),
				(ge, ":gold", 10000), ## donation is 10000 Thaler, you can easily change this.
				(troop_remove_gold, "trp_player", 10000),
				(try_begin),
					(is_between, ":prosperity", 0, 20),
					(call_script, "script_change_player_relation_with_center", "$current_town", ":two_three"),
					(val_add, ":prosperity", ":two_three"), 
				(else_try),
					(is_between, ":prosperity", 20, 40),
					(call_script, "script_change_player_relation_with_center", "$current_town", 2),
					(val_add, ":prosperity", 2),
				(else_try),
					(is_between, ":prosperity", 40, 60),
					(call_script, "script_change_player_relation_with_center", "$current_town", ":one_two"),
					(val_add, ":prosperity", ":one_two"), 
				(else_try),
					(is_between, ":prosperity", 60, 80),
					(call_script, "script_change_player_relation_with_center", "$current_town", 1),
					(val_add, ":prosperity", 1), 
				(else_try),
					(call_script, "script_change_player_relation_with_center", "$current_town", ":zero_one"),
					(val_add, ":prosperity", ":zero_one"), 
			    (try_end),
				(display_message,"@You donated 10000 Thaler.",0xFFFF00), # Yellow. You can change the colour what you want.
				(party_set_slot, "$current_town", slot_donate_party, 1),
			(else_try),
				(display_message,"@You don't have enough money to donate.",0x888888), # Gray. You can change the colour what you want.
			(try_end),
		(else_try),
			(display_message,"@They didn't accept your donation. You can ask them after one month.",0xAA0000), #I said "one month". This is controlling by a simple trigger. You must match words with digits. Simple trigger has given at bottom of codes. # Dark red. You can change the colour what you want.
		(try_end),   
]),
    ]
  ),



module_simple_triggers

Go to end of codes and find the last ] sign.

Add this to the top of last ] sign :
Code:
 (24*30, # 24*30 means one month. I said at a bit top. You must match words with digits for your mods health.
   [
		(try_for_parties, ":party"),
			(party_slot_eq, ":party", slot_donate_party, 1),
			(party_set_slot, ":party", slot_donate_party, 0),
		(try_end),
   ]),

module_constants

For WFaS

Find this:
Code:
slot_center_last_recruting_time	= 345

After add this:
Code:
slot_donate_party= 346

For Warband

Find this:
Code:
slot_center_last_reconnoitered_by_faction_time 				= 350

After add this:
Code:
slot_donate_party = 351

Giving credit is your preference. You can credit in your mod as "by GrandTÜRK Tüfekçi Başı" or "by GrandTURK Tufekci Basi" if want to do. :smile:
You are free to edit codes but you must say at your mod's page if you edit codes.
 
Interesting! I wonder, could you use this to (in addition to raising your reputation with the village) slightly raise it's prosperity as well? I figure 2000 thaler/denar would go a long way to help fix up a few buildings and buy some livestock.
 
Ah cool! :grin:

How possible would it be to do the same thing for towns? I know you can already buy wine at the tavern, but this would also incorporate the prosperity bit. Maybe 5000, though?
 
I think it's possible for town if we are king or we have extraordinary renown and local reputation. I'm not sure tavernkeeper is right person to donate. We can use manors for this. (WFaS have manors , Warband not.) But we must add her/him to troops, we must design him/her dialogs and we need new a menu option for towns. Codes are not so complex but we need to find best option for health of game. Our advantage is that we have a lot of alternate ways to use for coding. :smile:

We can add new dialog options for tavernkeeprs as 5000, 3000, 10000 etc. But cities are more complex than villages. You can think this for village elders too, but there is not guarante to spend money for city's prosperity by tavernkeeper. :smile:
Codes are not problem.
 
I think you're right, donating to the city might be a bit difficult to justify. Maybe only if you own it? Or if not, have Honour above a certain threshold (so the citizens know you're good for it)?

I was thinking just menu options, as with the villages.
 
Developing options are opening if you are lord of city. I think no need to donate. You build directly.

But people are not have to think same things everytime. I will add an option for cities, too. :smile: And we can develop it from day to day. :wink:

I added codes for cities now. Money is 10000, time is one month. You can change.
 
Back
Top Bottom