• 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.

Give Gold and / or Lumber System v 1.0.1.4

  • Like
Reactions: UndeadImmortal
This is a system that is simple to use. It allows you to use a custom lumber and / or gold give system in your map.

you can give it any command you want very simply. In the config trigger you simply type in the command that u want to trigger the give lumber and / or gold to another player.

These systems are separate. You dont need both for them to work. They are independant of one another.

Importing Steps
1) copy the config trigger first.
2) delete the variables that i put under the comments that said to delete them in the config trigger after posted.
3) copy the code trigger second.
4) set the string to what you want and try it out.

  • GiveGoldSystemConfig
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- This is the string command you want to activate the give gold. The capitilaztion matters for this code. so -giveGold and -givegold are different. --------
      • -------- I gave you the option to put a space after the give gold command. If you want -givegold to be the command then -givegold01 would give money to player 01 red. --------
      • -------- The reason this is -givegold01 is because i needed to add room for player 10 11 and 12. so this works for all players in game. --------
      • Set giveGoldString = -giveGold
      • -------- --------
      • -------- --------
      • -------- This allows you to tax the gold being traded. So lets say i give 100 gold to player 2 and the tax is 10% ( type in .10 for 10 percent) then i will lose 100 gold but only give player 2 90 gold. --------
      • Set giveGoldTax = 0.10
      • -------- --------
      • -------- --------
      • -------- Delete these variables after copying to ur map. --------
      • -------- --------
      • -------- --------
      • -------- This boolean lets u set if u want the player to be able to give gold. the index is for player red so player 1 gets the 1 index number. --------
      • -------- Make sure these are set to true in the variable editor. You can change these variables whenever you want and that player wont be able to give gold. --------
      • Set giveGoldBoolGiverPlayer[1] = True
      • -------- --------
      • -------- --------
      • -------- This boolean lets u set if u want the player to be able to recieve gold. the index is for player red so player 1 gets the 1 index number. --------
      • -------- Make sure these are set to true in the variable editor. You can change these variables whenever you want and that player wont be able to give gold. --------
      • Set giveGoldBoolReceivePlayer[1] = True
      • -------- --------
      • -------- --------
      • Set giveGoldLength1 = 0
      • Set giveGoldLength2 = 0
JASS:
    // Give Gold System v 1.0.1.4
    // by deathismyfriend

    function GiveGoldSystemActions takes nothing returns boolean
        local string entered
        local string sub1
        local integer recp // recieving player
        local integer money
        local integer p = GetPlayerId( GetTriggerPlayer())
        local integer i
        local playerstate psrg
        if udg_giveGoldBoolGiverPlayer[ p+1] then
            set entered = GetEventPlayerChatString()
            set sub1 = SubString( entered, 0, udg_giveGoldLength1)
            set recp = S2I( SubString( entered, udg_giveGoldLength1, udg_giveGoldLength2))
            if recp != p + 1 then
                if sub1 == udg_giveGoldString and udg_giveGoldBoolReceivePlayer[ recp] then
                    set money = S2I( SubString( entered, udg_giveGoldLength2, StringLength( entered)))
                    set psrg = PLAYER_STATE_RESOURCE_GOLD
                    set i = GetPlayerState( Player( p), psrg)
                    
                    if money < i then
                        call SetPlayerState( Player( recp), psrg, GetPlayerState( Player( recp), psrg) + R2I( I2R( money) * udg_giveGoldTax))
                    else
                        call SetPlayerState( Player( recp), psrg, GetPlayerState( Player( recp), psrg) + R2I( I2R( i) * udg_giveGoldTax))
                    endif
                    call SetPlayerState( Player( p), psrg, i - money)
                    set psrg = null
                endif
            endif
        endif
        return false
    endfunction

    function GiveGoldSystemSetup takes nothing returns nothing
        local trigger t = CreateTrigger()
        local integer L = 0
        local integer i = StringLength( udg_giveGoldString)
        loop
            exitwhen L > 11
            call TriggerRegisterPlayerChatEvent( t, Player( L), udg_giveGoldString, false)
            set L = L + 1
        endloop
        call TriggerAddCondition( t, Condition( function GiveGoldSystemActions))
        set udg_giveGoldLength1 = i
        set udg_giveGoldLength2 = i + 2
        set udg_giveGoldTax = 1.00 - udg_giveGoldTax
        call DestroyTimer( GetExpiredTimer())
        set t = null
    endfunction

    //===========================================================================
    function InitTrig_GiveGoldSystemCode takes nothing returns nothing
        call TimerStart( CreateTimer(), 0.00, false, function GiveGoldSystemSetup)
    endfunction

  • GiveLumberSystemConfig
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- This is the string command you want to activate the give lumber. The capitilaztion matters for this code. so -giveLumber and -givelumber are different. --------
      • -------- I gave you the option to put a space after the give Lumber command. If you want -giveLumber to be the command then -giveLumber01 would give money to player 01 red. --------
      • -------- The reason this is -giveLumber01 is because i needed to add room for player 10 11 and 12. so this works for all players in game. --------
      • Set giveLumberString = -giveLumber
      • -------- --------
      • -------- --------
      • -------- This allows you to tax the lumber being traded. So lets say i give 100 lumber to player 2 and the tax is 10% ( type in .10 for 10 percent) then i will lose 100 lumber but only give player 2 90 lumber. --------
      • Set giveLumberTax = 0.10
      • -------- --------
      • -------- --------
      • -------- Delete these variables after copying to ur map. --------
      • -------- --------
      • -------- --------
      • -------- This boolean lets u set if u want the player to be able to give lumber. the index is for player red so player 1 gets the 1 index number. --------
      • -------- Make sure these are set to true in the variable editor. You can change these variables whenever you want and that player wont be able to give lumber. --------
      • Set giveLumberBoolGiverPlayer[1] = True
      • -------- --------
      • -------- --------
      • -------- This boolean lets u set if u want the player to be able to recieve lumber. the index is for player red so player 1 gets the 1 index number. --------
      • -------- Make sure these are set to true in the variable editor. You can change these variables whenever you want and that player wont be able to give lumber. --------
      • Set giveLumberBoolReceivePlayer[1] = True
      • -------- --------
      • -------- --------
      • Set giveLumberLength1 = 0
      • Set giveLumberLength2 = 0
