• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Gold and / or Lumber Banking System v 1.0.0.6

This is a system for banking Gold and / or Lumber.
This system is GUI friendly. It is jass for the main code ( which u dont need to learn) It is GUI for all the config with very little custom scripts to use the whole system.
You can withdraw / deposit all or some gold / lumber with commands.
You can check your lumber or gold with a simple command.
All commands are easy to change. Just change the string in the config trigger and there you go.
You can give a single player or all players interest for the money in the players bank.

It is fully configurable with easy to use instructions in the config triggers.

  • GoldBankingSystemConfig
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- To withdraw or deposit certain amounts type in the desired chat like -wgold then the number u want to deposit or withdraw. Example -wgold 1000 will withdraw 1000 gold from the bank. --------
      • -------- --------
      • -------- --------
      • -------- This is for the withdraw string. Currently it is set to -wgold --------
      • Set withdrawGoldString = -wgold
      • -------- --------
      • -------- --------
      • -------- This is for the withdraw all string. This withdraws all of the gold in ur bank. Currently it is set to -wagold --------
      • Set withdrawAllGoldString = -wagold
      • -------- --------
      • -------- --------
      • -------- This is for the deposit string. Currently it is set to -dgold --------
      • Set depositGoldString = -dgold
      • -------- --------
      • -------- --------
      • -------- This is for the deposit all string. This deposits all of the current gold you have. Currently it is set to -dagold --------
      • Set depositAllGoldString = -dagold
      • -------- --------
      • -------- --------
      • -------- This is for the check string. This checks the amount of gold you have in the bank. Currently it is set to -checkgold --------
      • Set checkBankGoldString = -checkgold
      • -------- --------
      • -------- --------
      • -------- This variable allows you to stop a player from withdrawing from their bank. To do this set the index for the player number and set the variable to false. example index 1 is for player 1 red --------
      • Set withdrawGoldBoolPlayer[1] = True
      • -------- --------
      • -------- --------
      • -------- This variable allows you to stop a player from depositing from their bank. To do this set the index for the player number and set the variable to false. example index 1 is for player 1 red --------
      • Set depositGoldBoolPlayer[1] = True
      • Set depositGoldBoolPlayer[1] = True
      • -------- --------
      • -------- --------
      • -------- This function allows you to display to a player their gold in the bank. I have the check chat message for the player to use but if you want to display it for a specific player at any given time use this. --------
      • -------- function CheckGoldBankSinglePlayer takes player pl returns nothing --------
      • -------- To use this function you use custom script: and do this. --------
      • -------- call CheckGoldBankSinglePlayer( udg_tempPlayer) --------
      • -------- As you can see i put tempPlayer variable in there. just put the player you want to show this to into the tempPlayer variable. --------
      • -------- --------
      • -------- --------
      • -------- This function allows you to display every players bank gold with a simple value. --------
      • -------- function DisplayGoldBankStatusAll takes nothing returns nothing --------
      • -------- To use this function you use custom script: and do this. --------
      • -------- call DisplayGoldBankStatusAll() --------
      • -------- It will then display to each player their own bank value. --------
      • -------- --------
      • -------- --------
      • -------- This function allows you to increase a certain players bank value based on a percent value. --------
      • -------- function GoldBankInterestIncSinglePlayer takes player pl, real r returns nothing --------
      • -------- To use this function you use custom script: and do this. --------
      • -------- call GoldBankInterestIncSinglePlayer( udg_tempPlayer, udg_tempReal) --------
      • -------- it will then increase a single players bank value based on the real value you put in. this is based on a percentage value so 20% is .20 --------
      • -------- --------
      • -------- --------
      • -------- This function allows you to increase all players bank value based on a percent value. --------
      • -------- function GoldBankInterestIncAll takes real r returns nothing --------
      • -------- To use this function you use custom script: and do this. --------
      • -------- GoldBankInterestIncAll( udg_tempReal) --------
      • -------- it will then increase all players bank value based on the real value you put in. this is based on a percentage value so 20% is .20 --------
      • -------- --------
      • -------- --------
      • -------- --------
      • -------- This function allows you to store a certain amount of gold from the player. --------
      • -------- function GoldBankForcedBanking takes player P, integer amount returns nothing --------
      • -------- To use this function you use custom script: and do this. --------
      • -------- GoldBankForcedBanking( player, amount) --------
      • -------- It will automatically remove the gold from the player and store it in there bank. There is not a check to see if that player has the amount of gold that is being added so be careful using this. --------
      • -------- --------
      • -------- --------
      • -------- --------
      • -------- Delete everything after this point after posting into your map --------
      • Set checkGoldBankSystemInt = 0
      • Set depositGoldAllBankSystemInt = 0
      • Set depositGoldBankSystemInt = 0
      • Set withdrawGoldAllBankSystemInt = 0
      • Set withdrawGoldBankSystemInt = 0
      • Set goldBankGold[1] = 0
