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

Noobish question

Status
Not open for further replies.
Level 8
Joined
Jun 13, 2007
Messages
313
Ok, this a a noobish question.

How could I make a trigger that incrased a player's income every time he did a given action and decrease every time he did another action? I tried doing something like when a player builds one thing, his current income trigger is truned off and another one is turned on, but that doesnt work so well.....

:confused:
 
Level 2
Joined
May 24, 2007
Messages
12
  • Events
  • A Unit [does whatever action]
  • Conditions
  • Ability being cast equal to [ability] (Only if the action is an ability, you may need to change this depending on the action (Such as attacking a specific unit))
  • Actions
  • Set Income[Player#] to Income[Player#] + [amount to add]
or to decrease
  • Set Income[Player#] to Income[Player#] - [amount to subtract]
Example:
  • Events
  • A unit starts the effect of an ability.
  • Conditions
  • Ability being cast equal to Add Income
  • Actions
  • Set Income[(Player Number of Owner of (Casting Unit))] to Income[(Player Number of Owner of (Casting Unit))] + 5
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
Well, make a variable that holds the player's income (array if more than one player has income)

Then, when they get income, add that Variable to their (gold or lumber or whatever)

Then, when they build a building (or whatever event), add n to their income variable. If they lose a building (or whatever event), subtract n from their income variable.

Example;

  • Increase Income
    • Events
      • Unit - A Unit Finishes Training a Unit
    • Conditions
      • (Unit-Type of (Trained Unit)) Equal to Income Upgrader
    • Actions
      • Set PlayerIncome[(Player Number of (Triggering Player))] = PlayerIncome[(Player Number of (Triggering Player))] + 50
Then, for the income provider,

  • Provide Income
    • Events
      • Something Happens
    • Conditions
      • Something is true
    • Actions
      • For Each Integer A from 1 to 12, do actions
        • Loop - Actions
          • Player - Add PlayerIncome[(For Loop Integer A)] to (Player (For Loop Integer A))'s Current Gold
Also, try to title your threads to the question that you're asking. You're less likely to get an answer for a "Noobish Question". And remember, there are (almost) no stupid questions ><.
 
Status
Not open for further replies.
Top