OSP Kit SP Masterancza's/Garedyr's bank kit

Should there be a fee for account maintenance?

  • Sounds realistic. Go ahead!

    Votes: 3 75.0%
  • Nah.

    Votes: 1 25.0%

  • Total voters
    4
  • Poll closed .

Users who are viewing this thread

Garedyr

Master Knight
WBVC
{!!!}THIS SCRIPT IS GOING TO BE REWORKED{!!!}


Masterancza said:
Hello guys!

I'm currently working on this script so feel free to post your suggestions here. The basic code has been re-written, now I need to translate it :mrgreen:
The problems with account balance after reaching one million number have been fixed. I've added 500000 denars limit. I was thinking about connecting bank account with things like weekly budget or manufacture money.

I've also added poll to let you decide if there should be a fee for account maintenance or not.


[OSP] Masterancza's/Garedyr's bank kit

Credits:​

I: all the work
fladin: little help with trigger

This script adds bank. You can create bank account in dialog with all of Guild Masters. It's required to have 1000 denars to create bank account. You can deposit money and hand out it. All of the money in your account are 10% bigger every week (in game).​

Let's start from module_constants. Paste this code in any place of module_constants (within reason):

slot_bank_money = 0

Now it's module_scripts turn. Find this code:

#Warband changes begin -- set this early
  (try_for_range, ":npc", 0, kingdom_ladies_end),
    (this_or_next|eq, ":npc", "trp_player"),
(is_between, ":npc", active_npcs_begin, kingdom_ladies_end),
(troop_set_slot, ":npc", slot_troop_father, -1),
(troop_set_slot, ":npc", slot_troop_mother, -1),
(troop_set_slot, ":npc", slot_troop_guardian, -1),
(troop_set_slot, ":npc", slot_troop_spouse, -1),
(troop_set_slot, ":npc", slot_troop_betrothed, -1),
        (troop_set_slot, ":npc", slot_troop_prisoner_of_party, -1),
        (troop_set_slot, ":npc", slot_lady_last_suitor, -1),
        (troop_set_slot, ":npc", slot_troop_stance_on_faction_issue, -1),

(store_random_in_range, ":decision_seed", 0, 10000),
        (troop_set_slot, ":npc", slot_troop_set_decision_seed, ":decision_seed"), #currently not used
        (troop_set_slot, ":npc", slot_troop_temp_decision_seed, ":decision_seed"), #currently not used, holds for at least 24 hours
  (try_end),

Underneath paste this:

(troop_set_slot, "trp_player", slot_bank_money, 0),
  (assign, "$g_bank", 0),

It's turn of the biggest part of the code. Open module_dialogs and search for this code:

[anyone|plyr,"mayor_talk", [(store_partner_quest, ":partner_quest"),
                              (lt, ":partner_quest", 0),
                              (neq, "$merchant_quest_last_offerer", "$g_talk_troop")],
  "Do you happen to have a job for me?", "merchant_quest_requested",[
    (assign,"$merchant_quest_last_offerer", "$g_talk_troop"),
    (call_script, "script_get_quest", "$g_talk_troop"),
    (assign, "$random_merchant_quest_no", reg0),
    (assign,"$merchant_offered_quest","$random_merchant_quest_no"),
    ]],

Underneath paste this:

Code:
[anyone|plyr,"mayor_talk", [],
   "I want to talk about bank.", "mayor_bank",[]],

[anyone,"mayor_bank", [(eq, "$g_bank", 0)],
   "Fine. It looks you don't have bank account yet. You must pay amount of 1000 denars to create bank account. You can make deposits and hand out money from bank. Your money will be 10% bigger every week.", "mayor_bank_1",[]],

[anyone,"mayor_bank", [(eq, "$g_bank", 1), (troop_get_slot, reg1, "trp_player", slot_bank_money)],
   "Actual balance of your bank account is {reg1} denars. What do you want to do?", "mayor_bank_3",[]],

[anyone|plyr,"mayor_bank_3", [(store_troop_gold, ":money", "trp_player"), (ge, ":money", 100)],
   "[Make a deposit of 100 denars]", "mayor_bank",[
   (troop_get_slot, reg1, "trp_player", slot_bank_money),
   (val_add, reg1, 100),
   (troop_set_slot, "trp_player", slot_bank_money, reg1),
   (troop_remove_gold, "trp_player", 100)]],

[anyone|plyr,"mayor_bank_3", [(store_troop_gold, ":money", "trp_player"), (ge, ":money", 1000)],
   "[Make a deposit of 1000 denars]", "mayor_bank",[
   (troop_get_slot, reg1, "trp_player", slot_bank_money),
   (val_add, reg1, 1000),
   (troop_set_slot, "trp_player", slot_bank_money, reg1),
   (troop_remove_gold, "trp_player", 1000)]],