JASS:
    // Gold Banking System version 1.0.0.6
    // by deathismyfriend
    
    function GoldBankForcedBuying takes player P, integer amount returns boolean
        local integer p = GetPlayerId( P)
        local integer i
        if udg_goldBankGold[ p] >= amount then
            set udg_goldBankGold[ p] = udg_goldBankGold[ p] - amount
            return true
        elseif udg_goldBankGold[ p] + GetPlayerState( P, PLAYER_STATE_RESOURCE_GOLD) >= amount then
            set i = amount - udg_goldBankGold[ p]
            set udg_goldBankGold[ p] = 0
            call SetPlayerState( P, PLAYER_STATE_RESOURCE_GOLD, GetPlayerState( P, PLAYER_STATE_RESOURCE_GOLD) - i)
            return true
        endif
        return false
    endfunction
    
    function GoldBankForcedBanking takes player P, integer amount returns nothing
        local integer p = GetPlayerId( P)
        call SetPlayerState( P, PLAYER_STATE_RESOURCE_GOLD, GetPlayerState( P, PLAYER_STATE_RESOURCE_GOLD) - amount)
        set udg_goldBankGold[ p] = udg_goldBankGold[ p] + amount
    endfunction

    function CheckGoldBankSinglePlayer takes player pl returns nothing
        local integer p = GetPlayerId( pl)
        call DisplayTextToPlayer( Player( p), 0 , 0, "You have " + I2S( udg_goldBankGold[ p]) + " gold in your bank")
    endfunction
    
    function DisplayGoldBankStatusAll takes nothing returns nothing
        local integer L = 0
        loop
            exitwhen L > 11
            call CheckGoldBankSinglePlayer( Player( L))
            set L = L + 1
        endloop
    endfunction
    
    function GoldBankInterestIncSinglePlayer takes player pl, real r returns nothing
        local integer p = GetPlayerId( pl)
        set r = r + 1.00
        set udg_goldBankGold[ p] = R2I( udg_goldBankGold[ p] * r)
    endfunction
    
    function GoldBankInterestIncAll takes real r returns nothing
        local integer L = 0
        loop
            exitwhen L > 11
            call GoldBankInterestIncSinglePlayer( Player( L), r)
            set L = L + 1
        endloop
    endfunction
    
    function GoldBankingSystemWithdraw takes nothing returns boolean
        local string entered = GetEventPlayerChatString()
        local string sub1 = SubString( entered, 0, udg_withdrawGoldBankSystemInt)
        local string sub2 = SubString( entered, 0, udg_withdrawGoldAllBankSystemInt)
        local integer p = GetPlayerId( GetTriggerPlayer())
        local integer gold
        local playerstate psrg = PLAYER_STATE_RESOURCE_GOLD
        local player pl = Player( p)
        
        if udg_withdrawGoldBoolPlayer[ p + 1] then
            if sub1 == udg_withdrawGoldString then
                set gold = S2I( SubString( entered, udg_depositGoldBankSystemInt, StringLength( entered)))
                if udg_goldBankGold[ p] > gold then
                    call SetPlayerState( pl, psrg, GetPlayerState( pl, psrg) + gold)
                    set udg_goldBankGold[ p] = udg_goldBankGold[ p] - gold
                else
                    set gold = udg_goldBankGold[ p]
                    call SetPlayerState( pl, psrg, GetPlayerState( pl, psrg) + gold)
                    set udg_goldBankGold[ p] = 0
                endif
            elseif sub2 == udg_withdrawAllGoldString then
                call SetPlayerState( pl, psrg, GetPlayerState( pl, psrg) + udg_goldBankGold[ p])
                set udg_goldBankGold[ p] = 0
            endif
        endif
        
        call CheckGoldBankSinglePlayer( pl)
        set pl = null
        set psrg = null
        return false
    endfunction

    function GoldBankingSystemDeposit takes nothing returns boolean
        local string entered = GetEventPlayerChatString()
        local string sub1 = SubString( entered, 0, udg_depositGoldBankSystemInt)
        local string sub2 = SubString( entered, 0, udg_depositGoldAllBankSystemInt)
        local integer p = GetPlayerId( GetTriggerPlayer())
        local integer gold
        local playerstate psrg = PLAYER_STATE_RESOURCE_GOLD
        local integer i
        local player pl = Player( p)   
        
        if udg_depositGoldBoolPlayer[ p + 1] then
            if sub1 == udg_depositGoldString then
                set gold = S2I( SubString( entered, udg_depositGoldBankSystemInt, StringLength( entered)))
                set i = GetPlayerState( pl, psrg)
                if gold > i then
                    call SetPlayerState( pl, psrg, 0)
                    set udg_goldBankGold[ p] = udg_goldBankGold[ p] + i
                else
                    call SetPlayerState( pl, psrg, i - gold)
                    set udg_goldBankGold[ p] = udg_goldBankGold[ p] + gold
                endif
            elseif sub2 == udg_depositAllGoldString then
                set i = GetPlayerState( pl, psrg)
                call SetPlayerState( pl, psrg, 0)
                set udg_goldBankGold[ p] = udg_goldBankGold[ p] + i
            endif
        endif
            
        call CheckGoldBankSinglePlayer( pl)
        set pl = null
        set psrg = null
        return false
    endfunction
    
    function GoldBankingSystemCheck takes nothing returns boolean
        if SubString( GetEventPlayerChatString(), 0, udg_checkGoldBankSystemInt) == udg_checkBankGoldString then
            call CheckGoldBankSinglePlayer( GetTriggerPlayer())
        endif
        
        return false
    endfunction

    function GoldBankingSystemSetup takes nothing returns nothing
        local trigger t1 = CreateTrigger()
        local trigger t2 = CreateTrigger()
        local trigger t3 = CreateTrigger()
        local integer L = 0
        local player P
        loop
            exitwhen L > 11
            set P = Player( L)
            // Check if the player is playing and if that player is a user so this will only register the actual players.
            if GetPlayerSlotState( P) == PLAYER_SLOT_STATE_PLAYING and GetPlayerController( P) == MAP_CONTROL_USER then
                call TriggerRegisterPlayerChatEvent( t1, P, udg_withdrawGoldString, false)
                call TriggerRegisterPlayerChatEvent( t1, P, udg_withdrawAllGoldString, false)
                call TriggerRegisterPlayerChatEvent( t2, P, udg_depositGoldString, false)
                call TriggerRegisterPlayerChatEvent( t2, P, udg_depositAllGoldString, false)
                call TriggerRegisterPlayerChatEvent( t3, P, udg_checkBankGoldString, false)
            endif
            set L = L + 1
        endloop
        set udg_withdrawGoldBankSystemInt = StringLength( udg_withdrawGoldString)
        set udg_withdrawGoldAllBankSystemInt = StringLength( udg_withdrawAllGoldString)
        set udg_depositGoldBankSystemInt = StringLength( udg_depositGoldString)
        set udg_depositGoldAllBankSystemInt = StringLength( udg_depositAllGoldString)
        set udg_checkGoldBankSystemInt = StringLength( udg_checkBankGoldString)
        call TriggerAddCondition( t1, Condition( function GoldBankingSystemWithdraw))
        call TriggerAddCondition( t2, Condition( function GoldBankingSystemDeposit))
        call TriggerAddCondition( t3, Condition( function GoldBankingSystemCheck))
        call DestroyTimer( GetExpiredTimer())
        set P = null
        set t1 = null
        set t2 = null
        set t3 = null
    endfunction

    //===========================================================================
    function InitTrig_GoldBankingSystemCode takes nothing returns nothing
        call TimerStart( CreateTimer(), 0.00, false, function GoldBankingSystemSetup)
    endfunction

  • LumberBankingSystemConfig
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- To withdraw or deposit certain amounts type in the desired chat like -wlumber then the number u want to deposit or withdraw. Example -wlumber 1000 will withdraw 1000 lumber from the bank. --------
      • -------- --------
      • -------- --------
      • -------- This is for the withdraw string. Currently it is set to -wlumber --------
      • Set withdrawLumberString = -wlumber
      • -------- --------
      • -------- --------
      • -------- This is for the withdraw all string. This withdraws all of the lumber in ur bank. Currently it is set to -walumber --------
      • Set withdrawAllLumberString = -walumber
      • -------- --------
      • -------- --------
      • -------- This is for the deposit string. Currently it is set to -dlumber --------
      • Set depositLumberString = -dlumber
      • -------- --------
      • -------- --------
      • -------- This is for the deposit all string. This deposits all of the current lumber you have. Currently it is set to -dalumber --------
      • Set depositAllLumberString = -dalumber
      • -------- --------
      • -------- --------
      • -------- This is for the check string. This checks the amount of lumber you have in the bank. Currently it is set to -checklumber --------
      • Set checkBankLumberString = -checklumber
      • -------- --------
      • -------- --------
      • -------- This variable allows you to stop a player from withdrawing from their bank. To do this set the index for the player number and set the variable to false. example index 1 is for player 1 red --------
      • Set withdrawLumberBoolPlayer[1] = True
      • -------- --------
      • -------- --------
      • -------- This variable allows you to stop a player from depositing from their bank. To do this set the index for the player number and set the variable to false. example index 1 is for player 1 red --------
      • Set depositLumberBoolPlayer[1] = True
      • -------- --------
      • -------- --------
      • -------- This function allows you to display to a player their lumber in the bank. I have the check chat message for the player to use but if you want to display it for a specific player at any given time use this. --------
      • -------- function CheckLumberBankSinglePlayer takes player pl returns nothing --------
      • -------- To use this function you use custom script: and do this. --------
      • -------- call CheckLumberBankSinglePlayer( udg_tempPlayer) --------
      • -------- As you can see i put tempPlayer variable in there. just put the player you want to show this to into the tempPlayer variable. --------
      • -------- --------
      • -------- --------
      • -------- This function allows you to display every players bank lumber with a simple value. --------
      • -------- function DisplayLumberBankStatusAll takes nothing returns nothing --------
      • -------- To use this function you use custom script: and do this. --------
      • -------- call DisplayLumberBankStatusAll() --------
      • -------- It will then display to each player their own bank value. --------
      • -------- --------
      • -------- --------
      • -------- This function allows you to increase a certain players bank value based on a percent value. --------
      • -------- function LumberBankInterestIncSinglePlayer takes player pl, real r returns nothing --------
      • -------- To use this function you use custom script: and do this. --------
      • -------- call LumberBankInterestIncSinglePlayer( udg_tempPlayer, udg_tempReal) --------
      • -------- it will then increase a single players bank value based on the real value you put in. this is based on a percentage value so 20% is .20 --------
      • -------- --------
      • -------- --------
      • -------- This function allows you to increase all players bank value based on a percent value. --------
      • -------- function LumberBankInterestIncAll takes real r returns nothing --------
      • -------- To use this function you use custom script: and do this. --------
      • -------- call LumberBankInterestIncAll( udg_tempReal) --------
      • -------- it will then increase all players bank value based on the real value you put in. this is based on a percentage value so 20% is .20 --------
      • -------- --------
      • -------- --------
      • -------- --------
      • -------- This function allows you to store a certain amount of lumber from the player. --------
      • -------- function LumberBankForcedBanking takes player P, integer amount returns nothing --------
      • -------- To use this function you use custom script: and do this. --------
      • -------- call LumberBankForcedBanking( player, amount) --------
      • -------- It will automatically remove the lumber from the player and store it in there bank. There is not a check to see if that player has the amount of lumber that is being added so be careful using this. --------
      • -------- --------
      • -------- --------
      • -------- --------
      • -------- Delete everything after this point after posting into your map --------
      • Set checkLumberBankSystemInt = 0
      • Set depositLumberAllBankSystemInt = 0
      • Set depositLumberBankSystemInt = 0
      • Set withdrawLumberAllBankSystemInt = 0
      • Set withdrawLumberBankSystemInt = 0
      • Set lumberBankLumber[1] = 0
