• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Spellbook bug, abilities gone

Status
Not open for further replies.
Level 14
Joined
Aug 30, 2004
Messages
909
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
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
@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.
 
Level 14
Joined
Aug 30, 2004
Messages
909
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.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
There is no way to open spellbook via triggers because spellbook order doesn't exist. It has to be open manualy.

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.

Pretty much spellbook can be ordered to open by forcing it through triggers, eh?
 
Level 14
Joined
Aug 30, 2004
Messages
909
Mhm, there actually is an order id, but no one seems to have found it in the past
JASS:
call IssueImmediateOrderById (u, 852608)

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:
Status
Not open for further replies.
Top