1. Head to the 33rd Modeling Contest Poll and drink to your heart's desire.
    Dismiss Notice
  2. Choose your means of doom in the 17th Mini Mapping Contest Poll.
    Dismiss Notice
  3. A slave to two rhythms, the 22nd Terraining Contest is here.
    Dismiss Notice
  4. The heavens smile on the old faithful. The 16th Techtree Contest has begun.
    Dismiss Notice
  5. The die is cast - the 6th Melee Mapping Contest results have been announced. Onward to the Hive Cup!
    Dismiss Notice
  6. The glory of the 20th Icon Contest is yours for the taking!
    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.

Spawn System

Discussion in 'Requests' started by Watcher, Oct 5, 2018.

  1. Watcher

    Watcher

    Joined:
    Aug 31, 2011
    Messages:
    87
    Resources:
    0
    Resources:
    0
    Hi guys,

    I need willing volunteer who can create a spawn system for my map. I have already searched for the spawn system, but most of them are respawn systems which I don't need.

    Map explanation

    Each player gets a spawn (different unit types, different amounts of each type) on a fixed map locations (in players' bases) every 60 secs.

    System should adjust to few things:
    1. Some events or upgrades would add new spawn type units, or they would increase the numbers of spawned units.
    2. Every player has few spawning locations inside their bases, which would spawn different units.
    3. Some spawning locations might share some of the same unit types.

    For example
    Player 1 - Humans, would have 3 bases (Barracks, Church, Aviary), Barracks would spawn 3 footmen and 3 archers, Church - 2 priests and 2 zealots, etc. By using upgrade "Stables", you would add 2 knights to the Barracks spawn, but not to the other spawns. By using upgrade "Fanaticism", you would add 2 more zealots to the Church spawn.

    Can anyone create this kind of spawn system for me or give me some guidelines of how to do it?

    Thanks in advance!
     
  2. Tuwnew

    Tuwnew

    Joined:
    Apr 20, 2014
    Messages:
    316
    Resources:
    0
    Resources:
    0
    I have never made it but it does not look complicated.

    You can do this with quite a lot of conditions (there may be a way to optimisize this).

    Create a first trigger who launch the spawn every X seconds.
    Then, you must determine which units are spawned.

    If upgrade1 is researched, then spawn Y units at location.
    Else, spawn Z units.


    Do you need more indications or you have an idea now?
     
  3. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    3,788
    Resources:
    1
    Spells:
    1
    Resources:
    1
    A better way is not to use a big IF tree, instead have an array variable for each type of unit that can be created that stores how many of that unit type should be created for a particular player. Array indices [1] through [24] are used for this. Then in your periodic trigger check each of the different arrays and create that many of each type of unit. If it shouldn't be any, a 0 in the array will produce 0 units automatically.
     
  4. Watcher

    Watcher

    Joined:
    Aug 31, 2011
    Messages:
    87
    Resources:
    0
    Resources:
    0
    So basically I would need one unit type array variable, one array variable for unit count and one array variable for players (force) and set them into a different loops for different players?

    Edit: Solved in another thread. Ty Pyrogasm!
     
    Last edited: Oct 9, 2018