JASS:
    // Lumber Banking System version 1.0.0.6
    // by deathismyfriend
    
    function LumberBankForcedBuying takes player P, integer amount returns boolean
        local integer p = GetPlayerId( P)
        local integer i
        if udg_lumberBankLumber[ p] >= amount then
            set udg_lumberBankLumber[ p] = udg_lumberBankLumber[ p] - amount
            return true
        elseif udg_lumberBankLumber[ p] + GetPlayerState( P, PLAYER_STATE_RESOURCE_LUMBER) >= amount then
            set i = amount - udg_lumberBankLumber[ p]
            set udg_lumberBankLumber[ p] = 0
            call SetPlayerState( P, PLAYER_STATE_RESOURCE_LUMBER, GetPlayerState( P, PLAYER_STATE_RESOURCE_LUMBER) - i)
            return true
        endif
        return false
    endfunction
    
    function LumberBankForcedBanking takes player P, integer amount returns nothing
        local integer p = GetPlayerId( P)
        call SetPlayerState( P, PLAYER_STATE_RESOURCE_LUMBER, GetPlayerState( P, PLAYER_STATE_RESOURCE_LUMBER) - amount)
        set udg_lumberBankLumber[ p] = udg_lumberBankLumber[ p] + amount
    endfunction

    function CheckLumberBankSinglePlayer takes player pl returns nothing
        local integer p = GetPlayerId( pl)
        call DisplayTextToPlayer( Player( p), 0 , 0, "You have " + I2S( udg_lumberBankLumber[ p]) + " lumber in your bank")
    endfunction
    
    function DisplayLumberBankStatusAll takes nothing returns nothing
        local integer L = 0
        loop
            exitwhen L > 11
            call CheckLumberBankSinglePlayer( Player( L))
            set L = L + 1
        endloop
    endfunction
    
    function LumberBankInterestIncSinglePlayer takes player pl, real r returns nothing
        local integer p = GetPlayerId( pl)
        set r = r + 1.00
        set udg_lumberBankLumber[ p] = R2I( udg_lumberBankLumber[ p] * r)
    endfunction
    
    function LumberBankInterestIncAll takes real r returns nothing
        local integer L = 0
        loop
            exitwhen L > 11
            call LumberBankInterestIncSinglePlayer( Player( L), r)
            set L = L + 1
        endloop
    endfunction
    
    function LumberBankingSystemWithdraw takes nothing returns boolean
        local string entered = GetEventPlayerChatString()
        local string sub1 = SubString( entered, 0, udg_withdrawLumberBankSystemInt)
        local string sub2 = SubString( entered, 0, udg_withdrawLumberAllBankSystemInt)
        local integer p = GetPlayerId( GetTriggerPlayer())
        local integer lumber
        local playerstate psrl = PLAYER_STATE_RESOURCE_LUMBER
        local player pl = Player( p)
        
        if udg_withdrawLumberBoolPlayer[ p + 1] then
            if sub1 == udg_withdrawLumberString then
                set lumber = S2I( SubString( entered, udg_depositLumberBankSystemInt, StringLength( entered)))
                if udg_lumberBankLumber[ p] > lumber then
                    call SetPlayerState( pl, psrl, GetPlayerState( pl, psrl) + lumber)
                    set udg_lumberBankLumber[ p] = udg_lumberBankLumber[ p] - lumber
                else
                    set lumber = udg_lumberBankLumber[ p]
                    call SetPlayerState( pl, psrl, GetPlayerState( pl, psrl) + lumber)
                    set udg_lumberBankLumber[ p] = 0
                endif
            elseif sub2 == udg_withdrawAllLumberString then
                call SetPlayerState( pl, psrl, GetPlayerState( pl, psrl) + udg_lumberBankLumber[ p])
                set udg_lumberBankLumber[ p] = 0
            endif
        endif
        
        call CheckLumberBankSinglePlayer( pl)
        set pl = null
        set psrl = null
        return false
    endfunction

    function LumberBankingSystemDeposit takes nothing returns boolean
        local string entered = GetEventPlayerChatString()
        local string sub1 = SubString( entered, 0, udg_depositLumberBankSystemInt)
        local string sub2 = SubString( entered, 0, udg_depositLumberAllBankSystemInt)
        local integer p = GetPlayerId( GetTriggerPlayer())
        local integer lumber
        local playerstate psrl = PLAYER_STATE_RESOURCE_LUMBER
        local integer i
        local player pl = Player( p)
        
        if udg_depositLumberBoolPlayer[ p + 1] then
            if sub1 == udg_depositLumberString then
                set lumber = S2I( SubString( entered, udg_depositLumberBankSystemInt, StringLength( entered)))
                set i = GetPlayerState( pl, psrl)
                if lumber > i then
                    call SetPlayerState( pl, psrl, 0)
                    set udg_lumberBankLumber[ p] = udg_lumberBankLumber[ p] + i
                else
                    call SetPlayerState( pl, psrl, i - lumber)
                    set udg_lumberBankLumber[ p] = udg_lumberBankLumber[ p] + lumber
                endif
            elseif sub2 == udg_depositAllLumberString then
                set i = GetPlayerState( pl, psrl)
                call SetPlayerState( pl, psrl, 0)
                set udg_lumberBankLumber[ p] = udg_lumberBankLumber[ p] + i
            endif
        endif
            
        call CheckLumberBankSinglePlayer( pl)
        set pl = null
        set psrl = null
        return false
    endfunction
    
    function LumberBankingSystemCheck takes nothing returns boolean
        if SubString( GetEventPlayerChatString(), 0, udg_checkLumberBankSystemInt) == udg_checkBankLumberString then
            call CheckLumberBankSinglePlayer( GetTriggerPlayer())
        endif
        
        return false
    endfunction

    function LumberBankingSystemSetup takes nothing returns nothing
        local trigger t1 = CreateTrigger()
        local trigger t2 = CreateTrigger()
        local trigger t3 = CreateTrigger()
        local integer L = 0
        local player P
        loop
            exitwhen L > 11
            set P = Player( L)
            // Check if the player is playing and if that player is a user so this will only register the actual players.
            if GetPlayerSlotState( P) == PLAYER_SLOT_STATE_PLAYING and GetPlayerController( P) == MAP_CONTROL_USER then
                call TriggerRegisterPlayerChatEvent( t1, P, udg_withdrawLumberString, false)
                call TriggerRegisterPlayerChatEvent( t1, P, udg_withdrawAllLumberString, false)
                call TriggerRegisterPlayerChatEvent( t2, P, udg_depositLumberString, false)
                call TriggerRegisterPlayerChatEvent( t2, P, udg_depositAllLumberString, false)
                call TriggerRegisterPlayerChatEvent( t3, P, udg_checkBankLumberString, false)
            endif
            set L = L + 1
        endloop
        set udg_withdrawLumberBankSystemInt = StringLength( udg_withdrawLumberString)
        set udg_withdrawLumberAllBankSystemInt = StringLength( udg_withdrawAllLumberString)
        set udg_depositLumberBankSystemInt = StringLength( udg_depositLumberString)
        set udg_depositLumberAllBankSystemInt = StringLength( udg_depositAllLumberString)
        set udg_checkLumberBankSystemInt = StringLength( udg_checkBankLumberString)
        call TriggerAddCondition( t1, Condition( function LumberBankingSystemWithdraw))
        call TriggerAddCondition( t2, Condition( function LumberBankingSystemDeposit))
        call TriggerAddCondition( t3, Condition( function LumberBankingSystemCheck))
        call DestroyTimer( GetExpiredTimer())
        set P = null
        set t1 = null
        set t2 = null
        set t3 = null
    endfunction
    
    //===========================================================================
    function InitTrig_LumberBankingSystemCode takes nothing returns nothing
        call TimerStart( CreateTimer(), 0.00, false, function LumberBankingSystemSetup)
    endfunction


