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

[Trigger Request] Spawning System

Status
Not open for further replies.
Level 12
Joined
Apr 26, 2008
Messages
830
Hey guys,
I have been trying out various spawning systems, but none of them got what I want, I need a spawning system that has to be a bit different from others since I got some "strange" triggers in my map wich permits me to do a lot of amazing things with heroes. So I would like if somebody could do this:

Spawning System;

Variables should look like this:

Spawn_Unit: Paladin
Spawn_Limit: 4 (refers to how many units we want to create)
Spawn_Region: X (Spawning region)
Spawn_DelayTime: 2 seconds. (if one of those four units dies it will be recreated in 2 seconds.)

And that was just an example of how I want the system to be. So I dont wan't to have a system that checks if the unit is in the spawn_region because if it is dragged away it will be recreated so i rather want one that checks if those spawned units are alive and when they die, they will be replaced by another same unit.
IMPORTANT:

ALL SPAWNS ARE HEROES!
THERE WILL BE A LOT OF TYPES!
THERE WILL BE LIKE 64 HEROES TYPES SPAWNING EACH INSTANCE!

So be sure to make it leakless and GUI, please.


------------------------------------

Will give credits and +rep.
 
Last edited:
The trigger:
209577-albums5234-picture57288.jpg

The variables:
209577-albums5234-picture57289.jpg


I think it should work. :)
 
Level 19
Joined
Apr 10, 2010
Messages
2,789
Try this:

  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Spawn_Delay = 2.00
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) owned by Player 1 (Red)) and do (Actions)
        • Loop - Actions
          • Set Spawn_CV = (Spawn_CV + 1)
          • Unit - Set the custom value of (Picked unit) to Spawn_CV
  • Dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Triggering player) Equal to Player 1 (Red)
      • (Custom value of (Triggering unit)) Greater than 0
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Set CV_Pass = (Custom value of (Triggering unit))
      • Set Spawn_Unit[CV_Pass] = (Triggering unit)
      • Countdown Timer - Start Spawn_Timer[CV_Pass] as a One-shot timer that will expire in Spawn_Delay seconds
      • Set Spawn_Timer[CV_Pass] = (Last started timer)
      • Trigger - Add to Timer <gen> the event (Time - Spawn_Timer[CV_Pass] expires)
  • Timer
    • Events
    • Conditions
    • Actions
      • Set Spawn_Loc = (Center of Spawn Region <gen>)
      • Hero - Instantly revive Spawn_Unit[CV_Pass] at Spawn_Loc, Show revival graphics
      • Custom script: call RemoveLocation(udg_Spawn_Loc)
 
Level 9
Joined
Apr 23, 2011
Messages
460
Try this:

  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Spawn_Delay = 2.00
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) owned by Player 1 (Red)) and do (Actions)
        • Loop - Actions
          • Set Spawn_CV = (Spawn_CV + 1)
          • Unit - Set the custom value of (Picked unit) to Spawn_CV
  • Dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Triggering player) Equal to Player 1 (Red)
      • (Custom value of (Triggering unit)) Greater than 0
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • Set CV_Pass = (Custom value of (Triggering unit))
      • Set Spawn_Unit[CV_Pass] = (Triggering unit)
      • Countdown Timer - Start Spawn_Timer[CV_Pass] as a One-shot timer that will expire in Spawn_Delay seconds
      • Set Spawn_Timer[CV_Pass] = (Last started timer)
      • Trigger - Add to Timer <gen> the event (Time - Spawn_Timer[CV_Pass] expires)
  • Timer
    • Events
    • Conditions
    • Actions
      • Set Spawn_Loc = (Center of Spawn Region <gen>)
      • Hero - Instantly revive Spawn_Unit[CV_Pass] at Spawn_Loc, Show revival graphics
      • Custom script: call RemoveLocation(udg_Spawn_Loc)

This is the proper trigger system that I'd recommend using, very nice design, I'd look it over better but its 12 at night and uk what. I'm tired xD maybe later. Good work though D_J.
 
