• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] Group Issue

Status
Not open for further replies.

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
I am currently using the following function:

JASS:
        function Build(player p, integer id)
        {
            rect toBuild = gg_rct_Region_000;
            real x, y;
            location l;
            group g;
            while(true)
            {
                x = GetRandomReal(GetRectMinX(toBuild), GetRectMaxX(toBuild));
                y = GetRandomReal(GetRectMinY(toBuild), GetRectMaxY(toBuild));
                l = Location(x, y);
                BJDebugMsg(R2S(x)+ " " + R2S(y) + " " + I2S(id));
                g = GetUnitsInRangeOfLocAll(100, l);
                if(FirstOfGroup(g) != null)
                {
                    IssueBuildOrderById(gg_unit_opeo_0004, id, x, y);
                    BJDebugMsg("no null");
                    break;
                }
                DestroyGroup(g);
                RemoveLocation(l);
            }
        }

This is not finished which is why I don't use the p variable yet etc, but that's not the issue.

The code is supposed to order a peon to build in a specific region but make sure there is nothing blocking the randomized location.

The debug messages show correct values so they are not the issue.
2e80bab2d45f87d510be74a1996c9a4a.png


I placed the peon inside the region and it build properly, but when I moved the region it suddenly stopped working, it does exit the loop.

It does not pass the condition, despite it being impossible for it to fail:
42b9c3bcaa63ff77712e860e9db52431.png
 
Last edited:
Status
Not open for further replies.
Top