version 1.0.0.6
Added a function to allow users to remove a certain amount of gold for that players bank.
This returns a boolean. True means the player has the required resource.
This can be used if you want items that require gold / lumber over the cap.
Thanks for the idea Nes​
version 1.0.0.5
Added a function that will allow users to force bank a players gold​
version 1.0.0.4
fixed the things suggested by purge.​
version 1.0.0.3
fixed a bug were anyone without JNGP couldnt use this.
This can now be used by everyone​
version 1.0.0.2
fixed a small bug​
version 1.0.0.1
fixed a few small errors​
version 1.0.0.0
first version released​


Keywords:
gold, gold banking, gold bank, gold bank system, gold banking system, lumber, lumber banking, lumber bank, lumber banking system, lumber bank system,
Contents

Just another Warcraft III map (Map)

Reviews
18:27, 19th Aug 2013 PurgeandFire: Changes made, approved.

Moderator

M

Moderator

18:27, 19th Aug 2013
PurgeandFire: Changes made, approved.
 
Overall it is a neat idea. :thumbs_up:

Review:
  • In the init:
    JASS:
        function InitTrig_GoldBankingSystemCode takes nothing returns nothing
            local timer tmr = CreateTimer()
            call TimerStart( tmr, 0.00, false, function GoldBankingSystemSetup)
            set tmr = null
        endfunction
    You can simplify it to:
    call TimerStart(CreateTimer(), 0.00, false, function GoldBankingSystemSetup)
  • In "GoldBankingSystemSetup", you can just use:
    call DestroyTimer(GetExpiredTimer())
    Instead of assigning it to a local, destroying it, then nulling the local.
  • Only register chat events for players who are playing. ;)
  • Why did you save: PLAYER_STATE_RESOURCE_GOLD?
    Okay, I see that you might've wanted to use it for a shorter name. Instead you may just want to assign an integer to GetPlayerState(p1, PLAYER_STATE_RESOURCE_GOLD) and use that.
  • For this line:
    set udg_goldBankGold[ p] = R2I( I2R( udg_goldBankGold[ p]) * r)
    You should be able to just have:
    set udg_goldBankGold[ p] = R2I( udg_goldBankGold[ p] * r)
    When you multiply an integer by a real, it will return a real, so you don't need to typecast it.
  • Same things for the lumber system.
  • Bug: In the test map, I type -dlumber and it deposits my gold. It also will withdraw my gold when I type -wlumber. It should be withdrawing/depositing my lumber, but it doesn't.
  • Suggestions: You might want to add a check to see if the script starts with the command before applying the effect. Why? A lot of people ask each other what the commands are. If someone types:
    "hey nub, type -wgold ### to withdraw your gold from your bank"
    It'll show the person's gold because it detects the -wgold part of the string. I'm not saying it will bug out--your system handles it nicely and will only display the gold they have in their bank--it won't actually do anything if they type an invalid message (which is good). This is just an optional suggestion.