Level 12
Joined
Apr 26, 2008
Messages
830
Alright, but the problem lies in creating the units, as i need them to level up each level until the specified level, for example i want to create a level 40 unit, i have to trigger the system to level up from 1-40, because once the unit reachesa a certain level it gets an abillity if i avoid it and instantaniously get it to level 40 it won't learn the abilities.

I have been using this sytem but somehow at some point when creating too many units, they become invurnerable somehow that's my problem.

  • Setup 1
    • Ereignisse
      • Zeit - Elapsed game time is 0.20 seconds
    • Bedingungen
    • Aktionen
      • -------- - --------
      • Set SPAWNUnitType[1] = Basic Oddish
      • Set SPAWNMaxUnits[1] = 3
      • Set SPAWNLocation[1] = 1 <gen>
      • Set LevelMAX[1] = 8
      • Set LevelMIN[1] = 2
      • -------- - --------
      • Set SPAWNUnitType[2] = Basic Caterpie
      • Set SPAWNMaxUnits[2] = 4
      • Set SPAWNLocation[2] = 1 <gen>
      • Set LevelMAX[2] = 3
      • Set LevelMIN[2] = 2
      • -------- - --------
      • Set SPAWNUnitType[3] = Basic Pidgey
      • Set SPAWNMaxUnits[3] = 2
      • Set SPAWNLocation[3] = 1 <gen>
      • Set LevelMAX[3] = 10
      • Set LevelMIN[3] = 5
      • -------- - --------
      • Set SPAWNUnitType[4] = Basic Rattata
      • Set SPAWNMaxUnits[4] = 2
      • Set SPAWNLocation[4] = 2 <gen>
      • Set LevelMAX[4] = 8
      • Set LevelMIN[4] = 3
      • -------- - --------
      • Set SPAWNUnitType[5] = Basic Rattata
      • Set SPAWNMaxUnits[5] = 3
      • Set SPAWNLocation[5] = 4 <gen>
      • Set LevelMAX[5] = 8
      • Set LevelMIN[5] = 3
      • -------- - --------
      • Set SPAWNUnitType[6] = Basic Bellsprout
      • Set SPAWNMaxUnits[6] = 2
      • Set SPAWNLocation[6] = 4 <gen>
      • Set LevelMAX[6] = 10
      • Set LevelMIN[6] = 4
      • -------- - --------
      • Set SPAWNUnitType[7] = Basic Pikachu
      • Set SPAWNMaxUnits[7] = 1
      • Set SPAWNLocation[7] = 3 <gen>
      • Set LevelMAX[7] = 8
      • Set LevelMIN[7] = 3
      • -------- - --------
      • Set SPAWNUnitType[8] = Basic Spearow
      • Set SPAWNMaxUnits[8] = 2
      • Set SPAWNLocation[8] = 3 <gen>
      • Set LevelMAX[8] = 10
      • Set LevelMIN[8] = 5
      • -------- - --------
      • Set SPAWNUnitType[9] = Basic Weedle
      • Set SPAWNMaxUnits[9] = 4
      • Set SPAWNLocation[9] = 3 <gen>
      • Set LevelMAX[9] = 4
      • Set LevelMIN[9] = 1
      • -------- Rocky Area --------
      • Set SPAWNUnitType[10] = Basic Sandshrew
      • Set SPAWNMaxUnits[10] = 4
      • Set SPAWNLocation[10] = 5 <gen>
      • Set LevelMAX[10] = 13
      • Set LevelMIN[10] = 6
      • -------- - --------
      • Set SPAWNUnitType[11] = Basic Diglett
      • Set SPAWNMaxUnits[11] = 2
      • Set SPAWNLocation[11] = 5 <gen>
      • Set LevelMAX[11] = 15
      • Set LevelMIN[11] = 7
      • -------- - --------
      • Set SPAWNUnitType[12] = Basic Geodude
      • Set SPAWNMaxUnits[12] = 4
      • Set SPAWNLocation[12] = 5 <gen>
      • Set LevelMAX[12] = 14
      • Set LevelMIN[12] = 7
      • -------- - --------
      • Set SPAWNUnitType[13] = Basic Sandshrew
      • Set SPAWNMaxUnits[13] = 3
      • Set SPAWNLocation[13] = 6 <gen>
      • Set LevelMAX[13] = 13
      • Set LevelMIN[13] = 6
      • -------- - --------
      • Set SPAWNUnitType[14] = Basic Machop
      • Set SPAWNMaxUnits[14] = 1
      • Set SPAWNLocation[14] = 6 <gen>
      • Set LevelMAX[14] = 15
      • Set LevelMIN[14] = 7
      • -------- Mountain Area --------
      • Set SPAWNUnitType[15] = Basic Geodude
      • Set SPAWNMaxUnits[15] = 3
      • Set SPAWNLocation[15] = 9 <gen>
      • Set LevelMAX[15] = 22
      • Set LevelMIN[15] = 15
      • -------- - --------
      • Set SPAWNUnitType[16] = Stage 1 Graveler
      • Set SPAWNMaxUnits[16] = 2
      • Set SPAWNLocation[16] = 9 <gen>
      • Set LevelMAX[16] = 27
      • Set LevelMIN[16] = 25
      • -------- - --------
      • Set SPAWNUnitType[17] = Stage 1 Sandslash
      • Set SPAWNMaxUnits[17] = 2
      • Set SPAWNLocation[17] = 9 <gen>
      • Set LevelMAX[17] = 24
      • Set LevelMIN[17] = 22
      • -------- - --------
      • Set SPAWNUnitType[18] = Basic Diglett
      • Set SPAWNMaxUnits[18] = 3
      • Set SPAWNLocation[18] = 9 <gen>
      • Set LevelMAX[18] = 20
      • Set LevelMIN[18] = 14
      • -------- - --------
      • Set SPAWNUnitType[19] = Basic Machop
      • Set SPAWNMaxUnits[19] = 3
      • Set SPAWNLocation[19] = 10 <gen>
      • Set LevelMAX[19] = 22
      • Set LevelMIN[19] = 15
      • -------- - --------
      • Set SPAWNUnitType[20] = Basic Spearow
      • Set SPAWNMaxUnits[20] = 2
      • Set SPAWNLocation[20] = 10 <gen>
      • Set LevelMAX[20] = 17
      • Set LevelMIN[20] = 12
      • -------- - --------
      • Set SPAWNUnitType[21] = Basic Charmander
      • Set SPAWNMaxUnits[21] = 3
      • Set SPAWNLocation[21] = 11 <gen>
      • Set LevelMAX[21] = 13
      • Set LevelMIN[21] = 7
      • -------- - --------
      • Set SPAWNUnitType[22] = Basic Eevee
      • Set SPAWNMaxUnits[22] = 3
      • Set SPAWNLocation[22] = 11 <gen>
      • Set LevelMAX[22] = 15
      • Set LevelMIN[22] = 8
      • -------- - --------
      • Set SPAWNUnitType[23] = Stage 1 Raticate
      • Set SPAWNMaxUnits[23] = 2
      • Set SPAWNLocation[23] = 11 <gen>
      • Set LevelMAX[23] = 22
      • Set LevelMIN[23] = 20
      • -------- - --------
      • Set SPAWNUnitType[24] = Stage 1 Dugtrio
      • Set SPAWNMaxUnits[24] = 1
      • Set SPAWNLocation[24] = 11 <gen>
      • Set LevelMAX[24] = 27
      • Set LevelMIN[24] = 26
      • -------- Onix Area --------
      • Set SPAWNUnitType[25] = Basis Onix
      • Set SPAWNMaxUnits[25] = 1
      • Set SPAWNLocation[25] = 13 <gen>
      • Set LevelMAX[25] = 21
      • Set LevelMIN[25] = 14
      • -------- - --------
      • Set SPAWNUnitType[26] = Basis Onix
      • Set SPAWNMaxUnits[26] = 1
      • Set SPAWNLocation[26] = 14 <gen>
      • Set LevelMAX[26] = 22
      • Set LevelMIN[26] = 14
      • -------- Next Area --------
      • Set SPAWNUnitType[27] = Basic Geodude
      • Set SPAWNMaxUnits[27] = 3
      • Set SPAWNLocation[27] = 12 <gen>
      • Set LevelMAX[27] = 18
      • Set LevelMIN[27] = 13
      • -------- - --------
      • Set SPAWNUnitType[28] = Basic Rattata
      • Set SPAWNMaxUnits[28] = 2
      • Set SPAWNLocation[28] = 12 <gen>
      • Set LevelMAX[28] = 17
      • Set LevelMIN[28] = 13
      • -------- - --------
      • Set SPAWNUnitType[29] = Basic Abra
      • Set SPAWNMaxUnits[29] = 2
      • Set SPAWNLocation[29] = G1 <gen>
      • Set LevelMAX[29] = 14
      • Set LevelMIN[29] = 11
      • -------- - --------
      • Set SPAWNUnitType[30] = Basic Magnemite
      • Set SPAWNMaxUnits[30] = 3
      • Set SPAWNLocation[30] = G1 <gen>
      • Set LevelMAX[30] = 19
      • Set LevelMIN[30] = 14
      • -------- - --------
      • Set SPAWNUnitType[31] = Stage 1 Kakuna
      • Set SPAWNMaxUnits[31] = 2
      • Set SPAWNLocation[31] = G1 <gen>
      • Set LevelMAX[31] = 7
      • Set LevelMIN[31] = 6
      • -------- - --------
      • -------- Next --------
  • Core System
    • Ereignisse
      • Zeit - Every 1.00 seconds of game time
    • Bedingungen
    • Aktionen
      • For each (Integer spawnINT[1]) from 1 to 48, do (Actions)
        • Schleifen - Aktionen
          • Set SPAWNRegion = (Units owned by Spieler 12 (Braun) matching ((((Matching unit) is alive) Gleich True) and ((Unit-type of (Matching unit)) Gleich SPAWNUnitType[spawnINT[1]])))
          • Set SPAWNRegion2 = (Units owned by Neutral feindlich matching ((((Matching unit) is alive) Gleich True) and ((Unit-type of (Matching unit)) Gleich SPAWNUnitType[spawnINT[1]])))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • 'IF'-Bedingungen
              • (Number of units in SPAWNRegion) Kleiner als SPAWNMaxUnits[spawnINT[1]]
              • (Number of units in SPAWNRegion2) Kleiner als SPAWNMaxUnits[spawnINT[1]]
            • 'THEN'-Aktionen
              • Einheit - Create 1 SPAWNUnitType[spawnINT[1]] for Spieler 12 (Braun) at (Random point in SPAWNLocation[spawnINT[1]]) facing Vorgabe für Gebäude-Ausrichtung degrees
              • Einheit - Make (Last created unit) Verwundbar
              • Set LevelEND[spawnINT[1]] = (Random integer number between LevelMIN[spawnINT[1]] and LevelMAX[spawnINT[1]])
              • For each (Integer spawnINT[2]) from 1 to LevelEND[spawnINT[1]], do (Actions)
                • Schleifen - Aktionen
                  • Held - Set (Last created unit) Hero-level to ((Hero level of (Last created unit)) + 1), Verbergen level-up graphics
            • 'ELSE'-Aktionen
          • Custom script: call DestroyGroup(udg_SPAWNRegion)
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
I've created a spawn system for you, take a look.
Don't worry about TempLoc leaks, actually, it does not leak because we're using the same location over and over again, there's no need to destroy them.
 

Attachments

  • Spawning System.w3x
    15.7 KB · Views: 90
Level 33
Joined
Mar 27, 2008
Messages
8,035
I have run a loop of 100 checks of instances and it does not lag at all.
But perhaps the creation of each unit in the map at initial moment will lag as you create many units at once, deal with it.

But the checking is not lag as I can tell you.
I hope the respawn does not lag too.
 
Status
Not open for further replies.
Top