[anyone|plyr,"mayor_bank_3", [(store_troop_gold, ":money", "trp_player"), (ge, ":money", 10000)],
   "[Make a deposit of 10000 denars]", "mayor_bank",[
   (troop_get_slot, reg1, "trp_player", slot_bank_money),
   (val_add, reg1, 10000),
   (troop_set_slot, "trp_player", slot_bank_money, reg1),
   (troop_remove_gold, "trp_player", 10000)]],

[anyone|plyr,"mayor_bank_3", [(troop_get_slot, reg1, "trp_player", slot_bank_money), (ge, reg1, 100)],
   "[Hand out 100 denars]", "mayor_bank",[
   (troop_get_slot, reg1, "trp_player", slot_bank_money),
   (val_add, reg1, -100),
   (troop_set_slot, "trp_player", slot_bank_money, reg1),
   (troop_add_gold, "trp_player", 100)]],

[anyone|plyr,"mayor_bank_3", [(troop_get_slot, reg1, "trp_player", slot_bank_money), (ge, reg1, 1000)],
   "[Hand out 1000 denars]", "mayor_bank",[
   (troop_get_slot, reg1, "trp_player", slot_bank_money),
   (val_add, reg1, -1000),
   (troop_set_slot, "trp_player", slot_bank_money, reg1),
   (troop_add_gold, "trp_player", 1000)]],

[anyone|plyr,"mayor_bank_3", [(troop_get_slot, reg1, "trp_player", slot_bank_money), (ge, reg1, 10000)],
   "[Hand out 10000 denars]", "mayor_bank",[
   (troop_get_slot, reg1, "trp_player", slot_bank_money),
   (val_add, reg1, -10000),
   (troop_set_slot, "trp_player", slot_bank_money, reg1),
   (troop_add_gold, "trp_player", 10000)]],

[anyone|plyr,"mayor_bank_3", [],
   "Nothing. I've only wanted to check balance of my account.", "mayor_pretalk",[]],    
   
[anyone|plyr,"mayor_bank_1", [(store_troop_gold, ":money", "trp_player"), (ge, ":money", 1000)],
   "Good! I want to create account. Here are my 1000 denars.", "mayor_bank_zalozenie",[(troop_remove_gold, "trp_player", 1000), (assign, "$g_bank", 1), (troop_set_slot, "trp_player", slot_bank_money, 1000), (display_message, "@Your bank account is now open.")]],

[anyone|plyr,"mayor_bank_1", [],
   "Ok, it's all I wanted to know. I don't have enough money.", "mayor_pretalk",[]],

[anyone,"mayor_bank_zalozenie", [],
   "Fine, your bank account is now open.", "mayor_pretalk",[]], 

The last part is to add this code at the end of module_simple_triggers file (before last ]):

Code:
# Bank
  (24*7,
   [(eq, "$g_bank", 1),
   (try_begin),
   (troop_get_slot, ":current_money", "trp_player", slot_bank_money), 
   (assign,":income",":current_money"),
   (val_div,":income",10),
   (val_add,":current_money",":income"),
   (troop_set_slot, "trp_player", slot_bank_money, ":current_money"),
   (assign, reg1, ":income"),
   (try_end),
   (try_begin),
   (troop_get_slot, reg2, "trp_player", slot_bank_money),
   (display_message, "@{reg1} denars added to bank.", 0x2EFEF7),
   (display_message, "@Balance is now {reg2} denars.", 0x2EFEF7),
   (try_end),   
    ]),

Rezovor said:
I'm going to bump this because the bank has some known issues. Some people have reported that their bank account goes into the negative balance, so I set out to try and solve this issue. I also added that if your bank account has 1,000,000 or more denar in it, you will not receive any more weekly payments until it drops below 1 million. This was to also solve getting the bank account so huge that Warband flips the number to negative.


module_dialog

Code:
	 ## BANK SLOT START
	 [anyone|plyr,"mayor_talk", [],
   "My bank account", "mayor_bank",[]],

[anyone,"mayor_bank", [(eq, "$g_bank", 0)],
   "Fine. It looks you do not have a bank account yet. You'll have to pay an amount of 1000 denars to create one. You'll be able to make deposits and hand out money from this bank account. Your money will grow 10% larger every two weeks.", "mayor_bank_1",[]],

