Gold Per Second Region

Yauld

New Member
Reaction score
0
I want to create a region where a unit could stand so that you would get gold per second. I just have two problems.

1. I already have a trigger giving you gold per second, so it would have to give increased gold, not just gold.

2. There would be more than one player, so the one getting gold would have to be the one owning the unit who stands in the region.

I would love to get some help, thank you!

:)
 

MP®

Member
Reaction score
11
Can you explain a bit better, I don't understand what you mean exactly..

1. If you make another trigger that also gives gold per second, you will just get gold for both triggers, so it is increased. You can also just make in that one trigger a condition to check if there are any units of the player in that region, so that they will get more gold.
2. Do you want it to be allowed that more players at the same time can get gold (when they both have a unit in that region)? Or only 1 player at the same time?
 

Inflicted

Currently inactive
Reaction score
63
Easiest way I can think of is a periodic event.

Events
Time - Every 1.0 seconds
Conditions
Actions
Set Temp_UnitGroup = Units in YourGoldRegion that are Alive
Pick Every Unit in region
+1 Gold to Owner of Unit
Clear/Destroy UnitGroup to remove leaks etc

Note that if more than one of a players units is in that region, it shall grant one gold for each unit.

If you want only one gold granted, regardless of amount of units in the region, you could do something that checks the owner of the units.

This shouldn't interupt the gold per second trigger you mentioned before unless they merge.

Additionally, you may be concerned with memory wastage if units aren't often in this region. In such case, you could count the units in the region after awarding the gold, and then if 0 turn off the trigger. If a unit enters the region it could be turned on, etc.

Sorry that my code is rough, but you should be able to get a general idea from it.
Please clarify abit and mention if there is any issue or anything you don't understand.
 

Yauld

New Member
Reaction score
0
@Can you explain a bit better, I don't understand what you mean exactly..

When a unit enters a region (in this case the middle of the map), the owner of that unit should get 20 gold per 3 second, resulting in a combined income of 30 gold per 3 sec(See under). This should always be the case, even if there were just one or a thousand units. (Thought this could be seen throught if it is only possible to add up on the gold for every unit.) Thought if every unit would under any circumstances leave the region (wherever they would die or just step out) the player would instantly lose all of the extra gained income, pushing them back to 10 gold per 3 sec, instead of 30 gold per 3 sec.

Problems

1. I already have a trigger giving all players 10 gold per 3 second.

2. There will be 2+ players playing at the same time as it is a multiplayer map, so you would have to make it so that the owner of the unit entering the region will get the gold, and not every player on the map.
 

Inflicted

Currently inactive
Reaction score
63
You could have a trigger that monitors when a unit enters the region, leaves and dies.

OR

On your gold per second you could check if the amount of units in that region owned by that player is greater than 0
then grant the bonus income

But this may be lengthy, is there a max amount of players?
Perhaps a loop could simplify this.

Perhaps you could post your gold per second trigger?
(Remember [noparse][war3][/war3][/noparse] tags)
 

MP®

Member
Reaction score
11
Just make a trigger like this:

Trigger:
  • Melee Initialization
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Set UnitsInRegion = (Units in Region matching (((Owner of (Matching unit)) Equal to (Player((Integer A)))) and (((Matching unit) is alive) Equal to True)))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in UnitsInRegion) Greater than 0
            • Then - Actions
              • Player - Add 30 to (Player((Integer A))) Current gold
            • Else - Actions
              • Player - Add 10 to (Player((Integer A))) Current gold


I asume here you have a max of 12 players in your map. If only for example player 1 t/m 4 are in the game, make the loop go from 1 to 4.
 

Inflicted

Currently inactive
Reaction score
63
The above trigger was an example of what I was trying to say. I just did not have the editor with me at the time.
I hope this solves your issue.

Otherwise specifically indicate what it is that you don't understand and post your trigger(/s).
 

MP®

Member
Reaction score
11
Yeah, but you where talking about a lengthy trigger, but mine isn't :)
 

Yauld

New Member
Reaction score
0
Exactly how do you do:

Set UnitsInRegion = (Units in Region matching (((Owner of (Matching unit)) Equal to (Player((Integer A)))) and (((Matching unit) is alive) Equal to True)))

And

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

?
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
1). UnitsInRegion is a unit group variable. Choose the Set Variable action, and pick Units in Region Matching Condition. In the conditions, pick And at the bottom of the list to add another condition, and repeat as many times as necessary.

2). If/Then/Else (Multiple Functions).
 

Yauld

