More than 1M gold--income help

Valtarian

Member
Hello,
I currently am working on WmW X14. Pretty much it has an income timer that ends every 25 seconds, and starts over again. Once the timer hits 0 seconds, you receive your amount of income for that round.

Recently, I've made it so you can have over 1 million gold... by the following method:

Player reds gold becomes greater than 420,000
Remove 70,000 gold from player red
Add 1 wood to player red

and...

If player reds gold becomes less than 270,000
remove 1 wood from player red
add 70,000 gold to player reds stash

HOWEVER, HERE IS WHERE THE PROBLEM LIES:
If someone has over 1,000,000 income, it will give them the 420,000 gold and the correct wood amount to equal out 1M.

Example:

Red's income is 1,800,000

Income timer hits 0....
He receives 420,000 gold and 8 wood.
420,000 gold plus 8 wood (70k each) should be roughly ONE MILLION, therefore red is not getting the extra 800,000 income that he has been playing for.

I know there is a way to fix this, I was thinking maybe since income is an integer, if player Red's income is greater than 1,000,000, give him 1 wood for every additional 70k income?

I don't know. Can anyone help me with this? Thank you in advance!
 

Tharius

Occasionally Around
Is there no other way for a player to earn gold or wood at all, other than through income? If not, this is probably the issue:

Using your example, the player presumably starts with 0 gold and 0 wood. The player then gains 1,800,000 income each tick. It sounds as though you convert the 1,800,000 income directly to gold, by adding 1,800,000 gold to the player's gold count. Then, since 1,800,000 is greater than 420,000, it should add 20 wood and remove 20*70,000=1,400,000 gold. The problem is, since gold is capped at 1,000,000, it's not actually adding 1,800,000 gold at all, and the calculations are based on an income of 1,000,000-(current gold).

Your "fix" runs into a similar problem if the player has more than 0 gold. The player will get extra lumber to compensate for the (in the example) 800,000 income beyond the first million, but you still can't add 1 million gold to, say, 400,000 gold and expect the game to remember it as 1,400,000. The player will still end up losing approximately 600,000 gold in income.


Instead, what you want to do is first figure out how much wood you want to add (in the example above, 20), then how much gold you want to add (in the example above, 400,000). To start, figure out how much total gold you would have, not counting current wood, if WC3 could store gold above 1 million. That's easily done by adding current gold to the income amount (0 + 1,800,000 = 1,800,000 in the example). Subtract 420,000 from that amount (1,800,000 - 420,000 = 1,380,000 in the example), then divide that result by 70,000 and round up to the nearest whole number (1,380,000/70,000 is approximately 19.71, rounded up to 20, in the example). This gives you the amount of wood that you need to add (in your example, 20).

Now that you know the wood, how much gold do you add? First multiply the amount of wood by 70,000 (20*70,000 = 1,400,000 in the example), then subtract that number from the sum of the player's current gold (0 in the example) and income (1,800,000 in the example) to find the new amount of gold ((0 + 1,800,000) - 1,400,000 = 400,000 in the example). This is the amount of gold to which you have to change the current value (not add to the current value).


For a second example with other numbers, and non-zero amounts of initial gold and wood:

The player starts with 220,000 gold and 6 wood, and has an income of 4,000,000.

Total gold discounting wood is 4,000,000 + 220,000 = 4,220,000
Gold needing conversion to wood is 4,220,000 - 420,000 = 3,800,000
Amount of wood after conversion is 3,800,000/70,000 = 54.29
Converted wood rounded up is 54.29 rounded up = 55
Total wood after income is 6 + 55 = 61 wood

Total gold being converted to wood is 55*70,000 = 3,850,000
Total initial gold discounting wood was 4,000,000 + 220,000 = 4,220,000
Total gold after income is 4,220,000 - 3,850,000 = 370,000 gold

The player ends with 370,000 gold and 61 wood.


By the way, why such arbitrary values as 420,000 gold cap and 70,000:1 gold:wood conversion? A 100,000 or 500,000 gold cap and 100,000:1 gold:wood conversion would be much simpler.
 

Happy

Well-Known Member
why not just checking before adding the income whether its over 1,000,000 and if it is covert it before adding it?
 

Valtarian

