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

Creep Spawn Houses

Status
Not open for further replies.
Level 1
Joined
Feb 14, 2010
Messages
3
Hello, super new to the system but loving (most) every moment of it.
Anyway, what I want to do is make a trigger so that when player units get close to a creep hut it will begin to spawn creep units every few seconds. But when those player units leave said area the hut stops spawning creeps. Kinda like Gaunlet Legends if that helps. There are a few problems I've hit.

1. Creep units that are spawned activate the triggers, so the spawning never stops.

2. If the player were to send 1 unit, then the hut will spawn 1 creep wait 5 seconds and then spawn another. That is what I want. But if 4 player units come over then 4 creeps spawn, wait 5 seconds, and another 4 creeps spawn. I want it to only spawn the one creep no matter how many player units are around.

I haven't gotten this far, but I also want the hut to stop spawning when the player's units leave or else when they come back there will be hundreds of creeps.

If this is answered somewhere else I am sorry. Thank you in advance!
 
Level 1
Joined
Feb 14, 2010
Messages
3
Ok, well I got problem 2 fixed. I'm not sure if it is the best way to do it. But what I did was turn the trigger off for the first action. And then the last action was to turn the trigger back on. That prevented multiple spawns at the same time.
 
Level 8
Joined
Jan 8, 2010
Messages
493
you can try these triggers for the creep spawn.

this is the trigger when a unit enters that region within the creep hut. i used the Neutral Hostile because that's the player for the spawned unit. (check spawn creep trigger). if you used a player, changed it to that player spawning the creeps instead.
  • Enter
    • Events
      • Unit - A unit enters CreepSpawn <gen>
    • Conditions
      • (Owner of (Triggering unit)) Not equal to Neutral Hostile
    • Actions
      • Trigger - Turn on Spawn Creep <gen>
this is the trigger for the spawning creeps. this way, it will only summon 1 creep every 5 seconds. change the time and creep if you want. btw, it is Initially Off (unchecked) at the start.
  • Spawn Creep
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Set LocSpawn = (Center of CreepSpawn <gen>)
      • Unit - Create 1 Creep for Neutral Hostile at LocSpawn facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_LocSpawn)
this is what i was trying to do with the exit (spawn stop) trigger. what it does is when a unit exits that region near the creep hut, it will check if there are any player units left near the hut. if there are no other player units, the spawning will stop. i haven't checked this yet, but tell me if it is not working properly. add more Unit Group - Pick every unit ... if there more players in your map. if it is a single player map, this will be easier.
  • Exit
    • Events
      • Unit - A unit leaves CreepSpawn <gen>
    • Conditions
      • (Owner of (Triggering unit)) Not equal to Neutral Hostile
    • Actions
      • Custom script: set bj_wantDestroyGroup=true
      • Unit Group - Pick every unit in (Units in CreepSpawn <gen> owned by Player 1 (Red)) and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to PlayerUnits
      • Custom script: set bj_wantDestroyGroup=true
      • Unit Group - Pick every unit in (Units in CreepSpawn <gen> owned by Player 2 (Blue)) and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to PlayerUnits
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (All units of PlayerUnits are in CreepSpawn <gen>) Not equal to True
        • Then - Actions
          • Trigger - Turn off Spawn Creep <gen>
        • Else - Actions
      • Unit Group - Remove all units from PlayerUnits
 
Level 13
Joined
Sep 14, 2008
Messages
1,407
Thats a really difficult solutions :/

I suggest using something like this:

Event: Every 5 seconds
Conditions:
Actions:

If(Number of units in range of 600 of "yourHut" matching conditions:
""owner of matching unit not equal to "HutController""
AND
"matching unit is alive = true"
> 0)
Then:Spawn 1 creep

That should do all the stuff in one trigger
 
Level 10
Joined
Sep 29, 2006
Messages
447
I would do this. When the map starts, add all of the Creep Spawning Huts into one unit group, I'll call it "hutGroup" Then you want to do something like this:

