Help with income !!

Apelsinsaft

New Member
Reaction score
0
Ive searched to forums and i cannot understand how to make a working "income".

I dont know what a integer is, and i cant figure it out.. :/

anyway what i want to do is when i send 1 bandit, my basic income (20 gold), should be income + 5 gold = 25gold. And also i want it to work for all players on the map, 8 st.

Can someone please help me with this and explain very carefully? =)
 
1). Go into the trigger editor (F4)

2). now you look in the toolbar at the top of the window for a yellow X button and click it

3). This is the variable editor where you create new global variables. Create a new variable (The green "+X" button)

4). give the new variable any name you like, i will call it "Income".

5). click the field "Variable Type" and search for "Integer". Integers are whole numbers.

6). Click the check box which says "Array [ ]" and then click okay.

7). click okay to close the variable editor. Voila we got a global income variable with array.

8). create a new Trigger, call it however you like, it should look like this:
Trigger:
  • First Trigger
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Set Income[(Player number of (Picked player))] = 20

because the variable "Income" is an array of Integer variables it is as if we got many variables of the same name. Just imagine you have several variables all called "Income" and you just put a number at the end to specify which one you use.
In this trigger we set the variables "Income + PlayerNumber" for each player.

9). Now create another trigger to add gold to the players periodically, somewhat like this:
Trigger:
  • Second Trigger
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Player - Add Income[(Player number of (Picked player))] to (Picked player) Current gold

Again we pick all players and add gold to the picked player. the amount of gold added is equal to our integer variable "Income + PlayerNumber".
The event "Every 2.00 seconds of game time" can be changed to whatever you want.

10). And now a third trigger to change the income when you train a unit.
Trigger:
  • Third Trigger
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Trained unit)) Equal to Bandit
        • Then - Actions
          • Set Income[(Player number of (Owner of (Triggering unit)))] = (Income[(Player number of (Owner of (Triggering unit)))] + 5)
        • Else - Actions

This trigger will fire each time a structure finishes training a unit, no matter which player, no matter which unit.
Then an if-statement will check whether the unit type of the trained unit is a Bandit, if it is not nothing will happen.
If it is a Bandit-type unit it will set the variabe "Income + PlayerNumber" to itself + 5 (means it adds 5 to the income).

Please pay full attention to this line:
Trigger:
  • Set Income[(Player number of (Owner of (Triggering unit)))] = (Income[(Player number of (Owner of (Triggering unit)))] + 5)

dont mix up the player number part, what we need now is the player number of the Owner of the triggering unit.


Good luck.
Accname.
 
Ive done everything right now,but i cant figure out how to get the last "+5" .

Set Income[(Player number of (Owner of (Triggering unit)))] = (Income[(Player number of (Owner of (Triggering unit)))] + 5) <-- i mean that one.

:/
 
its an arithmetic, should be somewhere at the top of the function list.
arithmetics are used in GUI as math operations.
 
There's a drop down menu of functions. It should be pretty easy to find. It's in the same action window :).
 
IT dosent work.. have been trying for 4 hours in a row now.. what could be wrong?

My last trigger goes like this.

Events
Unit - A unit Finishes training a unit
Conditions ->

Actions
If(All conditons are True) then do (Then Action) else do (Else Actions)

If - Conditions
(Unit-type of (Trained unit)) Equal to Bandit

Then - Actions
Set Income[(Player number of (Owner of (Triggering unit)))] = Income[((Player number of (Owner of (Triggering unit))) + 5)]

Else - Actions




What happens when i build a Bandit is that all income stops.
 
this line
Income[((Player number of (Owner of (Triggering unit))) + 5)]


you accidentally added +5 to the player number instead of the variable.

try doing the set variable all over again, but when you're at "Set Income[XXXX] = " and it's not = to anything, click to set it, then on the first "1" you see at the top. follow the instructions in the posts above.
 
I cant get it work. no matter how i try i end up with

Then - Actions
Set Income[(Player number of (Owner of (Triggering unit)))] = Income[((Player number of (Owner of (Triggering unit))) + 5)]

