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 haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Rubbed the right way, the genie is out of its lamp! The 12th Concept Art Contest Results have been announced.
    Dismiss Notice
  4. The Lich King has a new champion. The results for the 19th Icon Contest are here!
    Dismiss Notice
  5. Race against the odds and Reforge, Don't Refund. The 14th Techtree Contest has begun!
    Dismiss Notice
  6. 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.

Spellbook bug, abilities gone

Discussion in 'Triggers & Scripts' started by darwin, Jul 24, 2011.

  1. darwin

    darwin

    Joined:
    Aug 30, 2004
    Messages:
    905
    Resources:
    2
    Maps:
    2
    Resources:
    2
    In my map you can fly around in a ship. While doing this, you have a spellbook ability that contains all your flight commands. So while you're flying, the spellbook is always open and you're just casting abilities inside it as you go. If your ship is blown up, I have a trigger to detect this, and move your pilot (Hero) to the point of death. I then select your hero for you.

    PROBLEM: if your hero is selected by the trigger, he has no abilities. Not even move/patrol, etc. He will move if you right-click. It's as if the interface is showing a blank open spellbook or something.

    IN GAME SOLUTION: Oddly, if I leave out the "select pilot" action of the trigger and manually select the hero in game by pressing F1, I get all my abilities as normal.

    Here is the relevant trigger parts:

    • Ship dies
      • Events
        • Unit - A unit Dies
      • Conditions
        • ((Triggering unit) is A Hero) Not equal to True
      • Actions
        • Set DeadUnit = (Triggering unit)
        • -------- --------- --------
        • -------- UNHIDE HERO if there is one --------
        • -------- --------- --------
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • deathInteger Less than or equal to 10
          • Then - Actions
            • Game - Force (Owner of (Triggering unit)) to press Escape/Cancel
            • Selection - Remove (Triggering unit) from selection for (Owner of (Triggering unit))
            • -------- ************* Dying Unit is one of the Hero's Ships ******************* --------
            • -------- move hero --------
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Hero[deathInteger] is hidden) Equal to True
                • HeroInSomething[deathInteger] Equal to False
              • Then - Actions
                • -------- hero in ship --------
                • Set tempDeathPoint = (Position of (Dying unit))
                • Unit - Move Hero[deathInteger] instantly to tempDeathPoint
                • Unit - Unhide Hero[deathInteger]
                • Set defaultSelection[deathInteger] = Hero[deathInteger]
                • Camera - Reset camera for (Owner of DeadUnit) to standard game-view over 0.00 seconds
                • Custom script: call RemoveLocation (udg_tempDeathPoint)
                • Selection - Select Hero[(Custom value of (Triggering unit))] for (Owner of (Triggering unit))
              • Else - Actions
          • Else - Actions
            • -------- ----- --------
            • -------- lower FlierCounter --------
            • -------- ----- --------
            • Set FliersNumber = (FliersNumber - 1)
        • -------- --------- --------


    Things I've tried:
    - I added a forced "Press ESC" command to try to get out of the spellbook when the unit dies. It doesn't work (that is still in the trigger, but removing it doesn't fix anything)
    - I've tried removing the spellbook ability from the unit when it dies
    - I've tried removing the unit from the game when it dies
    - I've tried selecting and de-selecting the unit with triggers, but the abilities stay gone until I do it manually in game.
    - I've tried putting in a wait command before reselecting the pilot. That does not work, though if I wait in game and select the hero manually he does have all his abilities.
    - I've tried making the player select their pilot manually by forcing them to press "F1" but that didn't seem to work.. I'm not sure "F" followed by "1" translates to the F1 function key
     
  2. MortAr

    MortAr

    Joined:
    Feb 25, 2009
    Messages:
    1,768
    Resources:
    7
    Icons:
    6
    Packs:
    1
    Resources:
    7
    Instead of a spellbook, use a dummy unit with these abilities.
    Also, I don't think the line "Game - Force X" works at all.
     
  3. Bannar

    Bannar

    Joined:
    Mar 19, 2008
    Messages:
    3,087
    Resources:
    20
    Spells:
    5
    Tutorials:
    1
    JASS:
    14
    Resources:
    20
    It's so wierd that I ask for map.
    There is no way to open spellbook via triggers because spellbook order doesn't exist. It has to be open manualy.
     
  4. Justify

    Justify

    Joined:
    Mar 16, 2008
    Messages:
    935
    Resources:
    5
    Models:
    1
    Icons:
    1
    Spells:
    3
    Resources:
    5
    Afaik spellbooks can be opened, not with a string-order but the number. Dunno what it was.
     
  5. Bannar

    Bannar

    Joined:
    Mar 19, 2008
    Messages:
    3,087
    Resources:
    20
    Spells:
    5
    Tutorials:
    1
    JASS:
    14
    Resources:
    20
    @Justify Then tell me the number. Personaly never found it, but meaby I'm mistaken about opening spellbooks, although this and this speaks that there is no way. Meaby Nestharus forgot about one ^^. Also, whenever you click on order field in spellbook ability it's immidiately changed to nothing.

    Again, posting map would be great.
     
  6. Justify

    Justify

    Joined:
    Mar 16, 2008
    Messages:
    935
    Resources:
    5
    Models:
    1
    Icons:
    1
    Spells:
    3
    Resources:
    5
    I thought there was one, I fail hard in the last time D: Orders doesn't work, just tested several methods. The only thing that works is forcing to press the hotkey :/
     
  7. darwin

    darwin

    Joined:
    Aug 30, 2004
    Messages:
    905
    Resources:
    2
    Maps:
    2
    Resources:
    2
    Sorry, been busy at work and this thread got away from me.

    There is a way to keep the spellbook open, you can force the User to press the hotkey. In my case, I use "z" for the spellbook. Everytime they select a unit I check to see if it's their ship. If it is, I force "z". If they press ESC to close the spellbook I force z again. If they manually click on the "cancel" button in the spellbook then it actually does close though.

    That part of the map works fine.

    I've made a work around for this for the time being...when your ship is shot down you simply don't have your hero selected immediately. But people figure out to press F1, or select him manually. If it were a problem people knew how to fix I'd change it, but it looks like it's a bit of a mystery and I'd rather not try to hunt it down anymore. It's not game breaking.

    Thanks all.
     
  8. defskull

    defskull

    Joined:
    Mar 27, 2008
    Messages:
    7,979
    Resources:
    17
    Spells:
    17
    Resources:
    17
    Pretty much spellbook can be ordered to open by forcing it through triggers, eh?
     
  9. darwin

    darwin

    Joined:
    Aug 30, 2004
    Messages:
    905
    Resources:
    2
    Maps:
    2
    Resources:
    2
    Well yes, but I should point out that apparently it doesn't work if the player is holding the CONTROL key.
     
  10. Pharaoh_

    Pharaoh_

    Joined:
    Nov 6, 2008
    Messages:
    8,128
    Resources:
    11
    Icons:
    3
    Skins:
    1
    Spells:
    6
    Tutorials:
    1
    Resources:
    11
    Mhm, there actually is an order id, but no one seems to have found it in the past
    Code (vJASS):
    call IssueImmediateOrderById (u, 852608)
     
  11. darwin

    darwin

    Joined:
    Aug 30, 2004
    Messages:
    905
    Resources:
    2
    Maps:
    2
    Resources:
    2
    Interesting! I'm having trouble using that command though. I'm not good with JASS yet. I put this:

    Custom script: IssueImmediateOrderById (udg_tempUnit, 852608)

    I have a unit variable called: tempUnit

    It wouldn't compile though and had an error of some kind. Could someone help?

    EDIT: Nevermind, I forgot the "call" at the beginning. Thanks
     
    Last edited: Aug 13, 2011