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.

Creeps not following regions with attack-ground order

Discussion in 'Triggers & Scripts' started by Esa, Nov 10, 2010.

  1. InfinateAnswers

    InfinateAnswers

    Joined:
    Jun 17, 2010
    Messages:
    2,262
    Resources:
    0
    Resources:
    0
    no? center of a region isnt a leak?
     
  2. Kanadaj

    Kanadaj

    Joined:
    Oct 18, 2008
    Messages:
    1,584
    Resources:
    2
    Icons:
    2
    Resources:
    2
    It is! Center of region=point=leak :D It's not a real part of the region itself, the game calculates it... (in most of the triggers I've seen ppl removed it)
     
  3. baassee

    baassee

    Joined:
    Nov 14, 2008
    Messages:
    3,220
    Resources:
    17
    Spells:
    14
    Tutorials:
    3
    Resources:
    17
    It is a leak. It returns a new location every time.

    Code (vJASS):

    function GetRectCenter takes rect whichRect returns location
        return Location(GetRectCenterX(whichRect), GetRectCenterY(whichRect))
    endfunction
     
  4. InfinateAnswers

    InfinateAnswers

    Joined:
    Jun 17, 2010
    Messages:
    2,262
    Resources:
    0
    Resources:
    0
    So if i use a respawn system, Create 1 boar in (random point) within (region), its leaking?
     
  5. Esa

    Esa

    Joined:
    Nov 10, 2010
    Messages:
    78
    Resources:
    0
    Resources:
    0
    How do you suggest that I fix that leak? By doing what you wrote above?
     
  6. baassee

    baassee

    Joined:
    Nov 14, 2008
    Messages:
    3,220
    Resources:
    17
    Spells:
    14
    Tutorials:
    3
    Resources:
    17
    Yes it does.

    Code (vJASS):
    function GetRandomLocInRect takes rect whichRect returns location
        return Location(GetRandomReal(GetRectMinX(whichRect), GetRectMaxX(whichRect)), GetRandomReal(GetRectMinY(whichRect), GetRectMaxY(whichRect)))
    endfunction


    You make a point variable and each time there is a new center, you set it.

    First you set it, after use you call custom script: call RemoveLocation(udg_NAMEOFVARIABLE)
     
  7. InfinateAnswers

    InfinateAnswers

    Joined:
    Jun 17, 2010
    Messages:
    2,262
    Resources:
    0
    Resources:
    0
    Okay so
    set BoarRespawn = random point within boar respawn <gen>
    Create 1 boar at boarrespawn
    custom script: call removelocation(udg_boarrespawn)

    like that?
     
  8. baassee

    baassee

    Joined:
    Nov 14, 2008
    Messages:
    3,220
    Resources:
    17
    Spells:
    14
    Tutorials:
    3
    Resources:
    17
    Yes exactly like that.
     
  9. Garfield1337

    Garfield1337

    Joined:
    Jul 6, 2009
    Messages:
    1,806
    Resources:
    4
    Maps:
    1
    Spells:
    3
    Resources:
    4
  10. InfinateAnswers

    InfinateAnswers

    Joined:
    Jun 17, 2010
    Messages:
    2,262
    Resources:
    0
    Resources:
    0
    Haha i have like 20 variables to add. I have alot of move instantly triggers, since im making an rpg. Fixing leaks will reduce lag right?
     
  11. Esa

    Esa

    Joined:
    Nov 10, 2010
    Messages:
    78
    Resources:
    0
    Resources:
    0
    I did, but I am afraid I need it dumbed down even more. I am guessing that
    • Set loc = Somewhere
    • Unit - Create 1 unit at loc
    • Custom script: call RemoveLocation(udg_loc)


    is what I need to use, as I don't use unit groups or variables. Can you explain to me how I prevent a leac by setting the location then deleting it? Also, how should I do it? In front of every trigger I have, should I set a location, then delete the location after the unit has been made? If that is the general idea, I understand the concept, just not how to do it.
     
  12. InfinateAnswers

    InfinateAnswers

    Joined:
    Jun 17, 2010
    Messages:
    2,262
    Resources:
    0
    Resources:
    0
    When a location is created. That location stays in the games memory, so that predetermined location wont be used again, but the game saves it. So you keep creating new locations, and it keeps saving them. Without deleting the locations once you are done with them, the game will keep making them. 1 leak wont bother the game that much, but if you have alot of triggers that leak, then your game will lag once you reach a point and the triggers have leaked enough.
     
  13. Garfield1337

    Garfield1337

    Joined:
    Jul 6, 2009
    Messages:
    1,806
    Resources:
    4
    Maps:
    1
    Spells:
    3
    Resources:
    4
    That's how you do it. Before refering to any location,for example: creating unit at location,you need to set that location in a variable,create unit at location variable and then clear it.

    InfinateAnswers,
    That has been explained in links i gave.
     
  14. InfinateAnswers

    InfinateAnswers

    Joined:
    Jun 17, 2010
    Messages:
    2,262
    Resources:
    0
    Resources:
    0
    He asked. He obviously didnt see it.
     
  15. Esa

    Esa

    Joined:
    Nov 10, 2010
    Messages:
    78
    Resources:
    0
    Resources:
    0
    I may be stupid in this kind of stuff, but I am not ignorant Infinate. I did read it, but as I said I needed it dumbed down more. ^_^ Meh, sorry to bother you lot with all this, I'm sure I could've googled it (not that I didn't try), but having someone to explain it I guess made it go faster.

    A question, is the variable I'm making a point variable, or real? And I am guessing it is not array. I didn't understand that in any of the link, how I can tell without asking what it should be. I have made an attempt now, and it looks like this:


    • Events
      • Time - Every 25.00 seconds of game time
    • Conditions
    • Actions
      • Set loc = (Center X of Night Elf West Spawn <gen>)
      • Unit - Create 3 Sentry for Player 12 (Brown) at (Center of Night Elf West Spawn <gen>) facing 0.00 degrees
      • Custom script: Custom script: call RemoveLocation(udg_loc)


    Also, how do I deal with this when talking of multiple locations in 1 trigger? I have a trigger that spawns monsters at 6 different places every 300 seconds.

    edit: I tried saving the map with that change made to all my spawning triggers, but it wasn't valid or something. Then they got disabled, so loaded from my backup now.
     
  16. InfinateAnswers

    InfinateAnswers

    Joined:
    Jun 17, 2010
    Messages:
    2,262
    Resources:
    0
    Resources:
    0
    Well a real is a number, and a point is a location. So using a point is your best bet for location leaks. Now array is useful because you dont have to create 100 variables if your doing the same thing, fixing a location leak. What you can do is check the array, and for every new location leak when it asks for index put +1 higher number than you used last time. So 1 variable can fix 1000+ leaks as many times as you use the triggers.
     
  17. Kanadaj

    Kanadaj

    Joined:
    Oct 18, 2008
    Messages:
    1,584
    Resources:
    2
    Icons:
    2
    Resources:
    2
    It's a point (point=location [oh, really? :D] real=real number [like 2.53])
     
  18. Esa

    Esa

    Joined:
    Nov 10, 2010
    Messages:
    78
    Resources:
    0
    Resources:
    0
    I tried making the said changes to the variable, but still got the error. This is what the trigger looks like:


    • Actions
      • Set loc[0] = (Center of Night Elf West Spawn <gen>)
      • Unit - Create 3 Sentry for Player 12 (Brown) at (Center of Night Elf West Spawn <gen>) facing 0.00 degrees
      • Custom script: Custom script: call RemoveLocation(udg_loc)


    I tried adding "()" behind udg_loc, and also tried (center X of Night Elf West Spawn <gen>) but got the same result. Also tried adding "[0]" behind udg_loc.
     
  19. InfinateAnswers

    InfinateAnswers

    Joined:
    Jun 17, 2010
    Messages:
    2,262
    Resources:
    0
    Resources:
    0
    • Actions
    • Set loc[0] = (Center of Night Elf West Spawn <gen>)
    • Unit - Create 3 Sentry for Player 12 (Brown) at (loc[0]) facing 0.00 degrees
    • Custom script: Custom script: call RemoveLocation(udg_loc[0])


    thats what it should look like
     
  20. Esa

    Esa

    Joined:
    Nov 10, 2010
    Messages:
    78
    Resources:
    0
    Resources:
    0
    Ah, okay. And when I'm talking of other spawn points, what should I call them? loc[1] and so on?

    • Actions
      • Set loc[0] = (Center of Night Elf West Spawn <gen>)
      • Unit - Create 3 Sentry for Player 12 (Brown) at loc[0] facing 0.00 degrees
      • Custom script: Custom script: call RemoveLocation(udg_loc[0])


    This trigger just got the same error. It's a point variable with array. :eek: I set the variable by a value, not arithmetic (0+1)