Need help with Income

StoDaBest

New Member
Reaction score
0
Hello everyone,
I am working on a costum map and I am wondering how to make income.
The income will be increased by 1 when a marine is trained from the player's barracks.
Each player has a barracks and they can all train marines.
Each player will get a set amount of minerals every 30 seconds of game time. (That's the income)
I made a variable integer array for each players (6 in total) called <Income Player #>and I am wondering how to increase the income and give minterals to players.
Please help!
Thanks!
 

Carnerox

The one and only.
Reaction score
84
Trigger:
  • Increase Income
    • Events
      • Unit - Any Unit training progress is Completed
    • Local Variables
    • Conditions
      • (Triggering progress unit type) == Marine
    • Actions
      • Variable - Modify Income[(Triggering player)]: + 1

Trigger:
  • Income
    • Events
      • Timer - Every 30.0 seconds of Game Time
    • Local Variables
      • Player = 1 &lt;Integer&gt;
    • Conditions
    • Actions
      • General - For each integer Player from 1 to 6 with increment 1, do (Actions)
        • Actions
          • Player - Modify player Player Minerals: Add Income[Player]


Variables
Income = 30 <Integer[Array-6]>
 

StoDaBest

New Member
Reaction score
0
Thanks, it worked!
Now I need to find a way to send a text to each player every 30 seconds saying:
"You gained <Income> minerals" (Depending on the income. <Income> is the variable)
But I don't know how to add a variable to a text and make it different for each player, can you help?
 

Carnerox

The one and only.
Reaction score
84
Trigger:
  • UI - Display (&quot;You have gained &quot; + ((Text(Income[Income[Player]])) + &quot; minerals!&quot;)) for (Player group(Player)) to Subtitle area


To add an integer/real to a text then you would find the conversion tab and click "Convert Integer To Text".

That would also be inside the loop as well.
 

StoDaBest

New Member
Reaction score
0
I tried it and there's a problem
It says:
"Trigger Error in 'gt_Getincome_Func':
Trying to access an element past the end of an array"
My trigger is called Get income and I guess the problem is due to the variable but I don't get the problem, can you help me?
 

StoDaBest

New Member
Reaction score
0
Ok I have 2 variables:
-Income = 20<Integer[6]>
-Income Board = No Leaderboard <Leaderboard>

Trigger:
  • Train Marine
    • Events
      • Unit - Any Unit training progress is Completed
    • Local Variables
    • Conditions
      • (Triggering progress unit type) == Marine
    • Actions
      • Variable - Modify Income[(Triggering Player)]: + 2
      • Leaderboard - Set Income Board text at column 2 and row (Owner of (Triggering unit)) to (Text(Income[(Triggering Player)]))


Trigger:
  • Train Reaper
    • Events
      • Unit - Any Unit training progress is Completed
    • Local Variables
    • Conditions
      • (Triggering progress unit type) == Reaper
    • Actions
      • Variable - Modify Income[(Triggering Player)]: + 4
      • Leaderboard - Set Income Board text at column 2 and row (Owner of (Triggering unit)) to (Text(Income[(Triggering Player)]))


Trigger:
  • Train Ghost
    • Events
      • Unit - Any Unit training progress is Completed
    • Local Variables
    • Conditions
      • (Triggering progress unit type) == Ghost
    • Actions
      • Variable - Modify Income[(Triggering Player)]: + 8
      • Leaderboard - Set Income Board text at column 2 and row (Owner of (Triggering unit)) to (Text(Income[(Triggering Player)]))


Trigger:
  • Train Marauder
    • Events
      • Unit - Any Unit training progress is Completed
    • Local Variables
    • Conditions
      • (Triggering progress unit type) == Marauder
    • Actions
      • Variable - Modify Income[(Triggering Player)]: + 20
      • Leaderboard - Set Income Board text at column 2 and row (Owner of (Triggering unit)) to (Text(Income[(Triggering Player)]))


Trigger:
  • Train Thor
    • Events
      • Unit - Any Unit training progress is Completed
    • Local Variables
    • Conditions
      • (Triggering progress unit type) == Thor
    • Actions
      • Variable - Modify Income[(Triggering Player)]: + 100
      • Leaderboard - Set Income Board text at column 2 and row (Owner of (Triggering unit)) to (Text(Income[(Triggering Player)]))



Trigger:
  • Get Income
    • Events
      • Timer - Every 30.0 seconds of Game Time
    • Local Variables
      • Player = 1 &lt;Integer&gt;
    • Conditions
    • Actions
      • General - For each integer Player from 1 to 6 with increment 1, do (Actions)
        • Actions
          • Player - Modify player Player Minerals: Add Income[Player]
          • UI - Display (&quot;You have gained&quot; + ((Text(Income[Income[Player]])) + &quot;minerals!&quot;)) for (Player group(Player)) to Subtile area

^That's my buggy trigger I guess

Trigger:
  • Income Timer (which does not work <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite3" alt=":(" title="Frown :(" loading="lazy" data-shortname=":(" /> )
    • Events
      • Timer - Elapsed time is 5.0 Game Time seconds
    • Local Variables
      • Income Timer = (New timer) &lt;Timer&gt;
    • Conditions
    • Actions
      • Timer - Start Income Timer as a Repeating timer that will expire in 30.0 Game Time seconds
      • Variable - Set Income Timer = (Last started timer)
      • Timer - Create a timer window for (Last started timer). with the title &quot;Next income in&quot;. using Remaining time (initially Visible)
      • Timer - Set time format for (Last created timer window) to Total Seconds (s)


Here you go, that's all my triggers that use this variable.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top