1. Are you planning to upload your awesome spell or system to Hive? Please review the rules here.
    Dismiss Notice
  2. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  3. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  4. We have recently started the 16th edition of the Mini Mapping Contest. The theme is mini RPG. Do check it out and have fun.
    Dismiss Notice
  5. Dismiss Notice
  6. The Highway to Hell has been laid open. Come along and participate in the 5th Special Effect Contest.
    Dismiss Notice
  7. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Simple Resource Generator System v1.2 [GUI]

Submitted by defskull
This bundle is marked as approved. It works and satisfies the submission rules.
INTRODUCTIONS
- This system will allow your building to auto generate resource.
- You can adjust the income and the interval between receiving income.
- It is GUI-friendly :)


HOW TO USE
External Instructions
- Open World Editor - File - Preferences... - General Tab - Tick the Automatically create unknown variables while pasting trigger data
- Copy the Simple Resource Generator System folder.
- Further instructions inside the RG Setup Trigger.

Internal Instructions
There are 4 types of configurables;
RG_Building - Which building you want ?
RG_Income - What amount of income do you want from the building ?
RG_DurationInterval - What is the interval in-between receiving income from the building ?
RG_ResourceType - What kind of resource do you want that building to supply ?
- ResourceTypeFood
- ResourceTypeLumber
- ResourceTypeGold


