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.

Problem with creating Buildings with a 4x4 pathing next to each other

Discussion in 'World Editor Help Zone' started by DEFACKTwalker, Mar 2, 2018.

  1. DEFACKTwalker

    DEFACKTwalker

    Joined:
    Aug 2, 2008
    Messages:
    130
    Resources:
    5
    Skins:
    2
    Maps:
    2
    Template:
    1
    Resources:
    5
    Hello guys!

    For testing, this trigger is creating a matrix of 17x17 buildings:
    Code (Text):
    TEST
        Ereignisse
            Map initialization
        Bedingungen
        Aktionen
            Set Temp_Point = (Center of Gebiet 002 <gen>)
            For each (Integer A) from 0 to 16, do (Actions)
                Schleifen - Aktionen
                    Set Temp_Point_2 = (Temp_Point offset by ((Real((Integer A))) x 128.00) towards 0.00 degrees)
                    For each (Integer B) from 0 to 16, do (Actions)
                        Schleifen - Aktionen
                            Set Temp_Point_3 = (Temp_Point_2 offset by ((Real((Integer B))) x 128.00) towards 90.00 degrees)
                            Einheit - Create 1 Carved Wall for Neutral passiv at Temp_Point_3 facing Vorgabe für Gebäude-Ausrichtung degrees
                            Custom script:   call RemoveLocation (udg_Temp_Point_3)
                    Custom script:   call RemoveLocation (udg_Temp_Point_2)
            Custom script:   call RemoveLocation (udg_Temp_Point)
     
    Problem: If there's a pathing map set (4x4), the buildings will overlap.

    If i remove the pathing map, the buildings will be created as i wish.

    I tried using a 4x4 yellow pathing map.
    I made the buildings themselves to be buildable.
    I tried removing the collision.
    I tried creating dummy units, gave them an expiration timer betweet 1-10. On death, the buildings (with pathing map) have been created. With the same result: Overlapping units...

    [​IMG]
    [​IMG]

    I can't figure out why this happens.

    Does anyone ever had that problem?
    I would be happy to read a solution. Thanks =)
     
  2. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,612
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Likely caused by aligning the virtual placement grid at a boarder value. Try adding a 32 offset to the initial location.

    Ideally you want the unit creation point to be placed as closely to where it will be displaced as possible.
     
  3. DEFACKTwalker

    DEFACKTwalker

    Joined:
    Aug 2, 2008
    Messages:
    130
    Resources:
    5
    Skins:
    2
    Maps:
    2
    Template:
    1
    Resources:
    5
    Thanks Dr Super Good! The offset of 32 works pretty well. But i still wonder why a building can't be created right at the actual position of a point if it got a pathing map?

    Here's the code with the 32 offset
    Code (Text):
    For each (Integer A) from 0 to 16, do (Actions)
        Schleifen - Aktionen
            Set Temp_Point_2 = (Temp_Point offset by (0.00 + ((Real((Integer A))) x 128.00)) towards 0.00 degrees)
            For each (Integer B) from 0 to 16, do (Actions)
                Schleifen - Aktionen
                    Set Temp_Point_3 = (Temp_Point_2 offset by (32.00 + ((Real((Integer B))) x 128.00)) towards 90.00 degrees)
                    Set Temp_Int = (Temp_Int + 1)
                    Einheit - Create 1 Carved Wall for Neutral passiv at Temp_Point_3 facing Vorgabe für Gebäude-Ausrichtung degrees
                    Custom script:   call RemoveLocation (udg_Temp_Point_3)
            Custom script:   call RemoveLocation (udg_Temp_Point_2)
     
     
    Last edited: Mar 3, 2018
  4. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,612
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Because you are likely creating the buildings at a logic boundaries for where the building gets displaced. Such boundaries exist for buildings because buildings have to be pathing map aligned. In theory this should be fine since the building should always be offset consistently in the same direction if placed in a 128x128 grid, however since placement uses floating points that means that the position has a floating point error associated with it.

    The game engine mostly offset the buildings in the desired direction except where the floating point error meant the buildings were offset in the other direction, hence this occurred in lines which represent the same floating point values. By offsetting placement by 32 units the engine has no doubts where to displace the buildings as 32 is significantly larger than the floating point error for any reasonable map position.