• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Group Issue

Status
Not open for further replies.

Chaosy

Tutorial Reviewer
Level 41
Joined
Jun 9, 2011
Messages
13,239
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