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

Creep spawn during duel

Status
Not open for further replies.
Level 2
Joined
Apr 8, 2020
Messages
14
Hi, i've been recently remaking some old hero arena map. I've found myself a problem that i cannot find a solution:
-I have 4 areas on 2 side of the map that spawn 1 creep every 40 second, 1 at a time. so the second creeps in the same small area takes 160 seconds to spawn.
-but each creep has a rotation in levels (ex: dark troll lvl2 then shadow troll lvl5 then shadow troll again then troll warlord lvl 8 then it restarts.)
-The first creep spawned in any zone is randomly moved from a set location with all first class creeps and is the one that determine which type of creeps gonna occupy the zone.

My problem is during duel event i would like to stop those creep from spawning because sometimes duels can take a couple minutes than the map is filled with creeps. I cannot find any trigger combination that can solve my problem and i know it is possible! ty for those who can help me.
 
Last edited:
Level 14
Joined
Feb 7, 2020
Messages
387
You will want to probably use a unit group. Add units you create to a unit group variable and then run a periodic timer event to spawn new units--only spawning if that group is empty or if the number of units is under a certain threshold.

edit: forgot to add, make a trigger to detect units that die or check if they are dead within the periodic timer before allowing new units to spawn (then remove those dead units)
 
Level 2
Joined
Apr 8, 2020
Messages
14
sry I am not so much of a pro with variables but i tryied something like that it didnt work well.. Could you be a bit more specific? or i can post the map a guess
 
Level 14
Joined
Feb 7, 2020
Messages
387
There are a few ways you could do this. Since you are new, I kept it very simple. I drafted this up to give you a general idea of what you could experiment with:

  • init
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • -------- let's say you want to begin the event with a setup trigger; create 3 creeps somewhere --------
      • For each (Integer A) from 1 to 3, do (Actions)
        • Loop - Actions
          • -------- create your units for the event and add them to group --------
          • Set VariableSet temppoint = (Center of (Playable map area))
          • Unit - Create 1 Dark Troll Trapper for Neutral Hostile at temppoint facing Default building facing degrees
          • Unit Group - Add (Last created unit) to tempgroup
          • Custom script: call RemoveLocation(udg_temppoint)
      • -------- it's now more than 2 units in the group, <respawn> will run but it won't create new units until at least 2 die --------
      • Trigger - Turn on respawn <gen>
  • respawn
    • Events
      • Time - Every 40.00 seconds of game time
    • Conditions
    • Actions
      • -------- remove dead units from the group --------
      • Unit Group - Pick every unit in tempgroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is dead) Equal to True
            • Then - Actions
              • Unit Group - Remove (Picked unit) from tempgroup.
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in tempgroup) Less than 2
        • Then - Actions
          • -------- if less than 2 creeps exist, create new ones --------
          • Set VariableSet temppoint = (Center of (Playable map area))
          • Unit - Create 1 Dark Troll Trapper for Neutral Hostile at temppoint facing Default building facing degrees
          • Unit Group - Add (Last created unit) to tempgroup
          • Custom script: call RemoveLocation(udg_temppoint)
        • Else - Actions
This uses the variable 'temppgroup' that I made (of type 'Unit Group') - you could call it whatever you want. If you aren't familiar with the 'temppoint' variable, you should read about things that leak here: Memory Leaks.

And, technically, unit groups also leak. However, we're reusing this one in this use case. If the event came to an end, you'd want to run call DestroyGroup(udg_tempgroup) to prevent the leak, then generate a new one for the next/another in-game event (by adding units to a group again on initialization).

Another way you could do this is by checking if the number of alive creeps in a particular region are less than a certain amount (if the event is contained to a region). However, the example I provided gives you more direct control over each unit that exists on the map as a beginner W3 mapper (in case they exit the event bounds, etc.).
 
Level 2
Joined
Apr 8, 2020
Messages
14
actually the spawning system is already made and work great, but during duel heroes are paused and the only problem is units keeps spawning until duel end. I dont know how to post picture of trigger like you do so I'll show you the map. Can you tell me if I need to remake all those triggers so I can pause the ''spawn timer'' during duels or is there a simple solution i have not found? the trigger is in creepspawn file.
 

Attachments

  • arena nexus rmk.w3m
    1 MB · Views: 17
Level 4
Joined
Sep 2, 2016
Messages
48
Make a boolean variable DuelTime with starting value = false.
In trigger when you begin the duel set DuelTime = true.
When you end the duel set DuelTime = false.
In trigger when you spawn creeps put:
if DuelTime is equal to false do actions
 
Level 2
Joined
Apr 8, 2020
Messages
14
yeah Makos I tryied that and and it bring me to the same problem as when I used the trigger: Wait until (duel zone = no units), creeps stop spawning during duel but they all spawn right when duel end and their timer is fucked they spawn at the same time.

Thats probably because theres is a (Wait 160 seconds) between each spawn and the wait is already started. I guess I have to change it into a timer but I cant figure it out without making a shitload of triggers for each creep.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,570
You could remove any creeps that spawn during a duel.
  • Remove Spawned Creeps
    • Events
      • Unit - A unit enters (Entire map)
    • Conditions
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
      • DuelIsOn Equal to True
    • Actions
      • Unit - Remove (Triggering unit) from the game
Or if you wanted a simple Timer based system:
Variables
TrollCreeps = Unit-Type (Array)
TrollCounter = Integer
TrollTimer = Timer
  • Setup Trolls
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet TrollCreeps[1] = Dark Troll High Priest
      • Set VariableSet TrollCreeps[2] = Dark Troll High Priest
      • Set VariableSet TrollCreeps[3] = Dark Troll Warlord
      • Set VariableSet TrollCreeps[4] = Dark Troll
      • Countdown Timer - Start TrollTimer as a Repeating timer that will expire in 160.00 seconds
  • Troll Timer
    • Events
      • Time - TrollTimer expires
    • Conditions
    • Actions
      • -------- Increase Counter --------
      • Set VariableSet TrollCounter = (TrollCounter + 1)
      • -------- --------
      • -------- Create Creep --------
      • Unit - Create 1 TrollCreeps[TrollCounter] for Neutral Hostile at (Random point in Trollspawn) facing Default building facing degrees
      • -------- --------
      • -------- Reset Counter --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • TrollCounter Equal to 4
        • Then - Actions
          • Set VariableSet TrollCounter = 0
        • Else - Actions
And when your duel starts you Pause all of your Creep Timers:
  • Countdown Timer - Pause TrollTimer
And then Resume them after the duel is over:
  • Countdown Timer - Resume TrollTimer
 
Status
Not open for further replies.
Top