JASS:
    // Give Lumber System v 1.0.1.4
    // by deathismyfriend

    function GiveLumberSystemActions takes nothing returns boolean
        local string entered
        local string sub1
        local integer recp // recieving player
        local integer lumber
        local integer p = GetPlayerId( GetTriggerPlayer())
        local integer i
        local playerstate psrl
        if udg_giveLumberBoolGiverPlayer[ p+1] then
            set entered = GetEventPlayerChatString()
            set sub1 = SubString( entered, 0, udg_giveLumberLength1)
            set recp = S2I( SubString( entered, udg_giveLumberLength1, udg_giveLumberLength2))
            if recp != p + 1 then
                if sub1 == udg_giveLumberString and udg_giveGoldBoolReceivePlayer[ recp] then
                    set lumber = S2I( SubString( entered, udg_giveLumberLength2, StringLength( entered)))
                    set psrl = PLAYER_STATE_RESOURCE_LUMBER
                    set i = GetPlayerState( Player( p), psrl)
                    
                    if lumber < i then
                        call SetPlayerState( Player( recp), psrl, GetPlayerState( Player( recp), psrl) + R2I( I2R( lumber) * udg_giveLumberTax))
                    else
                        call SetPlayerState( Player(recp), psrl, GetPlayerState( Player( recp), psrl) + R2I( I2R( i) * udg_giveLumberTax))
                    endif
                    call SetPlayerState( Player( p), psrl, i - lumber)
                    set psrl = null
                endif
            endif
        endif
        return false
    endfunction

    function GiveLumberSystemSetup takes nothing returns nothing
        local trigger t = CreateTrigger()
        local integer L = 0
        local integer i = StringLength( udg_giveLumberString)
        loop
            exitwhen L > 11
            call TriggerRegisterPlayerChatEvent( t, Player( L), udg_giveLumberString, false)
            set L = L + 1
        endloop
        call TriggerAddCondition( t, Condition( function GiveLumberSystemActions))
        set udg_giveLumberLength1 = i
        set udg_giveLumberLength2 = i + 2
        call DestroyTimer( GetExpiredTimer())
        set t = null
    endfunction

    //===========================================================================
    function InitTrig_GiveLumberSystemCode takes nothing returns nothing
        call TimerStart( CreateTimer(), 0.00, false, function GiveLumberSystemSetup)
    endfunction



