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. We have recently started the 16th edition of the Mini Mapping Contest. The theme is mini RPG. Do check it out and have fun.
    Dismiss Notice
  4. Choose your ride to damnation in the 5th Special Effect Contest Poll.
    Dismiss Notice
  5. The winners of the 13th Techtree Contest have been announced!
    Dismiss Notice
  6. The 13th Music Contest Poll is up! Vote for the best tracks in this symphony of frost and flame.
    Dismiss Notice
  7. Race against the odds and Reforge, Don't Refund. The 14th Techtree Contest has begun!
    Dismiss Notice
  8. 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.

Weird Selection Bug using Channel+Spellbook

Discussion in 'Triggers & Scripts' started by Jimpanse1, May 13, 2019.

  1. Jimpanse1

    Jimpanse1

    Joined:
    Sep 29, 2016
    Messages:
    42
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Hi guys,

    i've tried to create a map myself. However i got a weird problem:

    First example:
    A Unit has a spellbook. That spellbook has a Channel Spell, Follow Trough Time: 5, Visible Activated.
    Trigger: If that unit uses that Channel spell, make the Owner of Triggering Unit select the other unit.
    -> Other unit is selected. UI (Move, Attack, anything) vanished. Rightclick movement is possible, Hotkey AttackMove/Stop/Hold Position/etc. do not work.
    If you click on the 2nd unit, nothing changes. If you Double click the unit, UI appears again.

    Second example:
    A Unit has NO spellbook. The Channel Spell is added to the unit, Follow Through Time: 5, Visible Activated.
    Trigger: If that unit uses that Channel spell, make the Owner of Triggering Unit select the other unit.
    -> Other unit is selected. UI is visible.

    I attached a map, where you can test both examples.
    You guys got any idea on how to solve it? (while still using lots of abilities inside spellbook)
    Or is it a bug, that should be fixed for 1.31?

    Edit: Wasn't sure if i should post it in Triggers & Scripts or Patch discussion. I'm not sure if i did something wrong or if it is a bug.
     

    Attached Files:

    Last edited: May 14, 2019
  2. Cespie

    Cespie

    Joined:
    May 21, 2019
    Messages:
    435
    Resources:
    0
    Resources:
    0
    Sounds like some odd bug where the game somehow thinks that the other unit is in a channelling state when a spellbook is open as it is selected. Maybe a possible workaround is to first clear the players selection, and then pick the other unit?
    I will test this once I have a map editor on me, try my suggestion in the meantime if you can.
     
  3. Jimpanse1

    Jimpanse1

    Joined:
    Sep 29, 2016
    Messages:
    42
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Didn't work. Apparently Clear Selection doesn't clear selection in that case. This thing doesn't happen with other Instant Spells like War Stomp, but i do need to change the Base Order IDs.
     
  4. Cespie

    Cespie

    Joined:
    May 21, 2019
    Messages:
    435
    Resources:
    0
    Resources:
    0
    Alright, got my home PC and world editor.
    I found the root of the issue, and it is as I suspected, the spellbook is preventing the UI from loading properly. No amount of selections swapping and tricks seems to close the spellbook. So... I closed it manually:
    • Normal Trigger
      • Events
        • Unit - Weird Unit 0003 <gen> Begins channeling an ability
      • Conditions
        • (Ability being cast) Equal to Weird Channel
      • Actions
        • Game - Force (Owner of (Casting unit)) to press Escape/Cancel
        • Selection - Select Archmage 0002 <gen> for Player 1 (Red)


    Tested, and it works.
     
  5. Jimpanse1

    Jimpanse1

    Joined:
    Sep 29, 2016
    Messages:
    42
    Resources:
    1
    Maps:
    1
    Resources:
    1
    It worked! Thanks for the help. It seems to be an odd issue with an odd way to solve it.
     
  6. Cespie

    Cespie

    Joined:
    May 21, 2019
    Messages:
    435
    Resources:
    0
    Resources:
    0
    Well, the issue makes sense if you think about it.
    The UI of the spellbook takes up the same space as the base character skills. On a regular selection swap, the game expects to close down a normal unit UI, not a spellbook, so the game doesn't close down the spellbook. This is done with a manual selection, because they accounted for that scenario, which is why double clicking the unit works (as you mentioned), because that executes a regular selection that overwrites the trigger executed one, which accounts for closing down spellbooks. Either way, this fix simply closed down the spellbook, so the trigger selection worked as intended.

    Does it make sense or am I rambling? Haha. :D
     
  7. Jimpanse1

    Jimpanse1

    Joined:
    Sep 29, 2016
    Messages:
    42
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Well, your explanation does make sense for this situation. But it technically would mean, that the game is missing the action to unselect/close a spellbook UI in case the player is currently in one. Still i don't understand the difference in Selections, or why there is actually a difference between Manual Single Click, Manual Double Click & Trigger Selection...
     
  8. Cespie

    Cespie

    Joined:
    May 21, 2019
    Messages:
    435
    Resources:
    0
    Resources:
    0
    The difference between manual single click / double click is fairly simple. If you select multiple units, a single click will switch your selected unit in your selection group. Double clicking, however, clears the entire selection group and selects the single unit. Therefore, the game needs to be able to distinguish the two, as they have very different functions.
    As for the trigger selection. It makes sense if you have some general programming experience.
    Basically, what it implies, is that the trigger selection doesn't call either of the functions associated with the manual clicks, it just writes directly to the state of the selection.

    To put it in perspective, here's something that roughly resembles what the 3 things would look like if they were triggers:

    Code (Text):
    EVENT: A player Single-Clicks
    ACTIONS:
    Unselect Selection
    Select Clicked Unit.
    Code (Text):
    EVENT: A player Double-Clicks
    ACTIONS:
    Clear Selection Group
    Unselect Selection
    Select Clicked Unit.
    Code (Text):
    EVENT: Trigger
    ACTIONS:
    Set Selection = Unit
    This is just an illustration of sorts. I have no idea what the real code looks like. But basically, this is why they are different. They are done in different ways. It's also entirely possible that the trigger actually invokes the single click selection. I think it does, given how it gives off that selection sound when it's done.
     
  9. Jimpanse1

    Jimpanse1

    Joined:
    Sep 29, 2016
    Messages:
    42
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Well it does make sense, and i do think that the Trigger - Selection "Something" is the same as a Manual Click.
    But that means that they use some ways that are not reproducable with GUI to generate the Manual Double Click - Event. Your examples are good, but part of the Clear Selection thing apparently doesn't do what it should to get the player out of that UI.

    Thanks for explaining