TRIGGERS
  • RG Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: set udg_RG_Hashtable = InitHashtable()
      • -------- Do not touch this if you don't know what you are doing --------
      • Set RG_ResourceTypeFood = 1
      • Set RG_ResourceTypeLumber = 2
      • Set RG_ResourceTypeGold = 3
      • Set RG_MaxResource = 3
      • -------- RG_Building sets the building you want data to be saved --------
      • -------- RG_Income sets the value per interval for that building type --------
      • -------- RG_DurationInterval sets the interval per income --------
      • -------- RG_ResourceType sets what kind of Resource is available for that building --------
      • -------- You can choose between: --------
      • -------- 1. ResourceTypeFood --------
      • -------- 2. ResourceTypeLumber --------
      • -------- 3. ResourceTypeGold --------
      • -------- DATA CONFIGURABLES --------
      • Set RG_Building = Meathouse
      • Set RG_Income = 2
      • Set RG_DurationInterval = 2.00
      • Set RG_ResourceType = RG_ResourceTypeFood
      • Trigger - Run RG Save <gen> (ignoring conditions)
      • -------- 2ND BUILDING --------
      • Set RG_Building = Lumber Mill
      • Set RG_Income = 10
      • Set RG_DurationInterval = 10.00
      • Set RG_ResourceType = RG_ResourceTypeLumber
      • Trigger - Run RG Save <gen> (ignoring conditions)
      • -------- 3RD BUILDING --------
      • Set RG_Building = Marketplace
      • Set RG_Income = 20
      • Set RG_DurationInterval = 5.00
      • Set RG_ResourceType = RG_ResourceTypeGold
      • Trigger - Run RG Save <gen> (ignoring conditions)
      • -------- END OF CONFIGURABLES --------
      • -------- ---------- --------
      • -------- CONSTANTS CONFIGURABLES --------
      • Set RG_Triggers[1] = RG Food <gen>
      • Set ResourceColor[1] = |CFFFF0000
      • Set RG_Triggers[2] = RG Lumber <gen>
      • Set ResourceColor[2] = |CFF00FF00
      • Set RG_Triggers[3] = RG Gold <gen>
      • Set ResourceColor[3] = |CFFFFD700
      • -------- ---------- --------
      • -------- FLOATING TEXT CONFIGURABLES --------
      • -------- RG_FloatingTextSpeed sets the speed of the Floating Text to move out of the building --------
      • -------- RG_FloatingTextLifeSpan sets the duration of Floating Text --------
      • -------- RG_FloatingTextFadeTime sets the duration of fading time for the Floating Text - it is suggested that this value should be the half of RG_FloatingTextLifeSpan --------
      • -------- ---------- --------
      • Set RG_FloatingTextSpeed = 64.00
      • Set RG_FloatingTextLifeSpan = 5.00
      • Set RG_FloatingTextFadeTime = 2.50
      • -------- END OF CONFIGURABLES --------
      • Set RG_Interval = 0.03
      • Trigger - Add to RG Loop <gen> the event (Time - Every RG_Interval seconds of game time)


  • RG Save
    • Events
    • Conditions
    • Actions
      • Set RG_BooleanResourceBuilding = True
      • Custom script: set udg_RG_Key = udg_RG_Building
      • Hashtable - Save RG_Income as 0 of RG_Key in RG_Hashtable
      • Hashtable - Save RG_DurationInterval as 1 of RG_Key in RG_Hashtable
      • Hashtable - Save RG_ResourceType as 2 of RG_Key in RG_Hashtable
      • Hashtable - Save RG_BooleanResourceBuilding as 3 of RG_Key in RG_Hashtable


  • RG Event
    • Events
      • Unit - A unit Finishes construction
    • Conditions
    • Actions
      • Set TempUnit = (Triggering unit)
      • Set TempUnitType = (Unit-type of TempUnit)
      • Custom script: set udg_RG_Key = udg_TempUnitType
      • Set RG_BooleanResourceBuilding = (Load 3 of RG_Key from RG_Hashtable)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RG_BooleanResourceBuilding Equal to True
        • Then - Actions
          • Unit Group - Add TempUnit to RG_Group
          • Set RG_DurationInterval = (Load 1 of RG_Key from RG_Hashtable)
          • Custom script: set udg_RG_Key = GetHandleId(udg_TempUnit)
          • Hashtable - Save RG_DurationInterval as 1 of RG_Key in RG_Hashtable
          • Trigger - Turn on RG Loop <gen>
        • Else - Actions


  • RG Loop
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (RG_Group is empty) Equal to True
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Unit Group - Pick every unit in RG_Group and do (Actions)
            • Loop - Actions
              • Set TempUnit = (Picked unit)
              • Custom script: set udg_RG_Key = GetHandleId(udg_TempUnit)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (TempUnit is alive) Equal to True
                • Then - Actions
                  • Set RG_DurationInterval = (Load 1 of RG_Key from RG_Hashtable)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • RG_DurationInterval Greater than 0.00
                    • Then - Actions
                      • Hashtable - Save (RG_DurationInterval - RG_Interval) as 1 of RG_Key in RG_Hashtable
                    • Else - Actions
                      • Set TempUnitType = (Unit-type of TempUnit)
                      • Custom script: set udg_RG_Key = udg_TempUnitType
                      • Set RG_DurationInterval = (Load 1 of RG_Key from RG_Hashtable)
                      • Set RG_ResourceType = (Load 2 of RG_Key from RG_Hashtable)
                      • Set RG_Income = (Load 0 of RG_Key from RG_Hashtable)
                      • Custom script: set udg_RG_Key = GetHandleId(udg_TempUnit)
                      • Hashtable - Save RG_DurationInterval as 1 of RG_Key in RG_Hashtable
                      • Trigger - Run RG_Triggers[RG_ResourceType] (ignoring conditions)
                • Else - Actions
                  • Unit Group - Remove TempUnit from RG_Group
                  • Hashtable - Clear all child hashtables of child RG_Key in RG_Hashtable


  • RG Food
    • Events
    • Conditions
    • Actions
      • Set TempPlayerGroup = (Player group((Owner of TempUnit)))
      • Player - Add RG_Income to (Owner of TempUnit) Food cap
      • Floating Text - Create floating text that reads (ResourceColor[1] + ((String(RG_Income)) + |r)) above TempUnit with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Set TempFloatingText = (Last created floating text)
      • Floating Text - Hide TempFloatingText for (All players)
      • Floating Text - Show TempFloatingText for TempPlayerGroup
      • Floating Text - Set the velocity of TempFloatingText to RG_FloatingTextSpeed towards 90.00 degrees
      • Floating Text - Change TempFloatingText: Disable permanence
      • Floating Text - Change the lifespan of TempFloatingText to RG_FloatingTextLifeSpan seconds
      • Floating Text - Change the fading age of TempFloatingText to RG_FloatingTextFadeTime seconds
      • Custom script: call DestroyForce(udg_TempPlayerGroup)


  • RG Lumber
    • Events
    • Conditions
    • Actions
      • Set TempPlayerGroup = (Player group((Owner of TempUnit)))
      • Player - Add RG_Income to (Owner of TempUnit) Current lumber
      • Floating Text - Create floating text that reads (ResourceColor[2] + ((String(RG_Income)) + |r)) above TempUnit with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Set TempFloatingText = (Last created floating text)
      • Floating Text - Hide TempFloatingText for (All players)
      • Floating Text - Show TempFloatingText for TempPlayerGroup
      • Floating Text - Set the velocity of TempFloatingText to RG_FloatingTextSpeed towards 90.00 degrees
      • Floating Text - Change TempFloatingText: Disable permanence
      • Floating Text - Change the lifespan of TempFloatingText to RG_FloatingTextLifeSpan seconds
      • Floating Text - Change the fading age of TempFloatingText to RG_FloatingTextFadeTime seconds
      • Custom script: call DestroyForce(udg_TempPlayerGroup)


  • RG Gold
    • Events
    • Conditions
    • Actions
      • Set TempPlayerGroup = (Player group((Owner of TempUnit)))
      • Player - Add RG_Income to (Owner of TempUnit) Current gold
      • Floating Text - Create floating text that reads (ResourceColor[3] + ((String(RG_Income)) + |r)) above TempUnit with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Set TempFloatingText = (Last created floating text)
      • Floating Text - Hide TempFloatingText for (All players)
      • Floating Text - Show TempFloatingText for TempPlayerGroup
      • Floating Text - Set the velocity of TempFloatingText to RG_FloatingTextSpeed towards 90.00 degrees
      • Floating Text - Change TempFloatingText: Disable permanence
      • Floating Text - Change the lifespan of TempFloatingText to RG_FloatingTextLifeSpan seconds
      • Floating Text - Change the fading age of TempFloatingText to RG_FloatingTextFadeTime seconds
      • Custom script: call DestroyForce(udg_TempPlayerGroup)


