• 🏆 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 7
Joined
Jul 11, 2007
Messages
512
Hello, i was looking for an income tutorial but i found none to suit my needs.
Can someone help me with this? I tried something but without succes :( and i had an unprotected map i could use to learn from it but i don't have it so i can't look.. :sad:

Anyway thanks in advance. :thumbs_up:
 
Last edited:
Level 8
Joined
Mar 23, 2007
Messages
302
Ok i will help u, but u need give me much more information cuz there are thousand of possibilities for an income system.

What types of Worth(Gold, Lumber, Cristals ...)
Gain availibilities,
Rate,
Max amount,
Min amount,
Conditions ( buldings like: tressor, Bank etc )
Conditions ( other )
Bonuses,
....

it is like this, The more information i gain from u the more it will be like
u want it to be and it will quicken the progress.

Greets Equal
 
Level 14
Joined
Apr 21, 2007
Messages
1,465
  • Events
    • Time - Every 5.00 seconds of game time
  • Conditions
  • Actions
    • Player - Add 20 to Player 1 (Red) Current gold
Simply modify the interval by changing the seconds and modify the amount and resource by changing the action. If you have some kind of gold farms you can easily set the income to be equal to 20xnumber of gold farms using variables.
 
Level 7
Joined
Jul 11, 2007
Messages
512
Cmarket: Thats what i did (i did smt like in the photo, just diff values)
Equal: I want a farm based income (wood), like 50 wood per farm, but i dont know how to do that and variables are still something unknown for me..
Thanks for helping (both) ^^
EDIT: I want for a melee building so i can change to my custom one (farm is the best option)
The resource needed is wood.
Interval: 30 seconds
Depends on farm number: Yes
Max amount: Let's say... 2000
Players: All
(If i want to make an upgrade for farm i just CnP and change values, no?)
 
Last edited:
Level 17
Joined
Jun 12, 2007
Messages
1,261
Make a integer for each player to keep track of the amount of farms.

As an example to update:
Player red builds a farm.
- Set PlayerRedFarms = PlayerRedFarms + 1

And when it dies you just do this:
- Set PlayerRedFarms = PlayerRedFarms - 1

Now you make a trigger to add it up.
Every 30 seconds of the game, add PlayerRedFarms x 20 (So 20 wood for each farm.) to player red current lumber.

To limit it just add a condition that the lumber amount of player red is lower then 1980. (2000 - income (20 here).

I don't have a editor handy so sorry if it's hard to figure out what I said. :p
 
Level 6
Joined
Aug 13, 2008
Messages
197
In trigger form =)

event- every (your time)
condition-
action- add {randomly pick (max amount) in every units in (Player's farm) matching type (farm) x (amount of gold you want)} to player 1 current gold
-----repeat for every player-----
 
Level 8
Joined
Mar 20, 2007
Messages
224
In trigger form =)

event- every (your time)
condition-
action- randomly pick (max amount) in every units in (Player's farm) matching type (farm) x (amount of gold you want)

I would advice against that.

  • Melee Initialization
    • Events
      • Time - Every 30.00 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Player - Add ((Number of living Farm units owned by (Picked player)) to Player 1 (Red) x 1) Current gold
 
Level 17
Joined
Jun 12, 2007
Messages
1,261
That trigger would leak right?
I don't know if he wants it to be leak free but I say it's best to use integers to store values, that way it wont leak. =S
Since if he has trouble with a trigger like this he should not try custum scripts.

Basicly you need 3 triggers, and u just add the players to it as in the example of red.

  • Income
    • Events
      • Time - Every 20.00 seconds of game time
    • Conditions
    • Actions
      • Player - Add (PlayerRedFarms x 50) to Player 1 (Red) Current lumber
  • Set Farms
    • Events
      • Unit - A unit Finishes construction
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Constructed structure)) Equal to Farm
          • (Owner of (Constructed structure)) Equal to Player 1 (Red)
        • Then - Actions
          • Set PlayerRedFarms = (PlayerRedFarms + 1)
        • Else - Actions
  • Remove Farms
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Dying unit)) Equal to Player 1 (Red)
          • (Unit-type of (Dying unit)) Equal to Farm
        • Then - Actions
          • Set PlayerRedFarms = (PlayerRedFarms - 1)
        • Else - Actions
 

Rui

Rui

Level 41
Joined
Jan 7, 2005
Messages
7,550
It does nothing, that's why it is a leak.
A leak is a piece of unused memory, if you're not using it [the object], then you should just delete it, because it's taking up memory. One leak is not important, but in cases of spells or systems that run a lot, the memory leaks can pile up, causing trouble (lag, to be more specific).
 
Level 17
Joined
Jun 12, 2007
Messages
1,261
No, I am pretty sure my trigger will not leak.

Your trigger will leak, here is why:
- You are using a pick all players in player group all players, but you don't use a custum script to remove that group thus it makes a leak as far as I know.
I don't know the custums script to remove that group so I just make a totaly different trigger.

That´s why I recommand using my trigger since it uses variables to store the amount of farms and give it to each player´s resources.
 
Status
Not open for further replies.
Top