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.

Strange location issues

Discussion in 'World Editor Help Zone' started by Ricola3D, Jul 28, 2019.

  1. Ricola3D

    Ricola3D

    Joined:
    Feb 27, 2019
    Messages:
    225
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Hello,

    In my map I have players that reported units that spawn at a different location than expected.

    For example the trigger below. I set TempPoint as a global variable, the location where I will create my units. Is it possible that my global variable TempPoint is modified between my 2 calls to the function "Unit - Create" ?

    - For exemple, events like "Unit enters in (Entire Map)" or "Unit is issued an order" could fire between the 2 calls ?
    - Can there be any asynchronous trigger executing at the same time ?

    • For each (Integer A) from 1 to 4, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (WaveNumber Equal to (Integer A)) or ((WaveNumber Equal to ((Integer A) + 4)) or (WaveNumber Equal to ((Integer A) + 8)))
          • Then - Actions
            • Set TempPoint = (Center of WaveCome[(Integer A)])
            • Unit - Create (5 + WaveNumber) WaveUnit[WaveNumber] for Player 11 (Dark Green) at TempPoint facing DefensePoint
            • Unit Group - Pick every unit in (Last created unit group) and do (Actions)
              • Loop - Actions
                • Unit - Order (Picked unit) to Attack-Move To DefensePoint
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • ModeSingle Equal to False
              • Then - Actions
                • Unit - Create (5 + WaveNumber) WaveUnit[WaveNumber] for Player 11 (Dark Green) at TempPoint facing DefensePoint
                • Unit Group - Pick every unit in (Last created unit group) and do (Actions)
                  • Loop - Actions
                    • Unit - Order (Picked unit) to Attack-Move To DefensePoint
              • Else - Actions
                • Do nothing
            • Custom script: call RemoveLocation(udg_TempPoint)
          • Else - Actions
            • Do nothing


    Edit: WaveCome is a region array of 4 rectangle regions. Because my creeps can spawn from west, north, east or south
     
    Last edited: Jul 28, 2019
  2. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,163
    Resources:
    22
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    4
    JASS:
    3
    Resources:
    22
    Yes, exactly. "Create Unit" will fire respective "Enters Region" event, if it matches. And "Ordering Unit" does fire registered order event triggers.

    Nope. Like also the above noted triggers will fire, it's executed all one after an other. We just might not always know everything what happens in such "one" step, if other things are called behind.

    Same goes for IntegerA, it can be changed by such calls, when executed triggers again use IntegerA loops. Have a look: 5. Loop Interfering - Problem.
     
  3. Ricola3D

    Ricola3D

    Joined:
    Feb 27, 2019
    Messages:
    225
    Resources:
    1
    Maps:
    1
    Resources:
    1
    So the events don't fire after the end of the execution of the triggers already in the queue, but right now, in the middle of my currently executing trigger ?
    If yes, that's an akward event system that Blizzard made us here :S
     
  4. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,163
    Resources:
    22
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    4
    JASS:
    3
    Resources:
    22
    Yes, they fire right away.
    It's actually pretty normal though. One does expect the events to fire directly at the event, not at some (from event side seen) arbitary operation queue.
    The result is similar to using:
    • Trigger - MyTrigger <gen> (checking conditions)
    ^here one can more easily see that the "registered" trigger will directly run.

    Edit:

    Or maybe a better example is how the real event works.

    • Events
      • Game - MyRealVariable becomes Equal to 1.00


    Any other trigger doing this:
    • Set MyRealVAriable = 1.00
    would directly call the trigger above, before proceeding to further actions.
    That's how most custom events in GUI work, and can use it for structering before/after events.
     
    Last edited: Jul 28, 2019
  5. Uncle

    Uncle

    Joined:
    Aug 10, 2018
    Messages:
    490
    Resources:
    0
    Resources:
    0
    You can turn off the triggers that you don't want to run and then turn them back on. "Turn off Enters Map Trigger" -> "Create 5 units" -> "Turn on Enters Map Trigger"
     
  6. Ricola3D

    Ricola3D

    Joined:
    Feb 27, 2019
    Messages:
    225
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Well I am a software developer, and I don't usualy see that. In multithreading softwares like User Interfaces, that work mainly with events (button clicked, etc...) there is no problem, the code just has to be safe for multithreading.

    In 3D rendering software, usually the events fire at the next frame (so only your FPS matters).

    Back to our topic. This is a nightmare for me... Since I am developing in GUI, I am using some "TempXXX" globals as temporary variables. And many triggers use the same globals. So I'll have to check any of them...

    Edit: will the local global trick solve my issue of TempXXX variables ?
    The GUI Local Variable Trick - Wc3C.net
     
  7. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,163
    Resources:
    22
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    4
    JASS:
    3
    Resources:
    22
    Yes, using the shadowing trick used to solve it as workaround. You might also think switching to JASS or Lua, it might be not hard you as software developer, and then just proper ways like alwys using locals can be used.
     
  8. Ceday

    Ceday

    Joined:
    Feb 22, 2010
    Messages:
    1,085
    Resources:
    0
    Resources:
    0
    Although you can't apply same logic to games. Consider a scenario where unit X uses a triggered spell that does damage to unit Y and if life of target unit is under a certain threshold after damage it dies, and unit Y has a triggered skill that blocks damage. By your proposition Y's damage block skill would not work. You can think of many other scenarios.
     
  9. Ricola3D

    Ricola3D

    Joined:
    Feb 27, 2019
    Messages:
    225
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Well the legacy of my map uses GUI. I modified it to avoid memory leaks (before the TempPoint & other variables didn't exist). However I did not expect this behavior. Changing it all would need days and days. However I agree than for my future developments, if they are complex, it is better to switch to JASS, vJASS or Lua ^^
     
  10. Ricola3D

    Ricola3D

    Joined:
    Feb 27, 2019
    Messages:
    225
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Actually some events fire after the trigger execution, like "unit enters map". See the following map for an example :)
     

    Attached Files:

  11. Pyrogasm

    Pyrogasm

    Joined:
    Feb 27, 2007
    Messages:
    3,065
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Absolutely false; they instantly interrupt the trigger queue when new events fire mid-trigger. See my post in your other thread.
     
  12. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,163
    Resources:
    22
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    4
    JASS:
    3
    Resources:
    22
    Interesting, the unit can already be moved out of region when the EnterRegion event fires, or can be actually there again when the LeaveRegion event fires. So, the event does not necessarily say something about a unit's position. Seems kind of wrong.

    It feels like regions periodically check if the event has to run, instead of an instant run. And the events get fired all at once for enter- or leave event for a region, like from a queue.

    I changed the testmap, to create one unit at a region, and moving it a few times back and forth into an other region, right after creation.
     

    Attached Files:

    Last edited: Aug 13, 2019