version 1.0.1.4
Made some improvements.​
version 1.0.1.3
Fixed a bug with giving gold to yourself.​
version 1.0.1.2
Fixed a huge bug with giving gold. It was giving gold to the wrong player b4.​
version 1.0.1.1
fixed a bug were useres without JNGP couldnt use this.
This can now be used by everyone.​
version 1.0.1.0
made changes to the code to allow for a more diverse approach.
you can now stop a player from recivieng or giving gold / lumber with a boolean.
One boolean for recieving and one boolean for giving gold / lumber
You can now put a tax on the gold / lumber that is traded.​
version 1.0.0.0
first version released​


Keywords:
GUI, GUI friendly, jass, give lumber, lumber, lumber system, give lumber system, deathismyfriend, dimf, give gold, gold, gold system, give gold system
Contents

Just another Warcraft III map (Map)

Reviews
15:56, 20th Aug 2013 PurgeandFire: Approved. Useful.

Moderator

M

Moderator

15:56, 20th Aug 2013
PurgeandFire: Approved. Useful.
 
You can just combine this and the gold system instead of c'n'p the code (plus minor modifications) purely for the sake of resource count.

it wasnt for resource count. it was because they are 2 completely different systems. Yes the code is very much the same but not a lot of ppl want gold and lumber in the same system as some of them dont use lumber.
 
this isnt an add gold system. this is a give gold system.

It is preset to go by the command -giveGold02 500
this will give 500 gold to player 2 if i have it. it will then subtract the gold i give from my gold. It is protected from giving to much gold. lets say i have 200 gold and i try to give 500. It will only allow me to give 200 gold no matter what.
 
I didn't make it with Esc because that would need a simple trigger to register player to player transfer. Where this allows player to player to player and so on transfer.

I'm not sure what u mean since u can change the giveGold command to anything u want simply by changing the string.

Also if I switch this to GUI I would just use all custom script anyways and looking at the white screen gives me migraines after a while
 
Well in case someone wants to enable the percentage it's a good idea.
Also remember wrda if anyone can find something to give them an advantage they will.

@ Chaosy
u think i should add a boolean array so they can turn of certain players when wanted ?
Like one that simply says true and it will let them trade gold. False for not able to trade gold. I can also add another so it will be true if they can receive gold ? this counts for the lumber system also.
 
Last edited:
Now that is a awesome solution!

the disable/enable giving/reciveing boolean was just perfect.

more gui would still be good


thanks lol. i try to keep all of the config in GUI. but the code is all in jass because i hate GUI lol but i prefer it that everyone is able to use my resource. Making the config in GUI is rather easy and it solves this problem a lot. They dont really need to know how the main code works anyways lol.
 
JASS:
local timer tmr = CreateTimer()
call TimerStart( tmr, 0.00, false, function GiveGoldSystemSetup)
set tmr = null

/* can be */
call TimerStart( CreateTimer(), 0.00, false, function GiveGoldSystemSetup)
/* same for */
call DestroyTimer( GetExpiredTimer() )
Both lumber and gold could be in same function
Also interface could look like this:
- G 01 500
or
- L 11 500

There is no need to write give because you always give, also gold, lumber can be just G or L.
 
JASS:
local timer tmr = CreateTimer()
call TimerStart( tmr, 0.00, false, function GiveGoldSystemSetup)
set tmr = null

/* can be */
call TimerStart( CreateTimer(), 0.00, false, function GiveGoldSystemSetup)
/* same for */
call DestroyTimer( GetExpiredTimer() )
Both lumber and gold could be in same function
Also interface could look like this:
- G 01 500
or
- L 11 500

There is no need to write give because you always give, also gold, lumber can be just G or L.

I forgot about the first part.

The commands are completely configurable. They can easily be made like that by changing the command.
 
Level 6
Joined
May 13, 2013
Messages
111
All instructions are above. You need to copy the triggers to your map and change the things you want to. Like the chat command which is preset to -giveGold01 1000
The above will give 1000 gold to player 1 red.

Ok... it works now... i suggest that there should be a text appearing after the trade so that they know if the gold / lumber was given to the target player and the amount of it. And the text should only appear on the trading players (i.e. the one who is paying and recieving the gold) and it should look like this: "Player 1 has given Player 2 1000 Gold" Without the quotes. Ok, bye now and your system is nice it works well in my map.:thumbs_up:
 
Level 12
Joined
May 20, 2009
Messages
822
Why not just this?

  • Give Gold
    • Events
      • Player - Player 1 (Red) types a chat message containing gold as An exact match
    • Conditions
    • Actions
      • Set Player = (Triggering player)
      • Player - Set Player Current gold to ((Player Current gold) + 500)
Then copy for each Player.