CREDITS
Inspired by a game called Command - Conquer: Generals
Magtheridon96 - Suggestions/code optimization


CHANGELOGS
v1.0
- Initial release

v1.1
- Changed some instructions and comments
- Included somewhat, documentation-friendly-like-text
- Code optimized a bit (removed O(n) search)
- Changed some variable name

v1.2
- Resource Gain is shown only to the Player owning the building
- Floating Text attributes are now configurables


Keywords:
simple, resource, generator, system, defskull, hashtable, gold, food, lumber, money, builder, income.
Contents

Just another Warcraft III map (Map)

Reviews
Moderator
01:47, 16th Jul 2012 Magtheridon96: Approved. This is an excellent system. There are some speed quirks that could be taken into consideration, but I find it hard to care. :P Good job. This is an ideal system that does no extra operations...
  1. 01:47, 16th Jul 2012
    Magtheridon96: Approved.
    This is an excellent system.
    There are some speed quirks that could be taken into consideration, but I find it hard to care. :p

    Good job. This is an ideal system that does no extra operations (algorithmically speaking)

    Old reviews
    Well, it does it's job pretty well. Just a few tips:

    • When a unit is constructed, you don't need to loop to determine
      whether you should add him to the group or not, you can save a
      boolean into the hashtable to determine whether the structure would
      produce a resource or not and load that instead.
    • There needs to be an easier way to add resources to the system.

    Something like the below trigger would suffice:

    Trigger
    • Init
      • Events
        • Map Initialization
      • Conditions
      • Actions
        • -------- Resource Types --------
        • Set ResourceTypeFood = 1
        • Set ResourceTypeLumber = 2
        • Set ResourceTypeGold = 3
        • Set ResourceTypeLaz0rs = 4
        • -------- --- --------
        • Set Resource_Building = Meathouse
        • Set Resource_Type = ResourceTypeFood
        • Set Resource_Income = 60
        • Run ResourceSetup <gen> (ignoring conditions)
        • -------- --- --------
        • Set Resource_Building = GoldMine
        • Set Resource_Type = ResourceTypeGold
        • Set Resource_Income = 15
        • Run ResourceSetup <gen> (ignoring conditions)


    This would be much better. The ResourceSetup trigger would save
    the values into your hashtable, making this resource much easier for
    the user to ... use.
     
  2. defskull

    defskull

    Joined:
    Mar 27, 2008
    Messages:
    7,979
    Resources:
    17
    Spells:
    17
    Resources:
    17
    Reserved.
     
  3. Striker21

    Striker21

    Joined:
    Aug 7, 2009
    Messages:
    377
    Resources:
    0
    Resources:
    0
    Def-Kool :p (Definitely cool) :p
    okey, i can see no-leaks, it's a GUI-friendliness and easy-configurable
    Could be useful with GUIers
    Rated for 4/5 :p Nice

    Edit: This can be even better if having something more advance like: Playing building (unit) animations during the income time. And a special effects with the income time expiration
     
  4. defskull

    defskull

    Joined:
    Mar 27, 2008
    Messages:
    7,979
    Resources:
    17
    Spells:
    17
    Resources:
    17
    Thanks :)

    I'm trying to make a lagless system as I can, well, maybe it's okay to have SFX created for just 10 buildings or less, but if the players have built 20 buildings per player (12 * 20 = 240) SFX create per income interval (maybe some of them has different timer) but still, it would create a lag if it's done all at once.

    For playing the unit's animation would not create as much lag as SFX but, some of the animation has about more than 10 seconds of animation to complete, it could possibly overrides the duration of income interval and would play a not-complete-animation of the building thus could ruin the concept there.

    I'm more focusing towards functionality rather than visually.
     
  5. snowman990

    snowman990

    Joined:
    Aug 23, 2010
    Messages:
    586
    Resources:
    1
    Skins:
    1
    Resources:
    1
    Nice system, although I didn't need this for now. Why not add a unit generation system too? An example if you don't know what I mean.
    A barrack create 1 footman for each 5 seconds. Max 10 footman
     
  6. defskull

    defskull

    Joined:
    Mar 27, 2008
    Messages:
    7,979
    Resources:
    17
    Spells:
    17
    Resources:
    17
    I am planning to do that system for separate use.
    This one is for resources and that one is for units.
     
  7. -Kobas-

    -Kobas-

    Joined:
    Jan 17, 2010
    Messages:
    5,895
    Resources:
    28
    Icons:
    1
    Tools:
    2
    Maps:
    10
    Spells:
    4
    Template:
    5
    Tutorials:
    6
    Resources:
    28
  8. defskull

    defskull

    Joined:
    Mar 27, 2008
    Messages:
    7,979
    Resources:
    17
    Spells:
    17
    Resources:
    17
    It is up to you whether to think of it as stealing or whatever, you can check in the CREDITS from what game does this system inspires me.

    Also;
    I believed that (your system) is better than me.
     
  9. Tank-Commander

    Tank-Commander

    Spell Reviewer

    Joined:
    May 26, 2009
    Messages:
    1,540
    Resources:
    44
    Packs:
    1
    Spells:
    41
    Tutorials:
    2
    Resources:
    44
    Ah I remember doing something like this a while ago obviously, not released, personally I always think these systems are too map-specific (since everybody has to manually put in all the structures they want and blah) Triggering itself looks pretty good, I'm /assuming/ there's a big long instructions manual in the actual map itself, it's useful, Although I still think you should move onto using dynamic indexing for these kind of systems - they really are a waste when they're only holding a couple of variables and less efficient, there are quite a lot of tutorials on it, I suggest you go have a look at them, it'd make it cleaner and easier to understand for other people.
     
  10. defskull

    defskull

    Joined:
    Mar 27, 2008
    Messages:
    7,979
    Resources:
    17
    Spells:
    17
    Resources:
    17
    Updated to v1.1
     
  11. Ken-E

    Ken-E

    Joined:
    Apr 5, 2009
    Messages:
    571
    Resources:
    12
    Packs:
    1
    Maps:
    11
    Resources:
    12
    Just the thing I need for my map, thanks alot.
    Also, this works perfectly!
     
  12. MasterTrainer

    MasterTrainer

    Joined:
    Apr 14, 2012
    Messages:
    2,768
    Resources:
    3
    Icons:
    1
    Maps:
    1
    Spells:
    1
    Resources:
    3
    It's simple and easy to use. Great job on making this defskull! I hope you make more systems like these (in terms of awesomeness)!
     
  13. Sideblade

    Sideblade

    Joined:
    Aug 17, 2013
    Messages:
    63
    Resources:
    0
    Resources:
    0
    How the hell do I install this in my map? :/
     
  14. Krotos

    Krotos

    Joined:
    Aug 11, 2009
    Messages:
    161
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Digging this up a bit - I'm wondering about 2 things:
    - Can multiple buildings be chosen for a single resource? (E.g. graveyard 1, graveyard 2, farm 1, farm 2 all producing gold?)
    - Can I have more than 3 buildings in the setup?

    If not, could anyone redirect me to a system that allows the things mentioned above?