Announcement

Collapse

Forum Rules

  • No flaming or derogatory remarks, directly or through insinuation.
  • No discussion, sharing or referencing illegal software such as hacks, keygen, cracks and pirated software.
  • No offensive contents, including but not limited to, racism, gore or pornography.
  • No excessive spam/meme, i.e. copious one liners in a short period of time, typing with all caps or posting meme responses (text/image).
  • No trolling, including but not limited to, flame incitation, user provocation or false information distribution.
  • No link spamming or signature advertisements for content not specific to Dota 2.
  • No Dota 2 key requests, sell, trade etc.
  • You may not create multiple accounts for any purpose, including ban evasion, unless expressly permitted by a moderator.

  • Please search before posting. One thread per issue. Do not create another thread if there is an existing one already.
  • Before posting anything, make sure you check out all sticky threads (e.g., this). Do not create new threads about closed ones.
  • It is extremely important that you post in correct forum section.

  • Balance discussion only in Misc.
  • All art related (such as hero model) feedbacks go to Art Feedback Forum.
  • All matchmaking feedback should go here: Matchmaking Feedback
  • All report/low priority issues should go here: Commend/Report/Ban Feedback
  • No specific workshop item feedback. These should go to workshop page of that item.
  • When posting in non-bugs section (such as this), use [Bugs], [Discussion] or [Suggestion] prefix in your thread name.



In case you object some action by a moderator, please contact him directly through PM and explain your concerns politely. If you are still unable to resolve the issue, contact an administrator. Do not drag these issues in public.



All rules are meant to augment common sense, please use them when not conflicted with aforementioned policies.
See more
See less