Much easier and I don't see why it wouldn't work.

EDIT: Oh I see, this is meant for like Trade Systems I guess. Probably still a less-complex way to go about things, but to each their own.
 
Why not just this?

  • Give Gold
    • Events
      • Player - Player 1 (Red) types a chat message containing gold as An exact match
    • Conditions
    • Actions
      • Set Player = (Triggering player)
      • Player - Set Player Current gold to ((Player Current gold) + 500)
Then copy for each Player.

Much easier and I don't see why it wouldn't work.

EDIT: Oh I see, this is meant for like Trade Systems I guess. Probably still a less-complex way to go about things, but to each their own.

This system does much more than allow easier trading for gold. It allows whatever amount you want to exchange. So exchanging 500 and 1234 is as simple as typing in that amount.
It allows for much more also.
 
Level 5
Joined
Sep 15, 2019
Messages
67
Hello. I have been trying to make a gold/ lumber pooling system for 6 months now without luck. I don't want you to feel bad for me I'm just extremely stupid. I've found over 10 gold pooling systems on this site as well as youtube/ google. For some reason I cannot get any of them to work and it drives me insane. -goldGive13 1000 (I have 4 player slots, pink 08, maroon 13, navy 14, emerald 23) and does nothing. I know I'm an idiot but I'm trying to just be able to pool resources. I can't pool resources by the allies tab either (which is all I need it to do). I've been studying this problem for way too long and still I barely even know what an integer or variable is, let alone how to make a simple pool a character resources. I'm at the point I'm ready to pay someone to make me this trigger(s). I've copy/ pasted/ edited way too many pooling resource systems which has never worked for me yet. I can't tell if I'm just really stupid or I'm really stupid and my map won't allow for resource pooling? Like a bug?
 
That's because the JASS script is hardcoded for 12 players. Do this script instead:

JASS:
    // Give Lumber System v 1.0.1.4
    // by deathismyfriend

    function GiveLumberSystemActions takes nothing returns boolean
        local string entered
        local string sub1
        local integer recp // recieving player
        local integer lumber
        local integer p = GetPlayerId( GetTriggerPlayer())
        local integer i
        local playerstate psrl
        if udg_giveLumberBoolGiverPlayer[ p+1] then
            set entered = GetEventPlayerChatString()
            set sub1 = SubString( entered, 0, udg_giveLumberLength1)
            set recp = S2I( SubString( entered, udg_giveLumberLength1, udg_giveLumberLength2))
            if recp != p + 1 then
                if sub1 == udg_giveLumberString and udg_giveGoldBoolReceivePlayer[ recp] then
                    set lumber = S2I( SubString( entered, udg_giveLumberLength2, StringLength( entered)))
                    set psrl = PLAYER_STATE_RESOURCE_LUMBER
                    set i = GetPlayerState( Player( p), psrl)
                  
                    if lumber < i then
                        call SetPlayerState( Player( recp), psrl, GetPlayerState( Player( recp), psrl) + R2I( I2R( lumber) * udg_giveLumberTax))
                    else
                        call SetPlayerState( Player(recp), psrl, GetPlayerState( Player( recp), psrl) + R2I( I2R( i) * udg_giveLumberTax))
                    endif
                    call SetPlayerState( Player( p), psrl, i - lumber)
                    set psrl = null
                endif
            endif
        endif
        return false
    endfunction

    function GiveLumberSystemSetup takes nothing returns nothing
        local trigger t = CreateTrigger()
        local integer L = 0
        local integer i = StringLength( udg_giveLumberString)
        loop
            exitwhen L > bj_MAX_PLAYER_SLOTS
            call TriggerRegisterPlayerChatEvent( t, Player( L), udg_giveLumberString, false)
            set L = L + 1
        endloop
        call TriggerAddCondition( t, Condition( function GiveLumberSystemActions))
        set udg_giveLumberLength1 = i
        set udg_giveLumberLength2 = i + 2
        call DestroyTimer( GetExpiredTimer())
        set t = null
    endfunction

    //===========================================================================
    function InitTrig_GiveLumberSystemCode takes nothing returns nothing
        call TimerStart( CreateTimer(), 0.00, false, function GiveLumberSystemSetup)
    endfunction
 
Level 5
Joined
Sep 15, 2019
Messages
67
OK i switched this with the other one (i couldn't tell a difference in the scripts), should there be one for the gold pooling too?
So it looks to me like this is the same exact script or am i missing something?
 
Last edited:
Top