• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Problem with creep camp timing

Status
Not open for further replies.
Level 3
Joined
Mar 6, 2016
Messages
29
[SOLVED - Cannot delete it]Problem with creep camp timing

Hello.

I've got a problem regarding having different timers for when the creeps in certain regions respawn. Here is my triggers.

  • Trigger1 Creep System
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Region1 = Hostile Camp 1 <gen>
      • Set Region2 = Hostile Camp 2 <gen>
      • Set Region3 = Hostile Camp 3 <gen>
      • Set Region4GrandChampion = Grand Champion <gen>
      • Unit Group - Pick every unit in (Units in Region1) and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to Group1
      • Unit Group - Pick every unit in (Units in Region2) and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to Group2
      • Unit Group - Pick every unit in (Units in Region3) and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to Group3
      • Unit Group - Pick every unit in (Units in Region4GrandChampion) and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to Group4GrandChampion
AND

  • Trigger2 Creep System
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is in Group1) Equal to True
        • Then - Actions
          • Wait 45.00 seconds
          • Unit - Create 1 (Unit-type of (Triggering unit)) for Neutral Hostile at (Center of Region1) facing Default building facing degrees
          • Unit Group - Add (Last created unit) to Group1
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is in Group2) Equal to True
        • Then - Actions
          • Wait 30.00 seconds
          • Unit - Create 1 (Unit-type of (Triggering unit)) for Neutral Hostile at (Center of Region2) facing Default building facing degrees
          • Unit Group - Add (Last created unit) to Group2
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is in Group3) Equal to True
        • Then - Actions
          • Wait 10.00 seconds
          • Unit - Create 1 (Unit-type of (Triggering unit)) for Neutral Hostile at (Center of Region3) facing Default building facing degrees
          • Unit Group - Add (Last created unit) to Group3
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is in Group4GrandChampion) Equal to True
        • Then - Actions
          • Wait 5.00 seconds
          • Unit - Create 1 (Unit-type of (Triggering unit)) for Neutral Hostile at (Center of Region4GrandChampion) facing Default building facing degrees
          • Unit Group - Add (Triggering unit) to Group4GrandChampion
        • Else - Actions
The problem is at least with the "GrandChampion" it only repsawns once. After that, nothing happens after the 5 seconds has passed.

Help a fella out
 
Level 6
Joined
Mar 17, 2012
Messages
105
This is a pretty rough trigger. I'll try to point out most of the problems I see outright.

First, there is a bit of leaking here. A lot of things, like Unit Groups, should be destroyed using the Custom Script "call DestroyGroup (udg_<NameofGroup>)". You can view more about that here: http://world-editor-tutorials.thehelper.net/cat_usersubmit.php?view=27219

Second, calling "Wait" commands within a trigger can be very prone to glitches. In your trigger, every time a Neutral Hostile unit dies, it is calling a lot of various Wait commands. There are better approaches. One, you could use a "Wait in game time" command, or a Timer. I'd suggest taking a look at this thread to see a simpler trigger that uses an In-game wait and no If/Then/Else commands. http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/creep-respawn-gui-65987/

Third, I recommend using Array variables when you're declaring multiple variables of similar type. Your "Regions" could be a single variable with an array size of 4, to keep your variable count down, and also to make excellent use of For Loops.
 
Level 3
Joined
Mar 6, 2016
Messages
29
This is a pretty rough trigger. I'll try to point out most of the problems I see outright.

First, there is a bit of leaking here. A lot of things, like Unit Groups, should be destroyed using the Custom Script "call DestroyGroup (udg_<NameofGroup>)". You can view more about that here: http://world-editor-tutorials.thehelper.net/cat_usersubmit.php?view=27219

Second, calling "Wait" commands within a trigger can be very prone to glitches. In your trigger, every time a Neutral Hostile unit dies, it is calling a lot of various Wait commands. There are better approaches. One, you could use a "Wait in game time" command, or a Timer. I'd suggest taking a look at this thread to see a simpler trigger that uses an In-game wait and no If/Then/Else commands. http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/creep-respawn-gui-65987/

Third, I recommend using Array variables when you're declaring multiple variables of similar type. Your "Regions" could be a single variable with an array size of 4, to keep your variable count down, and also to make excellent use of For Loops.


Well it does work as intended, for now at least. But thanks for the reply, I will for sure take a closer look.
 
Level 17
Joined
Mar 21, 2011
Messages
1,611
Third, I recommend using Array variables when you're declaring multiple variables of similar type. Your "Regions" could be a single variable with an array size of 4, to keep your variable count down, and also to make excellent use of For Loops.
i wouldn't say that. of course, you will have less variables in your variable editor and so a better overview, but it would be better to actually not use arrays if not needed. The size of an array variable compared to a normal variable is 8192:1, remember that.

I've got a problem regarding having different timers for when the creeps in certain regions respawn. Here is my triggers.
your waits mess up the trigger, you could manage this with a periodic timer event or a timer.
 
Status
Not open for further replies.
Top