Member
That's what I'm trying to do. Tharius kind of restated how I said I hope to fix it. I'm just not sure how to do that... I've got an idea but I'm not seeing it in GUI
 

Tharius

Occasionally Around
What exactly are you having a problem finding? If you post specifics, there are several people on this forum who can point out what you need and where to find it.
 

Valtarian

Member
Well, Tharius... Let me just thank you real quick for taking your time to help. I really appreciate it, and you definitely have the right idea as to what I'm looking for.

If I can elaborate and really try to be as specific as possible...

This is an image of the map that I am currently working on:


Now, when the game begins there is a timer that restarts every 25 seconds.

This timer starts at 25, and goes down to 0. At every 0, players acquire the "income" that they have earned while playing the game.

(Note: you earn income by sending creeps through Shrines. These creeps go to your opponents side. Your goal is to make the other player leak lives--It's a tower defense. The income of each creep is determined by the creeps "point value").

Now as we all know, there is a $1,000,000 gold limit in Warcraft III. Therefore, any income over $1,000,000 is being wasted and is not being granted to the player.

So I devised a "max gold" system, where if a player receives lets say 500,000 gold, 80,000 gold is deducted from his stash and he receives one wood. And to transfer the wood to gold, if he goes under a certain amount of gold-he receives 80k and loses one lumber. However, I have noticed that regardless of this system/income... the player still seems to get approximately 1 million gold. However, given the system, the player may receive 500k and 6 wood (80k each) averaging out to be approximately one million gold. So, obviously my system does not work.

I would love to get it to work if anyone has any ideas, but otherwise, I have another idea in mind:

I could possibly make it so where if a player has over 1,000,000 income, he receives 1 wood for every additional 10k income.... and if the player goes under 800k, he loses whatever X amount of wood it takes to fill his stash to 1M gold.

I hope I was specific enough, I'd really like to find a solution to this. Thank you very much for all of your responses
 

Tharius

Occasionally Around
Sorry I didn't respond sooner, my internet died for a good 12 hours.

I was actually talking about your statement that you couldn't find something in the GUI actions, by the way. If you could post the relevant parts of your triggers and highlight what parts you don't think are working, or even a copy of your WIP map, it would help narrow the problem down.

If you don't want to do that, try starting off with 420,000 gold and adding 10,000,000 income, and try starting off with 1,000,000 gold and adding 10,000,000 income, and tell us how much gold and lumber your trigger actually gives you. If you're having the problem I outlined earlier, you won't be getting nearly 1,000,000 income worth of gold and lumber with those starting numbers.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    wizard and ghan i hope you guys are ready because i am taking you bitches along for the ried
  • The Helper The Helper:
    buckle up
  • Wizard Wizard:
    xD
  • Wizard Wizard:
    Sounds good lol
  • Wizard Wizard:
    I did reply with more info just now about what we did in the past and what we are doing now.
  • The Helper The Helper:
    it is all good
  • The Helper The Helper:
    it is all percolating man
  • The Helper The Helper:
    TheHelper.net #1!
  • Wizard Wizard:
    #1
  • The Helper The Helper:
    LOL I love this place
  • Wizard Wizard:
    ;D
  • Wizard Wizard:
    We all do.
  • O Old Mountain Shadow:
    So what is next for thehelper.net? Is there a new set goals yet?
  • The Helper The Helper:
    yes we are going to be expanding
    +1
  • The Helper The Helper:
    help more people
  • The Helper The Helper:
    thank you for asking Old Mountain Shadow hell ya@
  • The Helper The Helper:
    Look at Mountain Shadow in the chat!
  • The Helper The Helper:
    welcome to thehelper.net
  • O Old Mountain Shadow:
    thanks although I'm really kind of regretting this name lol ... is there a way to change it out or will I need to make a new account?
  • Wizard Wizard:
    One of us can change it for you, I believe. Just send me a PM on what you want.
  • Ghan Ghan:
    Some day we should get the feature where you can change your own name.
  • Wizard Wizard:
    Soon!
  • The Helper The Helper:
    did the mountain shadow get his name changed? personally I think Old Mountain Shadow is a kickass name
  • The Helper The Helper:
    but what do i know lol

    Members online

    No members online now.

    Affiliates

    Hive Workshop NUON Dome
    Top