New Member
Reaction score
0
Set UnitsInRegion[0] = (Units in Region 000 <gen>

I got everything, but i pointed out these things which might come out as odd. For example, i have to put a [0] behind UnitsInRegion. And, i dont know if it's meant or not, but instead of ''Region matching'' i have to pick a region.
 

MP®

Member
Reaction score
11
You should edit the UnitsInRegion variable and turn of the box 'array'.

Also 'Region' in my example is the name of the region. You indeed have to pick that one. The 'matching' means: pick only the units in that region that match your conditions. These conditions are in this case: Owner of the units has to be Player number (Integer A) and the units have to be alive. Integer A is for the loop: first it is 1, then 2 then 3 and this repeats until the max number of units.

To choose Player ((Integer A)), you have to pick 'Conversion - Convert player index to Player'. Then you can choose an Integer, which will stand for the Player index (number of player). Here you can choose 'For loop - Integer A' or something like that.
 

Inflicted

Currently inactive
Reaction score
63
(Player((Integer A))))

I really can't find that one.
When your under Integer Comparison, just hit F
That should guide you straight to For Integer A or something like that. (Unless you have a different version of the Editor)

and like mentioned above, to get to the Integer Comparison from a Player, you need to use the function Convert player index to Player.
 

xtian07

Member
Reaction score
2
I want to create a region where a unit could stand so that you would get gold per second. I just have two problems.

1. I already have a trigger giving you gold per second, so it would have to give increased gold, not just gold.

2. There would be more than one player, so the one getting gold would have to be the one owning the unit who stands in the region.

I would love to get some help, thank you!

:)

Something like this? You need 4 new triggers here.
Trigger:
  • Untitled Trigger 001
    • Events
      • Time - Every 3.00 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Random unit from (Units in GoldRegion &lt;gen&gt; owned by (Picked player))) is in UnitGroupVariable) Equal to True
            • Then - Actions
              • Player - Add 30 to (Picked player) Current gold
              • Cinematic - Clear the screen of text messages for (All players)
              • Game - Display to (All players) the text: (+30 gold to + (Name of (Picked player)))
            • Else - Actions
              • Player - Add 10 to (Picked player) Current gold
              • Cinematic - Clear the screen of text messages for (All players)
              • Game - Display to (All players) the text: (+10 gold to + (Name of (Picked player)))

Trigger:
  • Untitled Trigger 002
    • Events
      • Unit - A unit enters GoldRegion &lt;gen&gt;
    • Conditions
      • ((Dying unit) is in UnitGroupVariable) Equal to False
    • Actions
      • Unit Group - Add (Entering unit) to UnitGroupVariable

Trigger:
  • Untitled Trigger 003
    • Events
      • Unit - A unit leaves GoldRegion &lt;gen&gt;
    • Conditions
      • ((Dying unit) is in UnitGroupVariable) Equal to True
    • Actions
      • Unit Group - Remove (Leaving unit) from UnitGroupVariable

Trigger:
  • Untitled Trigger 004
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is in UnitGroupVariable) Equal to True
    • Actions
      • Unit Group - Remove (Dying unit) from UnitGroupVariable

I can't seem to understand you, but hope this helps! :D
 

MP®

Member
Reaction score
11
Something like this? You need 4 new triggers here.
Trigger:
  • Untitled Trigger 001
    • Events
      • Time - Every 3.00 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Random unit from (Units in GoldRegion &lt;gen&gt; owned by (Picked player))) is in UnitGroupVariable) Equal to True
            • Then - Actions
              • Player - Add 30 to (Picked player) Current gold
              • Cinematic - Clear the screen of text messages for (All players)
              • Game - Display to (All players) the text: (+30 gold to + (Name of (Picked player)))
            • Else - Actions
              • Player - Add 10 to (Picked player) Current gold
              • Cinematic - Clear the screen of text messages for (All players)
              • Game - Display to (All players) the text: (+10 gold to + (Name of (Picked player)))

Trigger:
  • Untitled Trigger 002
    • Events
      • Unit - A unit enters GoldRegion &lt;gen&gt;
    • Conditions
      • ((Dying unit) is in UnitGroupVariable) Equal to False
    • Actions
      • Unit Group - Add (Entering unit) to UnitGroupVariable

Trigger:
  • Untitled Trigger 003
    • Events
      • Unit - A unit leaves GoldRegion &lt;gen&gt;
    • Conditions
      • ((Dying unit) is in UnitGroupVariable) Equal to True
    • Actions
      • Unit Group - Remove (Leaving unit) from UnitGroupVariable

Trigger:
  • Untitled Trigger 004
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Dying unit) is in UnitGroupVariable) Equal to True
    • Actions
      • Unit Group - Remove (Dying unit) from UnitGroupVariable

I can't seem to understand you, but hope this helps! :D
Your trigger won't work correct when there are units of multiple players in the region.

And btw, the correct way to do this is already given.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top