• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[General] Spawn unit goes into random region.

Status
Not open for further replies.
Level 8
Joined
Feb 11, 2016
Messages
238
Greetings! I have two little, easy-to-solve, problem and I'm asking asking for help. I'm pretty sure that pure title explained it. I make trigger that unit spawn in region "1", and then second trigger when that same unit enters in that region attack-move to another but unit spawn and don't going anywhere. Also, I don't know variables to be able to make that specific unit goes into random region, not just one so please if you explaining variables, go step-by-step. Thank you.
 
Level 7
Joined
Apr 17, 2017
Messages
316
To create a variable go to your trigger editor, there is a little green x shape thingie named "variable editor". Then create a unit variable and name it whatever you want. Then go to first trigger after you create your create unit action, set yourvariable = last created unit.Then in your second trigger order your variable named unit to attack move
 
Level 6
Joined
Jun 4, 2017
Messages
172
I don't know how to do this, that is understandable for someone who don't know variables.
I suggest you to read some tutorial about variables, like this one.
What Aeryn is saying is that you need 2 variables, one is a region array variable, and the other is an integer non-array variable(even though you don't really need an integer variable to do this),also, you'll need a point variable to remove the location leak.
Then you should create a trigger like this one:
  • Actions
    • Set Integer = (Random integer number between 1 and 10)
    • Set Point = (Random point in Region[Integer])
    • Unit - Order Your_Unit to Attack-move Point
    • Custom script: call RemoveLocation(udg_Point)
Or you can do it without the integer variable:
  • Actions
    • Set Point = (Random point in Region[(Random integer number between 1 and 10)])
    • Unit - Order Your_Unit to Attack-move Point
    • Custom script: call RemoveLocation(udg_Point)
You'll naturally need to set the region variables in the map initialization:
  • Actions
    • Set Region[1] = Region 000 <gen>
    • Set Region[2] = Region 001 <gen>
    • Set Region[...] = Region ... <gen>
 
Level 8
Joined
Feb 11, 2016
Messages
238
This is so terrible hard! Something is wrong!!!!!!!!!!!!!!!!!! Whatever I do I can't make simple unit spawn and move to certain region!!!!!!!!!!!!!!! I know how to do this, I did it before but now is impossible! I can't work like that did Blizard again change it?!
 
Level 8
Joined
Feb 11, 2016
Messages
238
United197.png
 
Level 6
Joined
Jun 4, 2017
Messages
172
Ok, there are a lot of problems with this trigger:
-You need to consider that there is a possibility that no unit will spawn if all random integers are 0, if that happens the last created unit will be a unit that has already spawned(if you already created a unit via trigger) and he will randomly go to the center of that region even if he's not part of the next spawning wave;
-That trigger can create up to 14 units but only the last created unit will be issued to attack move to the location, so the other 13 will just stand there doing nothing;
-Your trigger leaks 4 locations;
-I'm not sure if that event is going to do what you think it's going to do. I think that after it takes a random number(for example 1 sec) it will just keep looping at the chosen number(so in the case of 0 seconds, this trigger is probably going to make your game crash).
 
Level 8
Joined
Feb 11, 2016
Messages
238
Oh, yeah, sure, I forgot about possibility that no units will spawn, thank you, about what you said that only the one unit do action, and that I need 4 regions, that's not true I already did it few times in my previous maps and I needed only two regions and all units will do the action. Now I tried this but same thing, they just spawn and do nothing.
United198.png


Edit: At least you got a reputation point for trying.
 
Last edited:
Level 6
Joined
Jun 4, 2017
Messages
172
Oh, yeah, sure, I forgot about possibility that no units will spawn, thank you, about what you said that only the one unit do action, and that I need 4 regions, that's not true I already did it few times in my previous maps and I needed only two regions and all units will do the action. Now I tried this but same thing, they just spawn and do nothing.View attachment 311532

Edit: At least you got a reputation point for trying.
I don't know what you are talking about, I never said that you need 4 regions.
Other than that I tried recreating your trigger and it works completely fine(other than the fact that you should avoid using neutral hostile because they have an AI that makes them come back to their spawn point after some time). I think that your problem may be caused by the fact that the spawning region(Zabe stvaranje <gen>) is too small(if it's too small the units will spawn at its center point but when you pick every unit in that region there isn't actually any unit in that small place)
So the solutions are 2:
1)make the spawning region bigger;
2)try this trigger:
  • Trigger
    • Events
      • Time - Every 12.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to (Random integer number between 1 and 7), do (Actions)
        • Loop - Actions
          • Set Point = (Center of Zabe stvaranje <gen>)
          • Unit - Create 1 Murloc A for Player (Red) at Point facing (Random angle) degrees
          • Custom script: call RemoveLocation(udg_Point)
          • Set Point = (Center of Zabe mesto <gen>)
          • Unit - Order (Last created unit) to Attack-Move To Point
          • Custom script: call RemoveLocation(udg_Point)
      • For each (Integer A) from 1 to (Random integer number between 0 and 4), do (Actions)
        • Loop - Actions
          • Set Point = (Center of Zabe stvaranje <gen>)
          • Unit - Create 1 Murloc B for Player (Red) at Point facing (Random angle) degrees
          • Custom script: call RemoveLocation(udg_Point)
          • Set Point = (Center of Zabe mesto <gen>)
          • Unit - Order (Last created unit) to Attack-Move Point
          • Custom script: call RemoveLocation(udg_Point)
      • For each (Integer A) from 1 to (Random integer number between 0 and 2), do (Actions)
        • Loop - Actions
          • Set Point = (Center of Zabe stvaranje <gen>)
          • Unit - Create 1 Murloc C for Player (Red) at Point facing (Random angle) degrees
          • Custom script: call RemoveLocation(udg_Point)
          • Set Point = (Center of Zabe mesto <gen>)
          • Unit - Order (Last created unit) to Attack-Move Point
          • Custom script: call RemoveLocation(udg_Point)
 
Status
Not open for further replies.
Top