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

Tutorial: Easy income system

Level 7
Joined
Feb 22, 2009
Messages
158
Hello today this tutorial (THIS IS MINI-TUTORIAL!) will show you how to do basicly correct income (Without Leaks).

My own income sysyem (I use this in my maps):
  • Non-Leaking Income
    • Events
      • Time - Every X seconds of the game time
    • Conditions
    • Actions
      • Set tempGroup = (Units of type X Building)
      • Unit Group - Pick every unit in tempGroup and do (Actions)
        • Loop - Actions
          • Set tempForce = (Player group((Owner of (Picked unit))))
          • Player Group - Pick every player in tempForce
            • Loop - Actions
              • Player - Add 1 to (Owner of (Picked unit)))) Current gold
      • Custom script: call DestroyGroup(udg_tempGroup)
      • Custom script: call DestroyForce(udg_tempForce)
FAQ
Question 1: Is this income system gives gold for each player who have income building?
Answer: Yes.

Question 2: Why you subbmited this tutorial?
Answer: Becouse there are some newbies who must know that.

Question 3: How i could improve this income trigger?
Answer: Thats need to be maked by your own if you wanna better trigger.

Question 4: Is this trigger leaks?
Answer: This trigger isn't leaks.
 
Last edited:
Level 3
Joined
May 3, 2009
Messages
37
Double post much? :p. Remember the "Edit" button... bur I think your just trying to bump your post up. Anyways... this is way to simple. If this is acceptable then Hive will be swarming with short tutorials.

For future reference, fixing leaks is time consuming buisness. But can make your map much better.

You know whats a map with a bullshit load of memory leaks? Hungry Hungry Felhounds. Try goremode...
 
Level 21
Joined
Aug 21, 2005
Messages
3,699
Question 4: Is this trigger leaks?
Answer: this trigger *is* leaks.

For each unit in the group you create a new TempForce. You only remove the TempForce once, at the end of the trigger. So you leak n-1 forces, n being the amount of buildings.
Also note that "Convert player to player group" GUI action leaks anyway, you need to jass the whole thing.

Just the fact alone that you create a force consisting of 1 player and then pick every player in that force (being that one player) and then doing absolutely nothing with the picked player is stupid. Get rid of the force alltogether.

There's also a bug: you're also counting destroyed buildings that haven't decayed yet. Set TempGroup = units of type "building" matching (matching unit is alive equal to true)
 
Level 9
Joined
Aug 21, 2008
Messages
533
You are just give us a trigger without any eyplanation. But thats exactly what a tutorial should make:ugly:

If you explain it people may understand all parts of it and create their own systems of income. If you give some alternate ways for the income(like using a upgrade for income or hero lvl or whatever).THEn it would be a tutorial.
 
Top