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

Creeps spawning in wrong region

Status
Not open for further replies.
Level 3
Joined
Mar 6, 2016
Messages
29
Hello.

So I've manage to create to creep spawning locations! Hurray!

Or so I thought.. I have two locations, where I want different creeps to spawn with an interval. I've managed that much.

The problem is, when the creeps has died once, and waiting to respawn, and I'll meanwhile go to kill the other creep camp, the first creeps respawn in the wrong creep camp. Any help?

I've attached two images.

Regards,

Malthe22
 

Attachments

  • 1.png
    1.png
    7.8 KB · Views: 73
  • 2.png
    2.png
    7.9 KB · Views: 70
Level 3
Joined
Mar 5, 2016
Messages
25
Because they re both same type unit what did you expect

you have to make diffirent event or cond= about them


if theyre short number go variable them if theyre not do their respawn position they way they died
 
Level 3
Joined
Jul 15, 2013
Messages
54
Use 'triggering unit' instead of 'dying unit' or try to use local var in Jass
Also u need to add creeps in different region to unit groups and check if a unit is in a unit group to seperate your triggers
 
Level 11
Joined
Oct 9, 2015
Messages
721
Maybe this is it, I don't know. However I think the wait function would create problems with refference, if another unit dies whithin 45 seconds from the first unit, then the first one would't be created at all, the second unit would be created instead.
Didn't tested the triggers for leaks.

  • Trigger 1
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Region1 = (Hostile Camp1)
      • Set Region2 = (Hostile Camp2)
      • Unit Group - Pick every unit in (Units in Region1) and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to UnitGroup1
      • Unit Group - Pick every unit in (Units in Region2) and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to UnitGroup2
  • Trigger 2
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
    • Actions
      • Wait 45.00 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is in UnitGroup1) Equal to True
        • Then - Actions
          • Unit - Create 1 (Unit-type of (Triggering unit)) for Neutral Hostile at (Center of Region1) facing (Facing of (Triggering unit)) degrees
          • Unit Group - Add (Last created unit) to UnitGroup1
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is in UnitGroup2) Equal to True
        • Then - Actions
          • Unit - Create 1 (Unit-type of (Triggering unit)) for Neutral Hostile at (Center of Region2) facing (Facing of (Triggering unit)) degrees
          • Unit Group - Add (Last created unit) to UnitGroup2
        • Else - Actions
 
Last edited:
Level 8
Joined
Jan 28, 2016
Messages
486
Out of curiosity, why are the groups being destroyed before the units are added, and how would they be added if the group is already destroyed? Also,
streetpunk said:
if another unit dies whithin 45 seconds from the first unit, then the first one would't be created at all, the second unit would be created instead.
...I thought this was true but somehow this is didn't happen to me. Did some quick tests and each of the three dummy units I killed "respawned" after 10 seconds... o_0
 
Level 3
Joined
Mar 6, 2016
Messages
29
Maybe this is it, I don't know. However I think the wait function would create problems with refference, if another unit dies whithin 45 seconds from the first unit, then the first one would't be created at all, the second unit would be created instead.
Didn't tested the triggers for leaks.

  • Trigger 1
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Region1 = (Hostile Camp1)
      • Set Region2 = (Hostile Camp2)
      • Unit Group - Pick every unit in (Units in Region1) and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to UnitGroup1
      • Unit Group - Pick every unit in (Units in Region2) and do (Actions)
        • Loop - Actions
          • Unit Group - Add (Picked unit) to UnitGroup2
  • Trigger 2
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
    • Actions
      • Wait 45.00 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is in UnitGroup1) Equal to True
        • Then - Actions
          • Unit - Create 1 (Unit-type of (Triggering unit)) for Neutral Hostile at (Center of Region1) facing (Facing of (Triggering unit)) degrees
          • Unit Group - Add (Last created unit) to UnitGroup1
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is in UnitGroup2) Equal to True
        • Then - Actions
          • Unit - Create 1 (Unit-type of (Triggering unit)) for Neutral Hostile at (Center of Region2) facing (Facing of (Triggering unit)) degrees
          • Unit Group - Add (Last created unit) to UnitGroup2
        • Else - Actions

Aight, this seems to be working.

Now lets say I want 5 more creep spawn locations. Do I simply just add 3 more unitgroups and just expand the trigger?
 
Level 3
Joined
Mar 6, 2016
Messages
29
New problem has occured! I've added a new unit group and a new region for another creep camp. But now the units from "Region1" spawn in "Region2" now. Can anyone check my code?

  • 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>
      • 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
  • Trigger2 Creep System
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Triggering unit)) Equal to Neutral Hostile
    • Actions
      • Wait 45.00 seconds
      • 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
          • 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 Group1) Equal to True
        • Then - Actions
          • 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
          • 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
Kind regards!

EDIT: Problem solved. Im a derp!
 
Last edited:
Status
Not open for further replies.
Top