Gold income depending on level

Status
Not open for further replies.
Level 2
Joined
Jun 18, 2012
Messages
24
Alrite, so I've been tryin to make a structure/building with one ability, that ability has the stats:

Gold per interval = 1
Interval = 1.00

Wich means you will get 1 gold every 1 second.
Ofcourse it doesn't work, and i also tried to make a trigger
Ekn6kGX.jpg


Wich also dont work, to sum things up, i want it to work as the Tent in Trolls & Elves, but i know for that you need to know JASS wich i dont know a shite about... So im just wonderíng if there is a way around that, rite know im trying to make a normal gold mine with a wisp that will give you an X amount of gold depending on the gold mine upgrade.
EDIT: Im not suprised, but the goldmine thing didn't work aswell
EDIT2: When i say the tent in trolls & Elves, i mean i want the building to give me 1 gold each second, then upgrade the building and it will give me 2 gold etc etc
 
Last edited:
Level 23
Joined
Apr 16, 2012
Messages
4,041
you dont need to know Jass, you just used wrong Event

Use Time - Every ... seconds of game time instead of this, because what this does is, it only runs once, when the game was running for 1 second, but there is also Event for Periodic checking, which checks every X seconds
 
Also remove the conditon "UnitType of (triggeringUnit) Equals Magic Money House.

You only can use a unit or unit-type comparisson with "triggering unit" if there is a unit event.

If red makes this building you could set a boolean variable = true --> and then use this boolean varibale to check if player should become gold or not.

Also you can use [TRlGGER] Code
  • tags to show your triggers next time.
 
Level 2
Joined
Jun 18, 2012
Messages
24
Also remove the conditon "UnitType of (triggeringUnit) Equals Magic Money House.

You only can use a unit or unit-type comparisson with "triggering unit" if there is a unit event.

If red makes this building you could set a boolean variable = true --> and then use this boolean varibale to check if player should become gold or not.

Also you can use [TRlGGER] Code
  • tags to show your triggers next time.[/QUOTE]
  • I don't really understand you, mate. This whole boolean thing is confusing for me...
 
Level 2
Joined
Jun 18, 2012
Messages
24
Change the event to periodic time and remove the condition

When i say the tent in trolls & Elves, i mean i want the building to give me 1 gold each second, then upgrade the building and it will give me 2 gold etc etc.
And if you dont have a house, you wont get any income, sorry for not being clear enough :/
 
Events
Every 1 second

Actions
For each integer I from 1-12 do actions:
Player Add Income to Player

^Thats income trigger for all players. "I" is a variable of type integer. "Income" is also an integer but with array.
_______________________

Now you need a trigger which Increase the Income[PlayerNumber] by 1 if someone builds this income house, or makes an upgrade.

Search for the correct event and then increase it like this. Set Income[PlayerNumberOfTriggeringPlayer] = Income[PlayerNumberOfTriggeringPlayer] + 1
 
Level 2
Joined
Jun 18, 2012
Messages
24
Events
Every 1 second

Actions
For each integer I from 1-12 do actions:
Player Add Income to Player

^Thats income trigger for all players. "I" is a variable of type integer. "Income" is also an integer but with array.
_______________________

Now you need a trigger which Increase the Income[PlayerNumber] by 1 if someone builds this income house, or makes an upgrade.

Search for the correct event and then increase it like this. Set Income[PlayerNumberOfTriggeringPlayer] = Income[PlayerNumberOfTriggeringPlayer] + 1


*deleted post*
Ok nvm that post, sorry im tired and frustraded, didnt notice that you said what type of integer... Anyways thanks so much, i will prob be back when i've tested this, for now i will try to do it on my own so
 
Level 2
Joined
Jun 18, 2012
Messages
24
They both are INTEGER variables, "Income" is not a simple integer, it has array. :)

Aye! Well now my trigger looks like this
  • Time - Every 1.00 seconds of the game
  • Conditions:
  • Actions:
  • for each (integer I) from 1 to 10, do (actions)
  • Loop - Actions
  • Player - add income[I] to player 1 (Red) current gold
And it doesn't work, I dont know if its suppose to work or not, but just FYI.

And now, shall i make a new trigger wich makes the gold income increase depending on what upgrade you have?
You mentioned "Set Income[PlayerNumberOfTriggeringPlayer] = Income[PlayerNumberOfTriggeringPlayer] + 1"
is that a condition?
 
Level 27
Joined
Sep 26, 2009
Messages
2,475
In this case, Income[] represents the value that should be add. So in other triggers (for example if you make a trigger that fires when you finish upgrading your building), you increase value of Income[] using arithmetic function. It would be like this: "Set Income[] = Income[] + 1". This increases value of Income[] by 1.

In the trigger you posted, the error may be that you add gold only to Player1 Red, instead of Player(I). So actually, Player 1 Red would get income of each player only for himself.

Also, make sure that the "Player - add value to player's current gold" is in the "Loop - Actions" block.

  • *This is how it should look in trigger editor*
  • For each (integer I) from 1 to 10, do (actions)
    • Loop - Actions
      • Player - add income
  • ------
  • *It SHOULD NOT look like this*
  • For each (integer I) from 1 to 10, do (actions)
    • Loop - Actions
  • Player - add income
 