[anyone,"mayor_bank", [(eq, "$g_bank", 1), (troop_get_slot, reg1, "trp_player", slot_bank_money)],
   "The balance of your bank account is {reg1} denars. What do you want to do?", "mayor_bank_3",[]],

[anyone|plyr,"mayor_bank_3", [(store_troop_gold, ":money", "trp_player"), (ge, ":money", 100)],
   "[Make a deposit of 100 denars]", "mayor_bank",[
   (troop_get_slot, reg1, "trp_player", slot_bank_money),
   (val_add, reg1, 100),
   (troop_set_slot, "trp_player", slot_bank_money, reg1),
   (troop_remove_gold, "trp_player", 100)]],

[anyone|plyr,"mayor_bank_3", [(store_troop_gold, ":money", "trp_player"), (ge, ":money", 1000)],
   "[Make a deposit of 1000 denars]", "mayor_bank",[
   (troop_get_slot, reg1, "trp_player", slot_bank_money),
   (val_add, reg1, 1000),
   (troop_set_slot, "trp_player", slot_bank_money, reg1),
   (troop_remove_gold, "trp_player", 1000)]],

[anyone|plyr,"mayor_bank_3", [(store_troop_gold, ":money", "trp_player"), (ge, ":money", 10000)],
   "[Make a deposit of 10000 denars]", "mayor_bank",[
   (troop_get_slot, reg1, "trp_player", slot_bank_money),
   (val_add, reg1, 10000),
   (troop_set_slot, "trp_player", slot_bank_money, reg1),
   (troop_remove_gold, "trp_player", 10000)]],

[anyone|plyr,"mayor_bank_3", [(troop_get_slot, reg1, "trp_player", slot_bank_money), (ge, reg1, 100)],
   "[Withdraw 100 denars]", "mayor_bank",[
   (troop_get_slot, reg1, "trp_player", slot_bank_money),
   (val_sub, reg1, 100),
   (troop_set_slot, "trp_player", slot_bank_money, reg1),
   (troop_add_gold, "trp_player", 100)]],

[anyone|plyr,"mayor_bank_3", [(troop_get_slot, reg1, "trp_player", slot_bank_money), (ge, reg1, 1000)],
   "[Withdraw 1000 denars]", "mayor_bank",[
   (troop_get_slot, reg1, "trp_player", slot_bank_money),
   (val_sub, reg1, 1000),
   (troop_set_slot, "trp_player", slot_bank_money, reg1),
   (troop_add_gold, "trp_player", 1000)]],

[anyone|plyr,"mayor_bank_3", [(troop_get_slot, reg1, "trp_player", slot_bank_money), (ge, reg1, 10000)],
   "[Withdraw 10000 denars]", "mayor_bank",[
   (troop_get_slot, reg1, "trp_player", slot_bank_money),
   (val_sub, reg1, 10000),
   (troop_set_slot, "trp_player", slot_bank_money, reg1),
   (troop_add_gold, "trp_player", 10000)]],
   
[anyone|plyr,"mayor_bank_3", [(troop_get_slot, reg1, "trp_player", slot_bank_money)],
   "[!!!!Reset my bank account back to 0 denars!!!!]", "mayor_bank",[
   (troop_set_slot, "trp_player", slot_bank_money, 0), (display_message, "@Your bank account has been reset!.")]],

[anyone|plyr,"mayor_bank_3", [],
   "Nothing. I've only wanted to check balance of my account.", "mayor_pretalk",[]],   
   
[anyone|plyr,"mayor_bank_1", [(store_troop_gold, ":money", "trp_player"), (ge, ":money", 1000)],
   "I want to create an account", "mayor_bank_zalozenie",[(troop_remove_gold, "trp_player", 1000), (assign, "$g_bank", 1), (troop_set_slot, "trp_player", slot_bank_money, 1000), (display_message, "@Your bank account is now open.")]],

[anyone|plyr,"mayor_bank_1", [],
   "Ok, it's all I wanted to know. I do not have enough money right now", "mayor_pretalk",[]],

[anyone,"mayor_bank_zalozenie", [],
   "Your bank account is now open!", "mayor_pretalk",[]],  
   
   ## BANK SLOT END

