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

Help with a monster spawn trigger!

Status
Not open for further replies.
Level 3
Joined
May 17, 2014
Messages
29
So I need help making a trigger that will do the following:

  • Spawn creatures until a total of 8 are spawned at once.
    Will spawn a total of 24 creatures.
    Will stop spawning when a nearby building gets destroyed.
    Will spawn multiple units at the same time if they are destroyed at the same time. (killing a wave of 8 with a single AoE causing 8 more to instantly spawn.)
    Units that spawn have a loot table.

I think that's it. Please give me some help guys!
 
Level 3
Joined
May 17, 2014
Messages
29
well this is what I have so far, it will spawn a total of 8 units all at once but never respawn them.
Spawn units from buildings
Events
Time - Every 3.00 seconds of game time
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
MaxNumberofguys Less than 8
Then - Actions
Unit - Create 1 <your unit here> for <your player here> at (Center of (<your region here>)) facing Default building facing degrees
Set MaxNumberofguys = (MaxNumberofguys + 1)
Else - Actions
Do nothing

And then I have an activation trigger.
reset variable
Events
Unit - A unit leaves <your region here>
Conditions
(Triggering unit) Equal to <your unit here>
Actions
Set MaxNumberofguys = (MaxNumberofguys - 1)
 
Post your trigger within a trigger code [trigger.][/trigger.] (without punctuations).

That trigger will spawn 1 unit every 3 seconds until the integer variable reaches 8.

When a unit leaves X region the integer is lowered by 1, thus a new unit can be spawned (you know this obviously).

What happens when a unit enters the region?
 
Level 3
Joined
May 17, 2014
Messages
29
I have a trigger to begin the spawning but my problem is that my variable for
(Triggering unit) Equal to <Ghoul>
Is not recognizing my units.
 
Level 3
Joined
May 17, 2014
Messages
29
  • Events
  • Unit - A unit enters Undead Spawner Trigger <gen>
  • Conditions
  • ((Triggering unit) is A Hero) Equal to True
  • Actions
  • Trigger - Turn on Undead Hut 1 <gen>
The region in which the spawning is activated in this trigger is a different region from which the ghouls actually spawn
 
Level 3
Joined
May 17, 2014
Messages
29
Ok I will post all of my triggers that go to my spawning system in the order in which they should be triggering.


  • Events
    • Unit - A unit enters Undead Spawner Trigger <gen>
  • Condtions
    • ((Triggering unit) is A Hero) Equal to True
  • Actions
    • Trigger - Turn on Undead Hut 1 <gen>
  • Events
    • Time - Every 2.00 seconds of game time
  • Conditions
  • Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • MaxNumberOfGhouls Less than 8
      • (Ziggurat 0054 <gen> is dead) Equal to False
    • Then - Actions
      • Unit - Create 1 Ghoul for Player 7 (Green) at (Center of Undead Spawner 1 <gen>) facing Default building facing degrees
      • Set MaxNumberOfGhouls = (MaxNumberOfGhouls + 1)
    • Else - Actions
      • Do nothing
  • Events
    • Unit - A unit leaves Undead Spawner 1 <gen>
  • Conditions
    • (Triggering unit) Equal to Ghoul
  • Actions
    • Set MaxNumberOfGhouls = (MaxNumberOfGhouls - 1)


The problem is with my variable in the condition of the respawning trigger
  • Conditions
    • (Triggering unit) Equal to Ghoul
It does not seem to recognize the unit Ghoul.
 
Hm it seems like it should work.

Some notes though.
-I assume the second trigger is "Undead Hut 1"
-Are you sure it is a hero entering the first trigger?
-Are you sure it's the right Ziggurat unit?
-Are you sure the regions involved are the right regions?
-Do you set the MaxNumberOfGhouls variable elsewhere?

Also.
The second trigger can be optimized.
-Move the conditions in the if/then/else to the default conditions.
-Delete the if/then/else.
-Move the if/then/else actions to the default actions section.
-The "Do nothing" is never necessary. If you leave the Else empty it will do the exact same thing, do nothing. The Do nothing function should never be used.
-You should turn off the second trigger permanently when the Ziggurat dies.
 
Level 3
Joined
May 17, 2014
Messages
29
Thanks for the help man! And yes all of those factors that you listed are correct because the region has no problem spawning units but when a ghoul dies in the region it does not respawn. This is also preventing me from testing if the ziggurat is correct.
 
Level 3
Joined
May 17, 2014
Messages
29
To fix that you could make a simple trigger which checks if a dying unit is a Ghoul and the point of that unit is in the "Undead Spawner 1" region.
If yes, then lower your integer variable by one as if the unit had left the region.

Edit:
Oh. And the second trigger is leaking a point:
  • (Center of Undead Spawner 1 <gen>)

I'm honestly not sure how to get that condition.
 
Events-
A unit dies
Conditions-
Type of dying unit equal to Ghoul
Actions-
Set Temp_Point = position of dying unit
if-
Undead Spawner 1 <gen> contains Temp_Point
Then-
Set MaxNumberOfGhouls = (MaxNumberOfGhouls - 1)
Else-
Custom script: call RemoveLocation (udg_Temp_Point)

Temp_Point is a point variable and the custom script is to remove the point again (you should do something similar in you second trigger).
 
Level 3
Joined
May 17, 2014
Messages
29
No my variable Ghoul, its a unit variable for
  • Events
    • Unit - A unit leaves Undead Spawner 1 <gen>
  • Conditions
    • (Triggering unit) Equal to Ghoul
  • Actions
    • Set MaxNumberOfGhouls = (MaxNumberOfGhouls - 1)
 
Level 3
Joined
May 17, 2014
Messages
29
bah regardless, it still doesn't work and I feel it's because of the event. I don't think that the game recognizes death as a way for a unit to leave a region.
 
Status
Not open for further replies.
Top