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

Egg Sack System v1.1

  • Like
Reactions: deepstrasz
Hello guys, this is my first system to be uploaded here. What it does as the name suggests is creates egg sacks on the specified region and maintains that particular number of egg sacks every interval. When killed, egg sacks will spawn a random number of unit-type specified. I can see that this can be useful on some rpg maps.


Egg Sack System - Creates a certain number of Egg Sacks on a region and maintains the set number of sacks every interval that can be specified by the user. Egg Sacks spawns in this example spiders, the large egg sacks creates large spiders, medium ones creates medium spiders and small sacks creates small spiders.

Features:
1. You can specify the number of sacks that can be spawned in the region
2. The sack checker turns off itself when no egg sacks are destroyed.
3. You can specify how many units can be spawned in a particular egg sack.

Requirements:
1. Requires a region where egg sacks can be spawned.
2. Requires a player that will own the egg sacks.

How to import:
1. On the main window of the world editor click File then Click Preferences then under General Tab tick the Automaticall Create Unknown Variable While Pasting Trigger Data.
2. Copy and paste the folder into your map. Once the triggers are in place set your custom region and register your regions.
3. Set the player that will own the egg sacks.
4. Create your egg sacks and spawned units and register them as well.
5. Just in case you want the same type of unit spawn on different kinds of sack, just register the different sacks then add same on unit on them.
6. If you want to spawn various types of units on a particular sack, register the sack one more time but this time give it a different unit.

