1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

[JASS] Location Loop

Discussion in 'Triggers & Scripts' started by Megafyr, Oct 27, 2009.

  1. Megafyr

    Megafyr

    Joined:
    Oct 29, 2007
    Messages:
    957
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    I need help with creating a loop that sets locations all over my map. The locations should be stored as location[array]. I don't want this loop to place the locations all random, but the locations should not be placed in a straight line either. I have attached a picture that shows what I am after. I haven't started making the loop yet, because I am sucky at making loops like this...

    I will give +rep to helpful suggestions. :)
     

    Attached Files:

  2. Anachron

    Anachron

    Joined:
    Sep 9, 2007
    Messages:
    6,167
    Resources:
    66
    Icons:
    49
    Packs:
    2
    Tools:
    1
    Maps:
    3
    Spells:
    9
    Tutorials:
    1
    JASS:
    1
    Resources:
    66
    GUI? JASS? vJass? Or doesn't matter?

    I Suggest creating a loop with random locations and if there is any point close to it, you remove the last and create it again. Do that until you have your amount of locations. But that could take a while.
     
  3. Maker

    Maker

    Joined:
    Mar 6, 2006
    Messages:
    9,181
    Resources:
    17
    Maps:
    2
    Spells:
    14
    Tutorials:
    1
    Resources:
    17
    I created the thing in GUI:

    http://www.hiveworkshop.com/forums/pastebin.php?id=5dgmfy

    Is this OK?

    You can specify the amount of locations, and the distance there needs to be between locations. Note that if you set the distance or amount of locations too high, the trigger loop will never end since there is no free space in the region.

    Hit esc to create the locations. Esc also resets things.

    EDIT: It basically does what Anachron said.
     
    Last edited: Oct 27, 2009