1. Join Texturing Contest #30 now in a legendary battle of mythological creatures!
    Dismiss Notice
  2. The Aftermath has been revealed for the 19th Terraining Contest! Be sure to check out the Results and see what came out of it.
    Dismiss Notice
  3. Melee Mapping Contest #3 - Results are out! Congratulate the winners and check plenty of new 4v4 melee maps designed for this competition!
    Dismiss Notice
  4. The winners of our cinematic soundtrack competition have been decided! Step by the Music Contest #11 - Results to check the entries and congratulate the winners!
    Dismiss Notice
  5. Check out the Staff job openings thread.
    Dismiss Notice

[General] Spawn unit goes into random region.

Discussion in 'World Editor Help Zone' started by InSaNe_97, Dec 12, 2018.

  1. InSaNe_97

    InSaNe_97

    Joined:
    Feb 11, 2016
    Messages:
    132
    Resources:
    0
    Resources:
    0
    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.
     
  2. Aeryn

    Aeryn

    Joined:
    Apr 17, 2017
    Messages:
    241
    Resources:
    0
    Resources:
    0
    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
     
  3. InSaNe_97

    InSaNe_97

    Joined:
    Feb 11, 2016
    Messages:
    132
    Resources:
    0
    Resources:
    0
    ...Thank you. That doesn't worked even for attack-move to single region, and I said I need attack-move to random region :wthumbsup:.
     
  4. Aeryn

    Aeryn

    Joined:
    Apr 17, 2017
    Messages:
    241
    Resources:
    0
    Resources:
    0
    Set your regions with array, for example region(1) region(2) then set an integer variable to random number between your region numbers (min, max) then order unit to move attack region(integer)
     
  5. InSaNe_97

    InSaNe_97

    Joined:
    Feb 11, 2016
    Messages:
    132
    Resources:
    0
    Resources:
    0
    I don't know how to do this, that is understandable for someone who don't know variables.
     
  6. RG00

    RG00

    Joined:
    Jun 4, 2017
    Messages:
    172
    Resources:
    1
    Maps:
    1
    Resources:
    1
    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>
     
  7. InSaNe_97

    InSaNe_97

    Joined:
    Feb 11, 2016
    Messages:
    132
    Resources:
    0
    Resources:
    0
    Okay, looks like I finally need to learn variables...
     
  8. InSaNe_97

    InSaNe_97

    Joined:
    Feb 11, 2016
    Messages:
    132
    Resources:
    0
    Resources:
    0
    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?!
     
  9. RG00

    RG00

    Joined:
    Jun 4, 2017
    Messages:
    172
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Can you post the triggers?
     
  10. InSaNe_97

    InSaNe_97

    Joined:
    Feb 11, 2016
    Messages:
    132
    Resources:
    0
    Resources:
    0
    I can, but will be useless since I try everything, not just one trigger as I said.
     
  11. InSaNe_97

    InSaNe_97

    Joined:
    Feb 11, 2016
    Messages:
    132
    Resources:
    0
    Resources:
    0
  12. RG00

    RG00

    Joined:
    Jun 4, 2017
    Messages:
    172
    Resources:
    1
    Maps:
    1
    Resources:
    1
    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).
     
  13. InSaNe_97

    InSaNe_97

    Joined:
    Feb 11, 2016
    Messages:
    132
    Resources:
    0
    Resources:
    0
    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: Dec 12, 2018
  14. RG00

    RG00

    Joined:
    Jun 4, 2017
    Messages:
    172
    Resources:
    1
    Maps:
    1
    Resources:
    1
    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)
     
  15. InSaNe_97

    InSaNe_97

    Joined:
    Feb 11, 2016
    Messages:
    132
    Resources:
    0
    Resources:
    0
    Okay, than you, I will try it, probably tomorrow, I don't have time now, thank you <3.
     
  16. InSaNe_97

    InSaNe_97

    Joined:
    Feb 11, 2016
    Messages:
    132
    Resources:
    0
    Resources:
    0
    Man, this is so hard :-/.
     
  17. Aeryn

    Aeryn

    Joined:
    Apr 17, 2017
    Messages:
    241
    Resources:
    0
    Resources:
    0
    Which part didn't you understand ?