Limitations:
1. Right now the system only supports one player as the host of the egg sacks.
2. It does not create items when egg sacks or spawned units are killed.





  • Egg Sack Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- number of egg sack unit types --------
      • Set ES_NumberOfSackType = 6
      • -------- register all egg sacks --------
      • Set ES_SackType[1] = Egg Sack (small 1)
      • Set ES_SackType[2] = Egg Sack (small 2)
      • Set ES_SackType[3] = Egg Sack (medium 1)
      • Set ES_SackType[4] = Egg Sack (medium 2)
      • Set ES_SackType[5] = Egg Sack (large 1)
      • Set ES_SackType[6] = Egg Sack (large 2)
      • -------- spiders spawned after the egg sack is destroyed --------
      • Set ES_SpawnType[1] = Spider (small)
      • Set ES_SpawnType[2] = Spider (small)
      • Set ES_SpawnType[3] = Spider (medium)
      • Set ES_SpawnType[4] = Spider (medium)
      • Set ES_SpawnType[5] = Spider (large)
      • Set ES_SpawnType[6] = Spider (large)
      • -------- minimum amount of units spawned --------
      • Set ES_SpawnMinimum[1] = 2
      • Set ES_SpawnMinimum[2] = 2
      • Set ES_SpawnMinimum[3] = 1
      • Set ES_SpawnMinimum[4] = 1
      • Set ES_SpawnMinimum[5] = 1
      • Set ES_SpawnMinimum[6] = 1
      • -------- maximum amount of units spawned --------
      • Set ES_SpawnMaximum[1] = 4
      • Set ES_SpawnMaximum[2] = 4
      • Set ES_SpawnMaximum[3] = 3
      • Set ES_SpawnMaximum[4] = 3
      • Set ES_SpawnMaximum[5] = 2
      • Set ES_SpawnMaximum[6] = 2
      • -------- number of regions --------
      • Set ES_NumberOfRegions = 4
      • -------- register regions --------
      • Set ES_SpawnRegions[1] = Region 1 <gen>
      • Set ES_SpawnRegions[2] = Region 2 <gen>
      • Set ES_SpawnRegions[3] = Region 3 <gen>
      • Set ES_SpawnRegions[4] = Region 4 <gen>
      • -------- maximum sacks in region --------
      • Set ES_MaxSacksInRegion[1] = 20
      • Set ES_MaxSacksInRegion[2] = 20
      • Set ES_MaxSacksInRegion[3] = 20
      • Set ES_MaxSacksInRegion[4] = 20
      • -------- host player --------
      • Set ES_SpiderPlayer = Player 2 (Blue)
      • -------- interval before creating more sacks --------
      • Set ES_TimerInterval = 45.00
      • -------- timer start --------
      • Countdown Timer - Start ES_Timer as a Repeating timer that will expire in ES_TimerInterval seconds
      • -------- spawn egg sacks --------
      • Trigger - Run Egg Sack Create <gen> (checking conditions)



  • Egg Sack Create
    • Events
      • Time - ES_Timer expires
    • Conditions
    • Actions
      • -------- enumerates region --------
      • For each (Integer ES_RegionLooper) from 1 to ES_NumberOfRegions, do (Actions)
        • Loop - Actions
          • Set ES_TempGroup = (Units in ES_SpawnRegions[ES_RegionLooper])
          • -------- enumerates region --------
          • For each (Integer ES_TypeLooper) from 1 to ES_NumberOfSackType, do (Actions)
            • Loop - Actions
              • -------- count egg sack --------
              • Unit Group - Pick every unit in ES_TempGroup and do (Actions)
                • Loop - Actions
                  • Set ES_Picked = (Picked unit)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (ES_Picked is alive) Equal to True
                      • (Unit-type of ES_Picked) Equal to ES_SackType[ES_TypeLooper]
                    • Then - Actions
                      • Unit Group - Add ES_Picked to ES_ValidGroup
                    • Else - Actions
                      • Set ES_Picked = No unit
          • Set ES_SackCount = (Number of units in ES_ValidGroup)
          • Unit Group - Remove all units from ES_ValidGroup
          • Custom script: call DestroyGroup(udg_ES_TempGroup)
          • -------- checks if the sacks are maxed --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ES_SackCount Less than ES_MaxSacksInRegion[ES_RegionLooper]
            • Then - Actions
              • Set ES_MissingSack = (ES_MaxSacksInRegion[ES_RegionLooper] - ES_SackCount)
              • For each (Integer ES_SackLooper) from 1 to ES_MissingSack, do (Actions)
                • Loop - Actions
                  • Set ES_TypeIndex = (Random integer number between 1 and ES_NumberOfSackType)
                  • Set ES_CreatePoint = (Random point in ES_SpawnRegions[ES_RegionLooper])
                  • Unit - Create 1 ES_SackType[ES_TypeIndex] for ES_SpiderPlayer at ES_CreatePoint facing (Random angle) degrees
                  • Unit Group - Add (Last created unit) to ES_SackGroup
                  • Custom script: call RemoveLocation(udg_ES_CreatePoint)
            • Else - Actions
      • Trigger - Turn off (This trigger)



  • Egg Sack Spawn
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is in ES_SackGroup) Equal to True
    • Actions
      • Set ES_DestroyedSack = (Triggering unit)
      • -------- spawn units --------
      • For each (Integer ES_TypeLooper) from 1 to ES_NumberOfSackType, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of ES_DestroyedSack) Equal to ES_SackType[ES_TypeLooper]
            • Then - Actions
              • Set ES_SpawnCount = (Random integer number between ES_SpawnMinimum[ES_TypeLooper] and ES_SpawnMaximum[ES_TypeLooper])
              • For each (Integer ES_SpawnLooper) from 1 to ES_SpawnCount, do (Actions)
                • Loop - Actions
                  • Set ES_DestroyPoint = (Position of ES_DestroyedSack)
                  • Unit - Create 1 ES_SpawnType[ES_TypeLooper] for ES_SpiderPlayer at ES_DestroyPoint facing (Random angle) degrees
                  • Custom script: call RemoveLocation(udg_ES_DestroyPoint)
            • Else - Actions
      • Unit Group - Remove ES_DestroyedSack from ES_SackGroup
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Egg Sack Create <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on Egg Sack Create <gen>
        • Else - Actions




Egg Sack System v1.1 - added a check before turning the trigger on
Egg Sack System v1.0 - initial release



Keywords:
empirean, weird, spawn, egg, sack, sacks, eggs, spawner, spider, arachnathid, spiderlings, spawnlings
Contents

Egg Sack System (Map)

Reviews
21:10, 11th Oct 2015 Bribe: This is quite specific and straightfoward. I recommend adding blank eggs to your default script in a future update so that it's random if spiders are in the sack to begin with. Code is clean and leakless.

Moderator

M

Moderator

21:10, 11th Oct 2015
Bribe: This is quite specific and straightfoward. I recommend adding blank eggs to your default script in a future update so that it's random if spiders are in the sack to begin with.

Code is clean and leakless.
 
Top