Creating a Bank

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search

Introduction[edit | edit source]

In this article we are going to create a script for a container. The script will allow the player to put his gold into the container. After a week the container will give the player the original sum plus interest based on the player’s level. This will allow us to “invest” our gold in some kind of bank (in this case a container). Now we also have the possibility to store gold because it seems to be a bit unrealistic to carry your gold everywhere you go.

How does the bank work[edit | edit source]

Every gameweek all the money in the box will be multiplied by (1.00 + PlayerLevel/1000). This means if the player is level 10 the gold will be multiplied by 1.01 (interest of 1%), if the player is level 20 the gold will be multiplied by 1.02 (interest of 2%), etc.

The Script[edit | edit source]

Scn BankContainer

Short Button
Short DoOnce
Short ChestGoldCount
Short PlayerGoldCount
Short PlayerLevel

Begin onActivate
     Messagebox "How much gold do you want to put in the deposit box? (Currently %g gold)", ChestGoldCount, "Done", "100 gold", "250 gold", "500 gold", "1000 gold", "2500 gold", "5000 gold", "10000 gold", "50000 gold", "Acess Chest"
End

Begin Gamemode

Set PlayerLevel to (Player.Getlevel)
Set button to getbuttonpressed
If button > -1
     If charactergen.debug == 1
          Message "Button = %.0f", button
     Endif

     Set PlayerGoldCount to Player.Getitemcount Gold001

		If (Button == 0)
               Return
		Elseif (Button == 1)
               If PlayerGoldCount < 100
                    Messagebox "You don’t have enough gold"
               Elseif player.Getitemcount Gold001 >= 100
                    Additem Gold001 100
                    Set ChestGoldCount to (ChestGoldCount + 100)
                    Player.RemoveItem Gold001 100
               Endif
		Elseif (Button == 2)
               If PlayerGoldCount < 250
                    Messagebox "You don’t have enough gold"
               Elseif player.Getitemcount Gold001 >= 250
                    Additem Gold001 250
                    Set ChestGoldCount to (ChestGoldCount + 250)
                    Player.RemoveItem Gold001 250
               Endif
		Elseif (Button == 3)
               If PlayerGoldCount < 500
                    Messagebox "You don’t have enough gold"
               Elseif player.Getitemcount Gold001 >= 500
                    Additem Gold001 500
                    Set ChestGoldCount to (ChestGoldCount + 500)
                    Player.RemoveItem Gold001 500
               Endif
		Elseif (Button == 4)
               If PlayerGoldCount < 1000
                    Messagebox "You don’t have enough gold"
               Elseif player.Getitemcount Gold001 >= 1000
                    Additem Gold001 1000
                    Set ChestGoldCount to (ChestGoldCount + 1000)
                    Player.RemoveItem Gold001 1000
               Endif
		Elseif (Button == 5)
               If PlayerGoldCount < 2500
                    Messagebox "You don’t have enough gold"
               Elseif player.Getitemcount Gold001 >= 2500
                    Additem Gold001 2500
                    Set ChestGoldCount to (ChestGoldCount + 2500)
                    Player.RemoveItem Gold001 2500
               Endif
		Elseif (Button == 6)
               If PlayerGoldCount < 5000
                    Messagebox "You don’t have enough gold"
               Elseif player.Getitemcount Gold001 >= 5000
                    Additem Gold001 5000
                    Set ChestGoldCount to (ChestGoldCount + 5000)
                    Player.RemoveItem Gold001 5000
               Endif
		Elseif (Button == 7)
               If PlayerGoldCount < 10000
                    Messagebox "You don’t have enough gold"
               Elseif player.Getitemcount Gold001 >= 10000
                    Additem Gold001 10000
                    Set ChestGoldCount to (ChestGoldCount + 10000)
                    Player.RemoveItem Gold001 10000
               Endif
		Elseif (Button == 8)
               If PlayerGoldCount < 50000
                    Messagebox "You don’t have enough gold"
               Elseif player.Getitemcount Gold001 >= 50000
                    Additem Gold001 50000
                    Set ChestGoldCount to (ChestGoldCount + 50000)
                    Player.RemoveItem Gold001 50000
               Endif
		Elseif (Button == 9)
               Activate
          Endif
          Set ChestGoldCount to (Getitemcount Gold001)
Endif

If GetDayOfWeek != 0 && DoOnce == 1
     Set DoOnce to 0
Elseif GetDayOfWeek == 0 && DoOnce == 0
     RemoveItem Gold001 ChestGoldCount
     Set ChestGoldCount to (ChestGoldCount * (1.00 + PlayerLevel / 1000))
     AddItem Gold001 ChestGoldCount
     Message "You have received interest!"
     Set DoOnce to 1
Endif

End

Notes[edit | edit source]

I’m sorry if the script isn’t obvious due to Wiki formatting.