Can you make a step by step explenation.. this is really driving me crazy :)
 
This is what u need to do for the action

1. use the set variable action

2. set the variable to your "income Variable"

3. set the array number to player number of owner of triggering unit

4. set what the variable equals to arithmetic(it is one of the first choices for the formula dropdown menu)

5. Set the value to Your "Income variable"

6. Set its array to player number of owner of triggering unit

7. Change the 1 to a 5 back in the arithmetic menu

This should work.
Here are a few other things you could try

a. Make sure that the array size of your income variable is the number of players you have, otherwise none of the incomes will work

b. If you are not using lumber as a resource, you could instead give a player 5 lumber each time they build a bandit, and either use lumber as income, or make a simple trigger that checks every few seconds to see if you have lumber, and then adds the amount of gained lumber to their income THEN takes away their lumber

c. instead of an array variable just have a separate variable for each player and do something like
If player 3 trains a bandit, add 5 to player 3's income

That one will probably take a little longer, but it should be easier to solve any problems that come up

d. one last thing, you could set some value for each unit that you dont need (for example unit level would work great but only if no unit gave an income higher than 100) to how much income you want them to give and compress everything in to a few variables (for example if you used point value, the point value of a bandit is 5). This could probably work with any of the other ideas, just dont specify a certain unit and do "whatever value you are using" of trained unit instead of a 5.
That didnt really answer your question but it seemed like it would help a lot so i added it on.

If you have any question on how to do any of these, just ask me and I will post a reply ASAP.

Hope this helped
 
a. Make sure that the array size of your income variable is the number of players you have, otherwise none of the incomes will work
thats just wrong.

c. instead of an array variable just have a separate variable for each player and do something like
If player 3 trains a bandit, add 5 to player 3's income
this would be rediculously dump, i would not advice anyboy on earth to do it this way.

d. one last thing, you could set some value for each unit that you dont need (for example unit level would work great but only if no unit gave an income higher than 100) to how much income you want them to give and compress everything in to a few variables (for example if you used point value, the point value of a bandit is 5). This could probably work with any of the other ideas, just dont specify a certain unit and do "whatever value you are using" of trained unit instead of a 5.
That didnt really answer your question but it seemed like it would help a lot so i added it on.
point value would be the best solution because the level of the unit determines how much exp they give to heroes if killed.
and please note that you can set a units level to whatever value you like, there is no limit of 100. (you just have to hod down shift)
 
ok I found out what to do... before selecting the Income variable in the second part of the Set Variable, go to the bar below and select the Arithmetic and then do the rest. I had the same problem till I did this.
 
Step by step instructions:
*All lines after "=>" is what you should see.

1) Action: Set Variable

=> Set _______ = _______

2) Click the first blank.
3) Select your Integer Array variable.

=> Set Income_Integer[ ___ ] = _____

4) Select the blank in the [ ] brackets.
5) Open the drop down menu of functions.
6) Select Player - Player Number
7) You should automatically have "Player - Player number of (Triggering Player)" *.

=> Set Income_Integer[Player number of (Triggering Player)] = ________

8) Select the second blank (the only one left).
9) Open the drop down menu of functions.
10) Select Arithmetic.
11) You will get something like:

=> 1 + 1

...in another box.

12) Click the first 1.
13) Select the Income_Integer array variable.
14) Repeat steps 4 to 7.
15) Click the second "1".
16) Type in 5 in the blank space given at the bottom of the box that pops up.
17) Keep clicking ok / tapping enter until you get to here:

=> Set Income_Integer[Player number of (Triggering Player)] = ((Income_Integer[Player number of (Triggering Player)]) + 5)

Hope that helps.

Edit: Woops, a little too late :p. Ah well.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good
  • The Helper The Helper:
    I would like to see it again like Ghan had it the first time with pagination though - without the pagination that view will not work but with pagination it just might...
  • The Helper The Helper:
    This drink recipe I have had more than a few times back in the day! Mind Eraser https://www.thehelper.net/threads/cocktail-mind-eraser.194720/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top