Every 5 seconds picks every unit in hutGroup

check if the enemies are within range

if they are:
spawn a unit

if they're not:
do nothing



And when a hut dies, remove it from hutGroup
 
Level 8
Joined
Jan 8, 2010
Messages
493
yes you can do those things, actually making you can change DarkAngelAzazel's trigger into:

  • Untitled Trigger 001
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units of type YourCreepHut) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in (Units within 600.00 of (Position of (Picked unit)) matching (((Owner of (Matching unit)) Not equal to Neutral Hostile) and (((Matching unit) is alive) Equal to True)))) Greater than 1
            • Then - Actions
              • Unit - Create 1 Creep for Neutral Hostile at (Position of (Picked unit)) facing Default building facing degrees
            • Else - Actions
though it wouldn't always mean that when your unit enters the region, a unit will spawn exactly after 5 seconds. (hope you understood what i mean). and for some reasons, i just always avoid the idea of having too many things to do for a periodic interval (in that case it will check every creep hut you specified in the map, or more if you have more types of them creep huts). i'm just afraid it will sometimes cause lag or crash. but it will do. :p
 
Level 3
Joined
Feb 23, 2010
Messages
73
lmao I had the same idea not too long ago, was planning on pursuing it. Are you still developing this map / finished with it? If not I would like to hear what kinds of ideas you had for it I am very interested in making a map similar to gauntlet legends.

If you are working on it, I'd love to help out.
 
Level 3
Joined
Feb 23, 2010
Messages
73
I would do this. When the map starts, add all of the Creep Spawning Huts into one unit group, I'll call it "hutGroup" Then you want to do something like this:

Every 5 seconds picks every unit in hutGroup

check if the enemies are within range

if they are:
spawn a unit

if they're not:
do nothing



And when a hut dies, remove it from hutGroup

This is the best system on this thread, with one small addition.
To make it so the creeps will spawn 5 seconds from when you are in range,
do this:
  • 1st_Trigger
  • Events
    • Periodic Event - Every 0.20 seconds of the game
  • Conditions
  • Actions
    • Set Hut_UnitGroup = Units of type (Hut)
    • Set OtherSpawn_UnitGroup = Units of type (OtherCreep)
    • Comment - -----and so on for all the different spawn types-----
    • Pick every unit in (units in (Hut_UnitGroup)) and do actions
      • Loop Actions
        • Set (HutUnit) = picked unit
        • Trigger - run 2nd_Trigger (checking conditions)
  • Trigger - Turn off this trigger
  • 2nd_Trigger
  • Events
  • Conditions
    • Region centered at (position of (HutUnit)) with size (xxx.xx, xxx.xx) contains (YourHero) Equal to True
  • Actions
    • Unit - Create X Hutmonster for BadGuy at (position of (HutUnit)) facing default building degrees
    • Wait 5.00 seconds
    • Trigger - Turn on 1st_Trigger
that should be a more accurate way so 5 seconds after you are in range of the spawn (give or take .20 seconds), you will see a spawn. You can simply duplicate the functions for other spawn types.
 
Level 1
Joined
Feb 14, 2010
Messages
3
lmao I had the same idea not too long ago, was planning on pursuing it. Are you still developing this map / finished with it? If not I would like to hear what kinds of ideas you had for it I am very interested in making a map similar to gauntlet legends.

If you are working on it, I'd love to help out.

haha, that is weird. I didn't even think that gauntlet legends was even that popular of a game. the map i'm trying to make isn't too much like gauntlet legends. I wanted to make one with a big boss battle for an ending, but I didn't want it to just be a rush to the center of the map to fight the boss, so i thought adding this kind of thing would make it more of an adventure, plus an easy way to make heros level up.

Thank you all for your suggestions these are working out so much better than what I had done. Which was have a trigger for every individual house, told you I was a beginner/noob!
 
Status
Not open for further replies.
Top