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

Status
Not open for further replies.
Not sure if you need it to be MPI but here's a general baseline:

  • Income
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Player - Set Player 1 (Red) Current gold to ((Player 1 (Red) Current gold) + Income)

  • Make Farm
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to Farm
    • Actions
      • Set Income = (Income + 1)

  • Farm Dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Farm
    • Actions
      • Set Income = (Income - 1)
 
I want a system that works with gold mines for gold and lumber mill for lumber
5 lvl for each(for now)
and a maximum of 2 for each(for now)
So if I understand right, you want to limit amount of lumber mills and gold mines to 2 per player, and the lumber mills and gold mines gives wood/gold income? And the income amount per gold mine/lumber mill is determined by the level of each buildings upgrade?

Is it possible to destroy these buildings?
 
I gave it a try. It works fine, but I have no idea how to make the same building have separate researchable skills so now they both have two similar upgrades lol. Maybe someone else can help with that (I'm sure it can be done by using abilities instead of actual upgrades, but then the upgrade will happen instantly). I just did gold now, you have to do lumber yourself. Just follow the same example. Attaching a test map so you can copy/paste, just remember to set the correct building variables etc.

Type 1 or 2 to kill the income buildings.


  • Income
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set IncomeTotal = (IncomeP1[1] + IncomeP1[2])
      • Player - Set Player 1 (Red) Current gold to ((Player 1 (Red) Current gold) + IncomeTotal)
      • Game - Display to (All players) the text: (You gained |cffffff00+ + ((String(IncomeTotal)) + |r gold!))

  • Income Upgrade 1
    • Events
      • Unit - A unit Finishes research
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Researched tech-type) Equal to More Income Gold Upgrade P1 Building 1
          • UpgradeLevelP1[1] Equal to 4
        • Then - Actions
          • Set IncomeP1[1] = (IncomeP1[1] + 1)
          • Set UpgradeLevelP1[1] = 5
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Researched tech-type) Equal to More Income Gold Upgrade P1 Building 1
          • UpgradeLevelP1[1] Equal to 3
        • Then - Actions
          • Set IncomeP1[1] = (IncomeP1[1] + 1)
          • Set UpgradeLevelP1[1] = 4
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Researched tech-type) Equal to More Income Gold Upgrade P1 Building 1
          • UpgradeLevelP1[1] Equal to 2
        • Then - Actions
          • Set IncomeP1[1] = (IncomeP1[1] + 1)
          • Set UpgradeLevelP1[1] = 3
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Researched tech-type) Equal to More Income Gold Upgrade P1 Building 1
          • UpgradeLevelP1[1] Equal to 1
        • Then - Actions
          • Set IncomeP1[1] = (IncomeP1[1] + 1)
          • Set UpgradeLevelP1[1] = 2
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Researched tech-type) Equal to More Income Gold Upgrade P1 Building 1
          • UpgradeLevelP1[1] Equal to 0
        • Then - Actions
          • Set IncomeP1[1] = (IncomeP1[1] + 1)
          • Set UpgradeLevelP1[1] = 1
        • Else - Actions

  • Income Upgrade 2
    • Events
      • Unit - A unit Finishes research
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Researched tech-type) Equal to More Income Gold Upgrade P1 Building 2
          • UpgradeLevelP1[2] Equal to 4
        • Then - Actions
          • Set IncomeP1[2] = (IncomeP1[2] + 1)
          • Set UpgradeLevelP1[2] = 5
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Researched tech-type) Equal to More Income Gold Upgrade P1 Building 2
          • UpgradeLevelP1[2] Equal to 3
        • Then - Actions
          • Set IncomeP1[2] = (IncomeP1[2] + 1)
          • Set UpgradeLevelP1[2] = 4
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Researched tech-type) Equal to More Income Gold Upgrade P1 Building 2
          • UpgradeLevelP1[2] Equal to 2
        • Then - Actions
          • Set IncomeP1[2] = (IncomeP1[2] + 1)
          • Set UpgradeLevelP1[2] = 3
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Researched tech-type) Equal to More Income Gold Upgrade P1 Building 2
          • UpgradeLevelP1[2] Equal to 1
        • Then - Actions
          • Set IncomeP1[2] = (IncomeP1[2] + 1)
          • Set UpgradeLevelP1[2] = 2
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Researched tech-type) Equal to More Income Gold Upgrade P1 Building 2
          • UpgradeLevelP1[2] Equal to 0
        • Then - Actions
          • Set IncomeP1[2] = (IncomeP1[2] + 1)
          • Set UpgradeLevelP1[2] = 1
        • Else - Actions

  • Income Building Dies
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Triggering unit) Equal to IncomeBuildingP1[1]
        • Then - Actions
          • Set IncomeP1[1] = 0
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Triggering unit) Equal to IncomeBuildingP1[2]
        • Then - Actions
          • Set IncomeP1[2] = 0
        • Else - Actions

  • Construct Building
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to Farm
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (IncomeBuildingP1[1] is alive) Equal to True
        • Then - Actions
          • Set IncomeBuildingP1[2] = (Constructed structure)
        • Else - Actions
          • Set IncomeBuildingP1[1] = (Constructed structure)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • UpgradeLevelP1[1] Equal to 1
          • (Constructed structure) Equal to IncomeBuildingP1[1]
        • Then - Actions
          • Set IncomeP1[1] = 1
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • UpgradeLevelP1[2] Equal to 1
              • (Constructed structure) Equal to IncomeBuildingP1[2]
            • Then - Actions
              • Set IncomeP1[2] = 1
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • UpgradeLevelP1[1] Equal to 2
          • (Constructed structure) Equal to IncomeBuildingP1[1]
        • Then - Actions
          • Set IncomeP1[1] = 2
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • UpgradeLevelP1[2] Equal to 2
              • (Constructed structure) Equal to IncomeBuildingP1[2]
            • Then - Actions
              • Set IncomeP1[2] = 2
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • UpgradeLevelP1[1] Equal to 3
          • (Constructed structure) Equal to IncomeBuildingP1[1]
        • Then - Actions
          • Set IncomeP1[1] = 3
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • UpgradeLevelP1[2] Equal to 3
              • (Constructed structure) Equal to IncomeBuildingP1[2]
            • Then - Actions
              • Set IncomeP1[2] = 3
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • UpgradeLevelP1[1] Equal to 4
          • (Constructed structure) Equal to IncomeBuildingP1[1]
        • Then - Actions
          • Set IncomeP1[1] = 4
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • UpgradeLevelP1[2] Equal to 4
              • (Constructed structure) Equal to IncomeBuildingP1[2]
            • Then - Actions
              • Set IncomeP1[2] = 4
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • UpgradeLevelP1[1] Equal to 5
          • (Constructed structure) Equal to IncomeBuildingP1[1]
        • Then - Actions
          • Set IncomeP1[1] = 5
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • UpgradeLevelP1[2] Equal to 5
              • (Constructed structure) Equal to IncomeBuildingP1[2]
            • Then - Actions
              • Set IncomeP1[2] = 5
            • Else - Actions

  • Limit Training
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Player - Limit training of Farm to 2 for Player 1 (Red)

I'm sure this can probably be done better but it seems like it works for all intended purposes.
 

Attachments

  • Income2.w3x
    21 KB · Views: 22
Last edited:
Level 8
Joined
Aug 13, 2018
Messages
338
Not sure if you need it to be MPI but here's a general baseline:

  • Income
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Player - Set Player 1 (Red) Current gold to ((Player 1 (Red) Current gold) + Income)

  • Make Farm
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to Farm
    • Actions
      • Set Income = (Income + 1)

  • Farm Dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Farm
    • Actions
      • Set Income = (Income - 1)
Using this, and another trigger for upgrades
 
Status
Not open for further replies.
Top