module_simple_triggers
Code:
  ## BANK SLOT START
  # Bank
  (24*7,
   [(eq, "$g_bank", 1),
   (try_begin),
   (troop_get_slot, reg1, "trp_player", slot_bank_money),
   (neg|is_between, reg1, -1, -1000000000),
   (troop_set_slot, "trp_player", slot_bank_money, 0), 
   (display_message, "@Your bank account has been reset!."),
   (try_end),
   (try_begin),
   (troop_get_slot, ":current_money", "trp_player", slot_bank_money),
   (assign,":income",":current_money"),
   (is_between, ":current_money", 1000000, 1000000000),
   (assign,":income", 0),
   (display_message, "@Your bank account has enough money in it already!", 0x2EFEF7),
   (else_try),
   (is_between, ":current_money", 0, 999999),
   (val_div,":income", 10),
   (val_add,":current_money",":income"),
   (troop_set_slot, "trp_player", slot_bank_money, ":current_money"),
   (assign, reg1, ":income"),
   (try_end),
   (try_begin),
   (troop_get_slot, reg2, "trp_player", slot_bank_money),
   (display_message, "@{reg1} denars were added to your bank account. Your balance is at {reg2} denars.", 0x2EFEF7),
   (try_end),   
    ]),
	## BANK SLOT END ##


(!) My english is not perfect, so translate may need correction. (!)
 

dragos

Good job, thanks for sharing :smile:

Edit: I've just translated the thread to Turkish by specifying your nickname and the credits.
 

Rezovor

Regular
I'm going to bump this because the bank has some known issues. Some people have reported that their bank account goes into the negative balance, so I set out to try and solve this issue. I also added that if your bank account has 1,000,000 or more denar in it, you will not receive any more weekly payments until it drops below 1 million. This was to also solve getting the bank account so huge that Warband flips the number to negative.


module_dialog

Code:
	 ## BANK SLOT START
	 [anyone|plyr,"mayor_talk", [],
   "My bank account", "mayor_bank",[]],

[anyone,"mayor_bank", [(eq, "$g_bank", 0)],
   "Fine. It looks you do not have a bank account yet. You'll have to pay an amount of 1000 denars to create one. You'll be able to make deposits and hand out money from this bank account. Your money will grow 10% larger every two weeks.", "mayor_bank_1",[]],

[anyone,"mayor_bank", [(eq, "$g_bank", 1), (troop_get_slot, reg1, "trp_player", slot_bank_money)],
   "The balance of your bank account is {reg1} denars. What do you want to do?", "mayor_bank_3",[]],

[anyone|plyr,"mayor_bank_3", [(store_troop_gold, ":money", "trp_player"), (ge, ":money", 100)],
   "[Make a deposit of 100 denars]", "mayor_bank",[
   (troop_get_slot, reg1, "trp_player", slot_bank_money),
   (val_add, reg1, 100),
   (troop_set_slot, "trp_player", slot_bank_money, reg1),
   (troop_remove_gold, "trp_player", 100)]],

[anyone|plyr,"mayor_bank_3", [(store_troop_gold, ":money", "trp_player"), (ge, ":money", 1000)],
   "[Make a deposit of 1000 denars]", "mayor_bank",[
   (troop_get_slot, reg1, "trp_player", slot_bank_money),
   (val_add, reg1, 1000),
   (troop_set_slot, "trp_player", slot_bank_money, reg1),
   (troop_remove_gold, "trp_player", 1000)]],

[anyone|plyr,"mayor_bank_3", [(store_troop_gold, ":money", "trp_player"), (ge, ":money", 10000)],
   "[Make a deposit of 10000 denars]", "mayor_bank",[
   (troop_get_slot, reg1, "trp_player", slot_bank_money),
   (val_add, reg1, 10000),
   (troop_set_slot, "trp_player", slot_bank_money, reg1),
   (troop_remove_gold, "trp_player", 10000)]],

[anyone|plyr,"mayor_bank_3", [(troop_get_slot, reg1, "trp_player", slot_bank_money), (ge, reg1, 100)],
   "[Withdraw 100 denars]", "mayor_bank",[
   (troop_get_slot, reg1, "trp_player", slot_bank_money),
   (val_sub, reg1, 100),
   (troop_set_slot, "trp_player", slot_bank_money, reg1),
   (troop_add_gold, "trp_player", 100)]],

[anyone|plyr,"mayor_bank_3", [(troop_get_slot, reg1, "trp_player", slot_bank_money), (ge, reg1, 1000)],
   "[Withdraw 1000 denars]", "mayor_bank",[
   (troop_get_slot, reg1, "trp_player", slot_bank_money),
   (val_sub, reg1, 1000),
   (troop_set_slot, "trp_player", slot_bank_money, reg1),
   (troop_add_gold, "trp_player", 1000)]],

[anyone|plyr,"mayor_bank_3", [(troop_get_slot, reg1, "trp_player", slot_bank_money), (ge, reg1, 10000)],
   "[Withdraw 10000 denars]", "mayor_bank",[
   (troop_get_slot, reg1, "trp_player", slot_bank_money),
   (val_sub, reg1, 10000),
   (troop_set_slot, "trp_player", slot_bank_money, reg1),
   (troop_add_gold, "trp_player", 10000)]],
   
