• 🏆 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 mine trigger.

Status
Not open for further replies.
Level 9
Joined
Jul 11, 2009
Messages
294
Hi i'm in need of a trigger that gives off gold every few seconds depending on how many gold mines you have.

Lets say each gold mine gives you 10 gold every 10 seconds.
I've 10 gold mines built,so it should give me 100 gold every 10 seconds.
How do i do that for all players? (I need it for 9 players.)

Thanks in advance. +rep to anyone that can help.
 
Level 10
Joined
Mar 16, 2009
Messages
354
what i need is that i can build gold mines, each gold mine gives me 10 gold every 10 seconds

What this system does, you should look at it, is that when you gain a certain amount of something(set by dialogs in the start), such as food, or units you gain a gold per second amount. You can change the values by adding conditions to set it so that the units bound to the income variable per player with the array of that player are the "Gold Mine" unit.

Did you take a look at the system?

Settings
Events
Time - Elapsed game time is 0.00 seconds
Conditions
Actions
Dialog - Create a dialog button for Settings_Dialog labelled Units
Set Button_Dialog[1] = (Last created dialog Button)
Dialog - Create a dialog button for Settings_Dialog labelled Food
Set Button_Dialog[2] = (Last created dialog Button)
Dialog - Create a dialog button for Settings_Dialog labelled Gold
Set Button_Dialog[3] = (Last created dialog Button)
Dialog - Create a dialog button for Settings_Dialog labelled Structures
Set Button_Dialog[4] = (Last created dialog Button)
-------- --------
Dialog - Change the title of Settings_Dialog to Set income
Dialog - Show Settings_Dialog for Player 1 (Red)
Trigger - Turn on SettingsChosen <gen>
SettingsChosen
Events
Dialog - A dialog button is clicked for Settings_Dialog
Conditions
Actions
-------- This Function of the Trigger is When the Dialog buttons is Clicked:p --------
-------- It makes a Boolean True and The Boolean has mutch to say:p --------
Set PlayerForce = (All players controlled by a User player)
Player Group - Pick every player in (All players) and do (Actions)
Loop - Actions
Set CounterPlayer = (Picked player)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Clicked dialog button) Equal to Button_Dialog[1]
Then - Actions
Set Unit[(Player number of CounterPlayer)] = True
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Clicked dialog button) Equal to Button_Dialog[2]
Then - Actions
Set Food[(Player number of CounterPlayer)] = True
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Clicked dialog button) Equal to Button_Dialog[3]
Then - Actions
Set Gold[(Player number of CounterPlayer)] = True
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Clicked dialog button) Equal to Button_Dialog[4]
Then - Actions
Set Structures[(Player number of CounterPlayer)] = True
Else - Actions
Trigger - Turn on IncomeTimer <gen>
Custom script: call DestroyForce(udg_PlayerForce)
IncomeTimer
Events
Time - Every 30.00 seconds of game time
Conditions
Actions
-------- You can easily change the income timer. Default is 30 seconds. --------
-------- --------
-------- --------
-------- First of all i pick all players --------
Set Income_PlayerForce = (All players controlled by a User player)
Player Group - Pick every player in Income_PlayerForce and do (Actions)
Loop - Actions
-------- Here i set the player variable --------
Set Player[(Player number of (Picked player))] = (Picked player)
-------- Im setting the income --------
Set Income[(Player number of (Picked player))] = (Count[(Player number of (Picked player))] x 10)
-------- Then i give the player his income --------
Player - Add Income[(Player number of (Picked player))] to (Picked player) Current gold
-------- And last, i show the income of all players in use --------
Game - Display to (All players) for 10.00 seconds the text: ((Name of (Picked player)) + ('s income: + (String(Income[(Player number of (Picked player))]))))
Custom script: call DestroyForce(udg_Income_PlayerForce)
Counter
Events
Time - Every 0.47 seconds of game time
Conditions
Actions
-------- Basiccly What this Does is Counting All the Things over and over again to Make the Counter Right:p --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Unit[(Player number of CounterPlayer)] Equal to True
Then - Actions
Set Count[(Player number of CounterPlayer)] = (Count non-structure units controlled by CounterPlayer (Exclude incomplete units))
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Food[(Player number of CounterPlayer)] Equal to True
Then - Actions
Set Count[(Player number of CounterPlayer)] = (CounterPlayer Food used)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Gold[(Player number of CounterPlayer)] Equal to True
Then - Actions
Set Count[(Player number of CounterPlayer)] = ((CounterPlayer Current gold) / 20)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Structures[(Player number of CounterPlayer)] Equal to True
Then - Actions
Set Count[(Player number of CounterPlayer)] = (Count structures controlled by CounterPlayer (Exclude incomplete structures))
Else - Actions
 
Level 4
Joined
Jul 30, 2010
Messages
57
I didn't see the system so i don't know if are the same things but you can use this
  • Gold Mines
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to Gold Mine
    • Actions
      • Set Gold_Mines[(Player number of (Owner of (Constructed structure)))] = (Gold_Mines[(Player number of (Owner of (Constructed structure)))] + 1)
Gold_mines is an Integer Variable
  • Gold Mines3
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to Gold Mine
    • Actions
      • Set Gold_Mines[(Player number of (Owner of (Dying unit)))] = (Gold_Mines[(Player number of (Owner of (Dying unit)))] - 1)
And use this to receive the Gold
  • Gold Mines 2
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Player - Add (10 x Gold_Mines[(Integer A)]) to (Player((Integer A))) Current gold
 
Status
Not open for further replies.
Top