• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Income system

Status
Not open for further replies.
Level 4
Joined
Dec 12, 2008
Messages
98
I want to make an income system for my map, This is how it works:

You build so called "income tower" If you build 1 incometower you get 1 mineral every 5 seconds > 2 income towers 2 minerals every 5 seconds ETC.

how do you make this with triggers? and please not just copy the triggers becouse sometimes i cant find those triggers.


Thx
 
Yeah, but an income doesn't work that way.

Alright, first of all, you will need 2 triggers.

Look for Unit being created, or something like that. Can't recall correctly.
You need to use a variable, an array if you want, to detect the Generic 6 of the unit.
As conditions, you need to set them to your Income tower.
Actions, modify your variable to "variable +1".

For the second, use a periodic event. Then, pick all players in player group (all players) and do actions:
Give resources to (picked player)

Now, i didn't make the triggers, but that's how it works. And i did it for 2 reasons. First, you must understand how the trigger editor works, and 2nd, i am lazy today.
 
Level 4
Joined
Dec 12, 2008
Messages
98
@Stathisdjs

i dont understand some things. Becouse i made the event as:


Unit - Any Unit creates a unit with ability Any or behavior Any

but then i need an condition were i can select unit type, and then incometower. I cant just select an income tower becouse you haven't build it yet. And what do you mean with "Generic 6"?
 
Level 9
Joined
Nov 4, 2007
Messages
931
You can data editor this I believe, make an Effect Modify Player and set it to 1 mineral to the Player owning the Source Unit. Next make a Behavior of type Buff (flagged hidden or not idc) and on its Periodic Effect, set it to the Modify Player effect that was just done, and on its Period set it to your 5.00 second. Finally add this behavior to your towers, this won't necessarily synchronize your towers income time, but it will get the job done, no triggers required (though I know with a little more detail they can be synchronized as well in the data editor)
 
  • asas
    • Events
      • Unit - Any Unit uses Ability at Generic6 - Complete stage (Ignore shared abilities)
    • Local Variables
    • Conditions
      • (Unit type of (Triggering unit)) == Value 2
    • Actions
      • Variable - Set IncomeVar[(Owner of (Triggering unit))] = (IncomeVar[(Owner of (Triggering unit))] + 5)
And
  • Events
    • Timer - Every 5.0 seconds of Game Time
  • Local Variables
  • Conditions
  • Actions
    • Player Group - Pick each player in (All players) and do (Actions)
      • Actions
        • Player - Modify player (Picked player) Minerals: Add IncomeVar[(Picked player)]
 
Level 4
Joined
Dec 12, 2008
Messages
98
i made that effect modify player thingy but when i create the behavior and want to choose the periodic effect i cant find the "effect modify player" thingy.

Ty

EDIT:
@stathisdjs

I will try it out.
 
Level 4
Joined
Dec 12, 2008
Messages
98
@stathisdjs

i still dont get some things. how did you get these 2 actions:
Variable - Set IncomeVar[(Owner of (Triggering unit))] = (IncomeVar[(Owner of (Triggering unit))] + 5)

and

Player - Modify player (Picked player) Minerals: Add IncomeVar[(Picked player)]

ty
 
@stathisdjs

i still dont get some things. how did you get these 2 actions:
Variable - Set IncomeVar[(Owner of (Triggering unit))] = (IncomeVar[(Owner of (Triggering unit))] + 5)

and

Player - Modify player (Picked player) Minerals: Add IncomeVar[(Picked player)]

ty
Well, first of all, the ability you should use, is the construct X building ability.
Set Variable does that, and it uses an Arithmetic to set it to IncomeVar+5.

And, Pick all players from group "All players" and do actions:
Modify property
 
Level 4
Joined
Dec 12, 2008
Messages
98
but how do you get the [(owner of (triggering unit))] behind the "variable - setIncomeVar"

mabye you can send me the map?
 
Level 4
Joined
Dec 12, 2008
Messages
98
@stathisdjs
ok, i didnt knew that the variable has to be an array. But now it already starts income even if i dont have a income tower and he gives me this error:
e_arrayIncomeindexOverflow

EDIT: sorry for dubble post...
 
Level 5
Joined
Sep 27, 2008
Messages
147
i use this but the trigger "capture" doesn't work:cry: any1 know how to fix that 1?

  • Mineral Mine
    • Events
      • Timer - Income Timer expires
    • Conditions
    • Actions
      • Player Group - Pick each player in (All players) and do (Actions)
        • Actions
          • Unit Group - Pick each unit in (Create a list of all player (Picked player)'s units of type (String(Mineral Mine)) within range 300.0 of the point (Center of (Playable map area)) up to -1 units) and do (Actions)
            • Actions
              • Player - Modify player (Owner of (Picked unit)) Minerals: Add 170
              • Player - Modify player (Owner of (Picked unit)) Vespene: Add 40
  • Timer
    • Events
      • Timer - Elapsed time is 5.0 Game Time seconds
    • Conditions
      • Timer - Start Income Timer as a Repeating timer that will expire in 60.0 Game Time seconds
      • Timer - Create a timer window for Income Timer, with the title "Nekst Income in...", using Remaining time (initially Visible)


  • Capture
    • Events
      • Unit - Any Unit dies
      • Conditions
        • (Unit type of (Triggering unit)) == Mineral Mine
      • Actions
        • Unit - Create 1 Mineral Mine for player (Owner of (Killing unit)) at (Position of (Triggering unit)) facing 270.0 degrees (Ignore Placement)
 
Status
Not open for further replies.
Top