Level 2
Joined
Jun 18, 2012
Messages
24
Read my trigge again, carefully.. you give it only to player 1.

You should increase it depending on which building is finished construction.

And no, its no condtition...it's a Set variable action, you can find it somewhere on top. for calculations like + 1 use arithmetic.

Ah alrite, so currently its looking like this
  • Events
  • Time - Every 1.00 seconds of game time
  • Conditions
  • Actions
  • For each (integer I) from 1 to 10, do (Actions)
  • Loop - Actions
  • Player - Add income[I] to Player[I] Current gold
  • Set income[(Player number of (triggering player))] = income [(1x 2)]
I had to create a variable for "Player" in the add income one. But I couldnt add (player number of triggering player] after the "=" since i cant add income after that. So i assume you typed it wrong. And now im looking for the condition or action wich changes the income to X when i have the X upgrade
 
Level 2
Joined
Jun 18, 2012
Messages
24
In this case, Income[] represents the value that should be add. So in other triggers (for example if you make a trigger that fires when you finish upgrading your building), you increase value of Income[] using arithmetic function. It would be like this: "Set Income[] = Income[] + 1". This increases value of Income[] by 1.

In the trigger you posted, the error may be that you add gold only to Player1 Red, instead of Player(I). So actually, Player 1 Red would get income of each player only for himself.

Also, make sure that the "Player - add value to player's current gold" is in the "Loop - Actions" block.

  • *This is how it should look in trigger editor*
  • For each (integer I) from 1 to 10, do (actions)
    • Loop - Actions
      • Player - add income
  • ------
  • *It SHOULD NOT look like this*
  • For each (integer I) from 1 to 10, do (actions)
    • Loop - Actions
  • Player - add income

My fault, i dont really know yet how to use the
  • thingy... heres a screenshot of my triggers now
  • [IMG]http://i.imgur.com/OWYj91Q.jpg[/IMG]
 
As Nichilus also said the actions have to be inside the loop not after.

I just can't see if they are or not because they all have same offset in your post.
.
Now you giving gold action is correct, but the income decrease should be set in an seperated trigger.. with some event" a unit finished construction".
Also the arithmetic is not correct, it should look like "Set x = x +1".
 
Level 2
Joined
Jun 18, 2012
Messages
24
As Nichilus also said the actions have to be inside the loop not after.

I just can't see if they are or not because they all have same offset in your post.
.
Now you giving gold action is correct, but the income decrease should be set in an seperated trigger.. with some event" a unit finished construction".
Also the arithmetic is not correct, it should look like "Set x = x +1".

Alrite! makin progress!
Ok I changed the arthimetic to
  • Set income = ((0 x 1) +1)[I]
Trigger is now working, and this trigger is for the first house therefore the "0 x 1"

Now for the other trigger, i guess i will leave the above trigger on Initially off?
  • Events
    • Unit - A unit finishes a construction
  • Conditions
    • (unit-type of (Constructed structure)) Equal to Gold Mine 1
  • Actions
    • Trigger - turn on Income Increase
(The trigger "Income Increase" above is the one i've done with the set income n shite)

EDIT: ait just tested it and it works like a charm!
Now i only need to make other triggers wich increases the income and turns off the first trigger and turns On the next one, also new triggers for Gold mine 2, gold mine 3 etc etc, Im i right?
 
Level 27
Joined
Sep 26, 2009
Messages
2,475
Man, this line:
  • Set income = ((0 x 1) +1)[I]
seems odd. How did you get the index at the end? It doesn't even make sense in there.

The calculation (0x1) +1 is odd too. It's not even needed really.
I mean - why set X = (4*10) - (8*5) + (4*( (2^2)-4 )) + 1, which will ultimately be X = 0+1, when you can simply set X = 1?
What I wrote may be exaggerated, however if you look at it from my perspective, you will see that you make an unneeded calculation.
why set X = ( 0x1 )+ 1 when you obviously know that 0x1 = 0, which will then be X = 0 +1, which will always be x = 1?

So yeah, it should be X = 1; or if you want to increase variable X by 1, it should be X = X + 1 => exactly like I wrote.
In GUI it would be: Set variable X = (arithmetic operation(X + 1))
 
Level 2
Joined
Jun 18, 2012
Messages
24
Man, this line:
  • Set income = ((0 x 1) +1)[I]
seems odd. How did you get the index at the end? It doesn't even make sense in there.

The calculation (0x1) +1 is odd too. It's not even needed really.
I mean - why set X = (4*10) - (8*5) + (4*( (2^2)-4 )) + 1, which will ultimately be X = 0+1, when you can simply set X = 1?
What I wrote may be exaggerated, however if you look at it from my perspective, you will see that you make an unneeded calculation.
why set X = ( 0x1 )+ 1 when you obviously know that 0x1 = 0, which will then be X = 0 +1, which will always be x = 1?

So yeah, it should be X = 1; or if you want to increase variable X by 1, it should be X = X + 1 => exactly like I wrote.
In GUI it would be: Set variable X = (arithmetic operation(X + 1))


Oh true and i've failed in math 5 years in a row so im just making this alot harder for myself than needed... and im sorry, the index at the end is just a typo lol...
Anyways, i figured out how to make the other triggers for the upgrades
turn off the old one, turn on a new one with more income! (if anyones wondering)
 
Status
Not open for further replies.
Top