Other than that, nice job with the system. Fix those and it will be approvable!
 
Overall it is a neat idea. :thumbs_up:

Review:
In the init:
JASS:
    function InitTrig_GoldBankingSystemCode takes nothing returns nothing
        local timer tmr = CreateTimer()
        call TimerStart( tmr, 0.00, false, function GoldBankingSystemSetup)
        set tmr = null
    endfunction
You can simplify it to:
call TimerStart(CreateTimer(), 0.00, false, function GoldBankingSystemSetup)
In "GoldBankingSystemSetup", you can just use:
call DestroyTimer(GetExpiredTimer())
Instead of assigning it to a local, destroying it, then nulling the local.

I will do that. For some reason i didn't think about doing that lol.


Only register chat events for players who are playing. ;)

will do

Why did you save: PLAYER_STATE_RESOURCE_GOLD?
Okay, I see that you might've wanted to use it for a shorter name. Instead you may just want to assign an integer to GetPlayerState(p1, PLAYER_STATE_RESOURCE_GOLD) and use that.

I did that to make it shorter yes. It makes it easier to read. Also if i set an integer to getplayerstate then when i use set player state i can't use the shorter variable. I'd rather leave that that way. Also i do store get player state to an integer already.

For this line:
set udg_goldBankGold[ p] = R2I( I2R( udg_goldBankGold[ p]) * r)
You should be able to just have:
set udg_goldBankGold[ p] = R2I( udg_goldBankGold[ p] * r)
When you multiply an integer by a real, it will return a real, so you don't need to typecast it.
Same things for the lumber system.

changed that. Thanks

Bug: In the test map, I type -dlumber and it deposits my gold. It also will withdraw my gold when I type -wlumber. It should be withdrawing/depositing my lumber, but it doesn't.

That was my mistake. Fixed that

Suggestions: You might want to add a check to see if the script starts with the command before applying the effect. Why? A lot of people ask each other what the commands are. If someone types:
"hey nub, type -wgold ### to withdraw your gold from your bank"
It'll show the person's gold because it detects the -wgold part of the string. I'm not saying it will bug out--your system handles it nicely and will only display the gold they have in their bank--it won't actually do anything if they type an invalid message (which is good). This is just an optional suggestion.

There is a string that allows players to check the gold / lumber in their bank if they want. Is that what you mean ?

Other than that, nice job with the system. Fix those and it will be approvable!

Thanks changes have been made hope to see this approved soon.
 
Top