• 🏆 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!

Gold income trigger

Status
Not open for further replies.
Level 9
Joined
Jun 7, 2008
Messages
440
I have need of a few answers. I need a trigger that when i biuld a certain structure, it gives me 6 gold every 2 seconds. I tried it, and when i build the object, i didnt get any gold income from it.

I have a few modified variables. i called them bank -item type (This is supposed to be a structure which gives you gold. i didnt know what else to put it as... i didnt see structure type there)
BankGroup - playergroup (this i used so when the player built that structure, he is put into a certain group so that anyone in that group gains a certain amount, and no one else)
BankTimer - timer (every 2 seconds, anyone in the bank group would get 6 gold)
I may be forgetting something, can someone fill me in??
 
Level 16
Joined
Feb 22, 2006
Messages
960
so maybe this is what u want
  • Trigger1
    • Events
      • Unit - A unit finishs a construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to <your building>
    • Actions
      • Set playernumber = (Player number of (Owner of (Triggering unit)))
      • Set build_unit[playernumber] = (build_unit[playernumber] + 1)
  • Trigger2
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Player - Add (6 x build_unit[(Integer A)]) to (Player((Integer A))) Current Gold
 
Level 9
Joined
Jun 7, 2008
Messages
440
ok, i tried that... and i had to test it, but when i built the object, same thing happened.. no gold income. perhaps ive gotten the trigger wrong somehow, but i have it the exact same way you got it there. :(
 
Level 17
Joined
May 6, 2008
Messages
1,598
  • Income
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units of type Bank) and do (Actions)
        • Loop - Actions
          • Player - Add 1 to (Owner of (Picked unit)) Current gold
*



IT LEAKS:
 
Level 9
Joined
Jun 7, 2008
Messages
440
this is what i got.. i dont know how to put it trigger format... so ill just type it out... Basically i got it to work.. the only problem is, if i have a hero secelected. it wont work. so i dunno. look it over, see if i messed up anywhere.

Trigger 1

Events
Unit - a unit owned by player 1 (red) Finishes a construction
Conditions
(unit-type of (last created unit) Equal to Bank
Actions
Player Group - Add (owner of (Triggering unit)) to Bankgroup

Trigger 2

Events
Map Initialization
Conditions
Actions
Wait 5.00 seconds
Countdown timer - Start Banktimer as a repeating timer that will expire in 2 seconds

Trigger 3

Events
Time - Banktimer expires
Conditions
Actions
Playergroup - Pick every player in Bankgroup and do (Player - add 6 to (picked player) current gold)

Trigger 4

Events
Unit - A unit owned by player 1 (red) dies
Conditions
(unit-type of (triggering unit)) equal to Bank
Actions
Playergroup - Remove (Owner of (Triggering unit)) from Bankgroup

What do i need in one of these triggers, so that i may be able to build the gold automated gold mine while having a hero?
 
Level 9
Joined
Jun 7, 2008
Messages
440
I tried that, and now even building the mine without a hero it wont work. I think its gotta stay the same with last created unit. But i still dont know how to get around the whole hero + bank idea... ive seen other maps the same way, and they have no problems. :p
 
Level 20
Joined
Oct 21, 2006
Messages
3,231
  • Untitled Trigger 001
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units of type Footman) and do (Player - Add 10 to (Owner of (Picked unit)) Current gold)
This works fine for meh. D:
 
Level 2
Joined
Jun 24, 2008
Messages
15
I use one of these in my map... As far as I know it only works for one player, But it's a start, And it works.


  • Blah
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to Gold Mine
    • Actions
      • Unit Group - Pick every unit in (Units of type Gold Mine) and do (Set Bank = (Picked unit))
      • Countdown Timer - Start TimerX as a Repeating timer that will expire in 15.00 seconds
  • Blah2
    • Events
      • Time - TimerX expires
    • Conditions
    • Actions
      • Player - Set (Owner of Bank) Current gold to (((Owner of Bank) Current gold) + 1)
(Woo I made my first post).
 
Level 9
Joined
Jun 7, 2008
Messages
440
first off... Is Your Unit-type "goldmine" already built??? If it is, thats not going to work, due to the fact the i cannot select the unit. Without it being built first. And secondly, I have already tried that.. for some reason it doesnt seem to work when i test the map
 
Level 11
Joined
May 31, 2008
Messages
698
with this trigger you can make multiple buildings and the income WILL stack. NOTE: this is only for player 1 and it has 2 buildings (first building and upgraded version) so you must do what i did to player one for EVERY player (yes it will take a while but copy and paste to make it alot faster)

ok, here is the right way to do a building income trigger (goldmine is variable, Gold Mine is income building) :

income
Events
Time - Every 10.00 seconds of game time
Conditions
Actions
Set goldmine = 25
Set goldmine_2 = 50
Unit Group - Pick every unit in (Units owned by Player 1 (Red) of type Gold Mine) and do (If (((Picked unit) is alive) Equal to True) then do (Player - Set Player 1 (Red) Current gold to ((Player 1 (Red) Current gold) + goldmine)) else do (Do nothing))
Unit Group - Pick every unit in (Units owned by Player 1 (Red) of type Better Gold Mine) and do (If (((Picked unit) is alive) Equal to True) then do (Player - Set Player 1 (Red) Current gold to ((Player 1 (Red) Current gold) + goldmine_2)) else do (Do nothing))
 
Level 11
Joined
Nov 12, 2006
Messages
765
i know this problem is solved, however i have a question on wolfmans triggers. insted of doing "player 1" could you just put those triggers under "pick every player" and change the "player 1"s to "picked player", this way it works for everyone?
 
Level 11
Joined
May 31, 2008
Messages
698
income
Events
Time - Every 10.00 seconds of game time
Conditions
Actions
Set goldmine = 25
Player Group - Pick every player in (All players)
Unit Group - Pick every unit in (Units owned by ((picked player) of type Gold Mine) and do (If (((Picked unit) is alive) Equal to True) then do (Player - Set (picked player) Current gold to picked player Current gold) + goldmine)) else do (Do nothing))


do u mean like this?? cuz if u do then it wont work it will add up every players income and give every1 the total income of every player. so every1 wud get the same huge income
 
Level 11
Joined
Nov 12, 2006
Messages
765
oo i think i fraised what i said not entirely correct, however this is what im doing

Events
Time - Every 5.00 seconds of game time

Actions
Custom script: set bj_wantDestroyGroup = true
Unit Group - Pick every unit in (Units of type Planet) and do (Actions)

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

If - Conditions
((Picked unit) is alive) Equal to True

Then - Actions
Player - Add 50 to (Owner of (Picked unit)) Current gold

Else - Actions
Do nothing



there isnt anything wrong with that right? i spaced the trigger text out to be more easier to read*
 
Level 11
Joined
May 31, 2008
Messages
698
well i think that this will only add 50 to players gold every 5 seconds no matter how many income buildings you have unless if the custom script takes care of tht because idk how 2 use custom script. And also idk if u wud be able 2 make the program be able 2 tell how many units are owned by each player with this trigger. Im pretty sure u need to use variables to tell how many units there are and who they are owned by unless u can do it by custom script which i kno nothing about.
 
Status
Not open for further replies.
Top