[anyone|plyr,"mayor_bank_3", [(troop_get_slot, reg1, "trp_player", slot_bank_money)],
   "[!!!!Reset my bank account back to 0 denars!!!!]", "mayor_bank",[
   (troop_set_slot, "trp_player", slot_bank_money, 0), (display_message, "@Your bank account has been reset!.")]],

[anyone|plyr,"mayor_bank_3", [],
   "Nothing. I've only wanted to check balance of my account.", "mayor_pretalk",[]],   
   
[anyone|plyr,"mayor_bank_1", [(store_troop_gold, ":money", "trp_player"), (ge, ":money", 1000)],
   "I want to create an account", "mayor_bank_zalozenie",[(troop_remove_gold, "trp_player", 1000), (assign, "$g_bank", 1), (troop_set_slot, "trp_player", slot_bank_money, 1000), (display_message, "@Your bank account is now open.")]],

[anyone|plyr,"mayor_bank_1", [],
   "Ok, it's all I wanted to know. I do not have enough money right now", "mayor_pretalk",[]],

[anyone,"mayor_bank_zalozenie", [],
   "Your bank account is now open!", "mayor_pretalk",[]],  
   
   ## BANK SLOT END

module_simple_triggers
Code:
  ## BANK SLOT START
  # Bank
  (24*7,
   [(eq, "$g_bank", 1),
   (try_begin),
   (troop_get_slot, reg1, "trp_player", slot_bank_money),
   (neg|is_between, reg1, -1, -1000000000),
   (troop_set_slot, "trp_player", slot_bank_money, 0), 
   (display_message, "@Your bank account has been reset!."),
   (try_end),
   (try_begin),
   (troop_get_slot, ":current_money", "trp_player", slot_bank_money),
   (assign,":income",":current_money"),
   (is_between, ":current_money", 1000000, 1000000000),
   (assign,":income", 0),
   (display_message, "@Your bank account has enough money in it already!", 0x2EFEF7),
   (else_try),
   (is_between, ":current_money", 0, 999999),
   (val_div,":income", 10),
   (val_add,":current_money",":income"),
   (troop_set_slot, "trp_player", slot_bank_money, ":current_money"),
   (assign, reg1, ":income"),
   (try_end),
   (try_begin),
   (troop_get_slot, reg2, "trp_player", slot_bank_money),
   (display_message, "@{reg1} denars were added to your bank account. Your balance is at {reg2} denars.", 0x2EFEF7),
   (try_end),   
    ]),
	## BANK SLOT END ##
 

Garedyr

Master Knight
WBVC
@Rezovor

Thank you for solving this issue. This script is pretty old and now I don't have much time for modding. I'll update the first post. I'm going to rework this script in free time (perhaps on winter holidays).
 

Rezovor

Regular
No problem! I did two minor modifications to the script again (and took out the "reset")

Menu_Dialog -- Remove

Code:
[anyone|plyr,"mayor_bank_3", [(troop_get_slot, reg1, "trp_player", slot_bank_money)],
   "[!!!!Reset my bank account back to 0 denars!!!!]", "mayor_bank",[
   (troop_set_slot, "trp_player", slot_bank_money, 0), (display_message, "@Your bank account has been reset!.")]],


module_simple_triggers -- Remove

Code:
   (try_begin),
   (troop_get_slot, reg1, "trp_player", slot_bank_money),
   (neg|is_between, reg1, -1, -1000000000),
   (troop_set_slot, "trp_player", slot_bank_money, 0),
   (display_message, "@Your bank account has been reset!."),
   (try_end),

module_simple_triggers -- Change

Code:
   (is_between, ":current_money", 1000000, 1000000000),
   (assign,":income", 0),
   (display_message, "@Your bank account has enough money in it already!", 0x2EFEF7),

TO

Code:
   (is_between, ":current_money", 1000000, 1000000000),
   (assign, reg1, 0),
   (display_message, "@Your bank account has enough money in it already!", 0x2EFEF7),

It's a good script and is fun to play around with. This is about the best I could modify it without going too far past my limits.
 

Garedyr

Master Knight
WBVC
Hello guys!

I'm currently working on this script so feel free to post your suggestions here. The basic code has been re-written, now I need to translate it :mrgreen:
The problems with account balance after reaching one million number have been fixed. I've added 500000 denars limit. I was thinking about connecting bank account with things like weekly budget or manufacture money.

I've also added poll to let you decide if there should be a fee for account maintenance or not.
 
Top Bottom