GetNeutralSpawners() returning a list of 18 nil values

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • GetNeutralSpawners() returning a list of 18 nil values

    I've been trying to avoid hard-coding any map locations as much as possible, and functions like GetNeutralSpawners() is perfect to avoid having to change coordinates after every map update, but it seems that the function isn't working properly, or I'm doing something wrong. From the beginning of a match to even after creeps spawn, GetNeutralSpawners() always gives me the same data: a list of 18 lists of {nil, nil} values, where the first 'nil' should be the camp description and the second 'nil' should be a vector. Here's a my test code for the function:
    Code:
    local neutralSpawners = GetNeutralSpawners()
    print(table.getn(neutralSpawners))
    for spawn = 1, table.getn(neutralSpawners) do
        print(neutralSpawners[spawn])
        print("    Description: " .. tostring(neutralSpawners[spawn][1]))
        print("    Vector: " .. tostring(neutralSpawners[spawn][2]))
    end
    Which always gives me this output, even after creeps spawn:
    Code:
    [VScript] 18
    [VScript] table: 0x0026def0
    [VScript]     Description: nil
    [VScript]     Vector: nil
    [VScript] table: 0x0026dbf8
    [VScript]     Description: nil
    [VScript]     Vector: nil
    [VScript] table: 0x002561a8
    [VScript]     Description: nil
    [VScript]     Vector: nil
    [VScript] table: 0x00255ed8
    [VScript]     Description: nil
    [VScript]     Vector: nil
    [VScript] table: 0x00255d28
    [VScript]     Description: nil
    [VScript]     Vector: nil
    [VScript] table: 0x00256060
    [VScript]     Description: nil
    [VScript]     Vector: nil
    [VScript] table: 0x002396c8
    [VScript]     Description: nil
    [VScript]     Vector: nil
    [VScript] table: 0x00263ec8
    [VScript]     Description: nil
    [VScript]     Vector: nil
    [VScript] table: 0x0027d360
    [VScript]     Description: nil
    [VScript]     Vector: nil
    [VScript] table: 0x00239878
    [VScript]     Description: nil
    [VScript]     Vector: nil
    [VScript] table: 0x00263d50
    [VScript]     Description: nil
    [VScript]     Vector: nil
    [VScript] table: 0x0024bc38
    [VScript]     Description: nil
    [VScript]     Vector: nil
    [VScript] table: 0x0024f738
    [VScript]     Description: nil
    [VScript]     Vector: nil
    [VScript] table: 0x0024f5e8
    [VScript]     Description: nil
    [VScript]     Vector: nil
    [VScript] table: 0x00274fe0
    [VScript]     Description: nil
    [VScript]     Vector: nil
    [VScript] table: 0x00275038
    [VScript]     Description: nil
    [VScript]     Vector: nil
    [VScript] table: 0x00262dd8
    [VScript]     Description: nil
    [VScript]     Vector: nil
    [VScript] table: 0x0027b5e0
    [VScript]     Description: nil
    [VScript]     Vector: nil
    Is there something I'm missing?

  • #2
    Try using min, max, team, type, speed, location keys instead of 1,2,3 and so on.
    Code:
    local neutralSpawners = GetNeutralSpawners()
    print(table.getn(neutralSpawners))
    for spawn = 1, table.getn(neutralSpawners) do
        print(neutralSpawners[spawn])
        print("    Max: " .. tostring(neutralSpawners[spawn]['max']))
        print("    Min: " .. tostring(neutralSpawners[spawn]['min']))
        print("    Team: " .. tostring(neutralSpawners[spawn]['team']))
        print("    Type: " .. tostring(neutralSpawners[spawn]['type']))
        print("    Speed: " .. tostring(neutralSpawners[spawn]['speed']))
        print("    Location: " .. tostring(neutralSpawners[spawn]['location']))
    end
    Here is the output
    Code:
    [VScript] 18
    [VScript] table: 0x002e4908
    [VScript]     Max: Vector 00000000002E4AE0 [-29.500122 -2992.000000 639.999939]
    [VScript]     Min: Vector 00000000002E4978 [-1204.000000 -3598.000000 -384.000000]
    [VScript]     Team: 2
    [VScript]     Type: medium
    [VScript]     Speed: fast
    [VScript]     Location: Vector 00000000002E4948 [-371.000000 -3374.000000 265.000000]
    [VScript] table: 0x002e4998
    [VScript]     Max: Vector 000000000046AC78 [1112.000000 -4128.000000 512.000061]
    [VScript]     Min: Vector 000000000046AB10 [178.999939 -5093.500000 -384.000000]
    [VScript]     Team: 2
    [VScript]     Type: medium
    [VScript]     Speed: fast
    [VScript]     Location: Vector 00000000002E49D8 [384.000000 -4672.000000 519.999939]
    [VScript] table: 0x0046ac90
    [VScript]     Max: Vector 000000000046ADF8 [-4272.000000 96.000000 1096.000000]
    [VScript]     Min: Vector 000000000046AD00 [-5165.500000 -640.000000 112.500000]
    [VScript]     Team: 2
    [VScript]     Type: large
    [VScript]     Speed: fast
    [VScript]     Location: Vector 000000000046ACD0 [-4873.000000 -512.500000 263.999756]
    [VScript] table: 0x0046ae40
    [VScript]     Max: Vector 00000000002C49B0 [3800.000000 -4032.000000 608.000000]
    [VScript]     Min: Vector 000000000046AEB0 [2784.000000 -4912.000000 -384.000000]
    [VScript]     Team: 2
    [VScript]     Type: small
    [VScript]     Speed: normal
    [VScript]     Location: Vector 000000000046AE80 [2889.953857 -4557.562012 263.999878]
    [VScript] table: 0x002c49c8
    [VScript]     Max: Vector 00000000002C4B30 [-3474.999756 1088.000000 768.000061]
    [VScript]     Min: Vector 00000000002C4A38 [-4319.999512 192.000000 -383.999817]
    [VScript]     Team: 2
    [VScript]     Type: medium
    [VScript]     Speed: normal
    [VScript]     Location: Vector 00000000002C4A08 [-3685.870605 871.857666 263.999939]
    [VScript] table: 0x0046ae10
    [VScript]     Max: Vector 00000000002C4CD8 [4892.000000 -3984.000000 800.000000]
    [VScript]     Min: Vector 00000000002C4BE0 [3940.000000 -4752.000000 -384.000000]
    [VScript]     Team: 2
    [VScript]     Type: large
    [VScript]     Speed: normal
    [VScript]     Location: Vector 00000000002C4BB0 [4603.048828 -4361.680664 263.999878]
    [VScript] table: 0x002c4cf0
    [VScript]     Max: Vector 000000000028DA20 [-1472.000000 -3784.000000 608.000061]
    [VScript]     Min: Vector 000000000046AB78 [-2187.000000 -4640.000000 -384.000000]
    [VScript]     Team: 2
    [VScript]     Type: large
    [VScript]     Speed: fast
    [VScript]     Location: Vector 000000000046AB48 [-1848.000000 -4216.000000 263.999878]
    [VScript] table: 0x0028da38
    [VScript]     Max: Vector 000000000028DBA0 [-2277.000000 207.999939 928.000000]
    [VScript]     Min: Vector 000000000028DAA8 [-3203.500000 -643.500061 -384.000000]
    [VScript]     Team: 2
    [VScript]     Type: ancient
    [VScript]     Speed: normal
    [VScript]     Location: Vector 000000000028DA78 [-3077.500000 -199.000000 393.000000]
    [VScript] table: 0x0028dbb8
    [VScript]     Max: Vector 000000000028DD20 [516.000000 -1593.750000 704.000000]
    [VScript]     Min: Vector 000000000028DC28 [-136.000031 -2264.000000 280.500000]
    [VScript]     Team: 2
    [VScript]     Type: ancient
    [VScript]     Speed: normal
    [VScript]     Location: Vector 000000000028DBF8 [69.066162 -1851.600098 392.000000]
    [VScript] table: 0x002cbb70
    [VScript]     Max: Vector 00000000002CBCD8 [113.500000 3645.500000 735.000000]
    [VScript]     Min: Vector 00000000002CBBE0 [-792.000000 3112.000000 -384.000000]
    [VScript]     Team: 3
    [VScript]     Type: medium
    [VScript]     Speed: normal
    [VScript]     Location: Vector 00000000002CBBB0 [-228.500000 3387.500000 393.000000]
    [VScript] table: 0x002cbcf0
    [VScript]     Max: Vector 00000000002CBE58 [4738.593750 1088.000000 944.000000]
    [VScript]     Min: Vector 00000000002CBD60 [4016.000000 511.999878 384.000000]
    [VScript]     Team: 3
    [VScript]     Type: large
    [VScript]     Speed: fast
    [VScript]     Location: Vector 00000000002CBD30 [4452.000000 840.000000 391.999878]
    [VScript] table: 0x002cbe70
    [VScript]     Max: Vector 0000000000431B68 [1584.500000 3920.000000 1152.000000]
    [VScript]     Min: Vector 00000000002CBEE0 [607.999939 3128.500000 -384.000000]
    [VScript]     Team: 3
    [VScript]     Type: large
    [VScript]     Speed: normal
    [VScript]     Location: Vector 00000000002CBEB0 [1346.833252 3289.285156 391.999878]
    [VScript] table: 0x00431b80
    [VScript]     Max: Vector 0000000000431CE8 [3284.000000 424.000000 448.000000]
    [VScript]     Min: Vector 0000000000431BF0 [2320.000000 -160.000000 -384.000122]
    [VScript]     Team: 3
    [VScript]     Type: medium
    [VScript]     Speed: normal
    [VScript]     Location: Vector 0000000000431BC0 [2548.799561 92.937256 391.999878]
    [VScript] table: 0x00431d00
    [VScript]     Max: Vector 0000000000431E68 [-2500.000000 4931.625000 512.000061]
    [VScript]     Min: Vector 0000000000431D70 [-3496.000000 4112.000000 -384.000000]
    [VScript]     Team: 3
    [VScript]     Type: small
    [VScript]     Speed: normal
    [VScript]     Location: Vector 0000000000431D40 [-2658.032471 4595.014160 298.862183]
    [VScript] table: 0x00431e80
    [VScript]     Max: Vector 00000000004770C0 [-3955.250000 3946.000000 384.500061]
    [VScript]     Min: Vector 00000000002CBF10 [-4748.750000 3254.000000 -384.000000]
    [VScript]     Team: 3
    [VScript]     Type: large
    [VScript]     Speed: normal
    [VScript]     Location: Vector 0000000000431EC0 [-4251.449219 3424.000000 307.733032]
    [VScript] table: 0x004770d8
    [VScript]     Max: Vector 0000000000477240 [-1376.000000 4499.000488 540.500061]
    [VScript]     Min: Vector 0000000000477148 [-2208.000000 3844.000244 77.000061]
    [VScript]     Team: 3
    [VScript]     Type: medium
    [VScript]     Speed: fast
    [VScript]     Location: Vector 0000000000477118 [-2024.063965 4280.686523 263.999939]
    [VScript] table: 0x00477258
    [VScript]     Max: Vector 00000000004773C0 [-288.000000 2752.000000 1144.500000]
    [VScript]     Min: Vector 00000000004772C8 [-1034.875000 1967.999878 383.999756]
    [VScript]     Team: 3
    [VScript]     Type: ancient
    [VScript]     Speed: normal
    [VScript]     Location: Vector 0000000000477298 [-948.000000 2268.500000 391.999756]
    [VScript] table: 0x004773d8
    [VScript]     Max: Vector 00000000002C2A00 [4176.000000 -384.000000 400.000000]
    [VScript]     Min: Vector 00000000002C4B60 [3208.000000 -976.000000 -384.000000]
    [VScript]     Team: 3
    [VScript]     Type: ancient
    [VScript]     Speed: normal
    [VScript]     Location: Vector 0000000000477418 [3936.000000 -576.000000 295.644104]

    Comment


    • #3
      Great, thanks arz_on4dt! Where did you find this by the way? I can't find any of this information in the documentation...

      Comment


      • #4
        It is documented in a past post.

        This is the structure:

        Code:
        ---------------------------------------------------------------------------------
        -- GetNeutralSpawners structure
        -- @type GetNeutralSpawners_Return
        -- @field #string team the side of the map where this camp is located
        -- @field #string type the size of the camp (small, medium, large, ancient)
        -- @field #string speed the speed of the camp members (slow, normal, fast)
        -- @field Vector#Vector min the minimum bounds of the camp radius
        -- @field Vector#Vector max the maximum bounds of the camp radius
        -- @field Vector#Vector location the location of the camp
        And the code to access it is the one that arz posted.

        The modification was added here.

        For usage if min/max, try my function:

        Code:
        function PointIsInsideAABB (v, Min, Max)
        	return ((v.x > Min.x) and (v.x < Max.x) and (v.y > Min.y) and (v.y < Max.y));
        end
        Where v is the desired target location.
        Explanations on the normal, high and very high brackets in replays: here, here & here
        Why maphacks won't work in D2: here

        Comment


        • #5
          Thanks The Nomad, I guess I'll have to spend more time scouring the forums for these details. Would be nice to have this directly in the wiki though.

          Comment

          Working...
          X