• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

How to detect when a unit opens spellbook

Status
Not open for further replies.
Level 2
Joined
Dec 19, 2007
Messages
20
Doesnt work of course.. I've tried Starts the effect of an ability, Begins casting an ability, Finishes casting an ability , Begins channeling an ability and Stops casting an ability. None of them works.
 
Level 8
Joined
Nov 9, 2008
Messages
502
It's probably the same as 'starts an ability' but try messing with the order strings and make event 'is issued order' condition order equals (order(string)).
 
Level 8
Joined
Nov 9, 2008
Messages
502
lol

make dummy ability for the apprearance of your spellbook

when unit cast dummy A,

remove dummy A
add spellbook
force keyboard event to open the book (thats possible?) (yes its possible under - game > force UI key)

then you have an event you can trigger from

thankyou
 
Last edited:
Level 2
Joined
Dec 19, 2007
Messages
20
Well I will explain my problem clearly. There is a Library in my map and it has 8 spellbook abilities. All the spellbooks contain 11 abilities (they are same). For example one of the spellbooks name is Swordsmanship. The 11 ability in it are 0-10-20-30-40-50-60-70-80-90-100. When you open the Swordsmanship spellbook and use one of these abilities it sets your Swordsmanship skill level to a number (Depends on which ability you used). To set the level of a skill I have to detect which spellbook the unit has opened. So what toofless said isnt good for me.

And there is this trigger I made that doesnt work.

Spellbook
Events
Unit - A unit Is issued an order targeting an object
Unit - A unit Is issued an order targeting a point
Unit - A unit Is issued an order with no target
Conditions
Actions
Game - Display to (All players) the text: (String((Issued order)))
 
Level 8
Joined
Nov 9, 2008
Messages
502
Tankyou :grin:

I'm thinking adding and removing spellbook messes with cooldowns so probably instead what you should do is disable the spellbook ability for the player and enable it when you want it to become visable.

Please rep me for my drunken genious :thumbs_up:

EDIT: Oh, why won't it work? You just need 8 dummy abilities instead and 8 different hotkeys for the spellbooks.

Ye it will work because I understand what you're trying to do (i think).
The dummy spells will be so you can set a variable which will tell you which spellbook was opened

Hmm, there may be a problem when you try to detect closing the spellbook and replacing the book with the dummy ability. You can event from 'player presses ESC' but there is always the thing if you have spellbook open and instead of closing it u just select another unit. You could code that too I suppose.

Another alternate would be using the dummy abilities again but seeing as the spells inside the spellbooks are all the same you can just use another dummy unit which would have those spells.

So when dummy ability is pressed it will select your dummy unit (which has your 10-20-30-...... abilities)
Works almost the same way as spellbooks.
 
Level 2
Joined
Dec 19, 2007
Messages
20
Well if opening a spellbook cant be detected I guess I have to use a different way. Thanks for the answers. I guess this isnt possible so [Solved].
 
Level 9
Joined
Jul 3, 2008
Messages
495
I thought about this:

Place an ability inside the spellbook, and do this trigger:

Event:
Every x seconds
Action:
Cast the spell inside spellbook.

If the spellbook is closed the ability cant be casted, but if its open... Its should be able. You should be able to detect when the spell is casted
 
Level 2
Joined
Dec 19, 2007
Messages
20
Theres nothing wrong with your answer toofless, but its not the answer of my question. I thought of other ways to do what I wanted before I posted the question here. So I dont need alternative options, I just wanted to know if it was possible to detect it with an event.
 
My way can detect if the spellbook is opened or closed. Its not perfect, but I think its the only way.
And your way is? I thought you tested it and it didn't work?

Nope it isnt just need a little triggering and dummy abilities
Technically, it is impossible to detect the actual spellbook opening. But there are workarounds, which don''t actually detect the spellbook opening, but which detect something else, then open the spellbook...
 
Level 9
Joined
Jul 3, 2008
Messages
495
Adding a dummy spell to the spellbook, and every 0.1 seconds try to use the spells.
If the spellbook is open, the ability will fire, then you just need to catch it with another event. Use the same method to detect when its closed.

You cant use the trigger to cast an ability when its inside the spellbook. You need to force the player to press a key. Lets say T and if the
abilities hotkey is T it will fire.

There is alot of things in wc3 that needs "work arrounds". Its good and its bad. It can make a map more unique. Like save/loads code, its also a work arround method.
And Toudcop's swap textures system.
 
Adding a dummy spell to the spellbook, and every 0.1 seconds try to use the spells.
If the spellbook is open, the ability will fire, then you just need to catch it with another event. Use the same method to detect when its closed.

You cant use the trigger to cast an ability when its inside the spellbook. You need to force the player to press a key. Lets say T and if the
abilities hotkey is T it will fire.
And if the spellbook is already full without an extra ability?
 
Level 12
Joined
Feb 13, 2009
Messages
388
What prevents you from doing different 0-100 abilities? I mean 100 swordsmanship and 100 fencing are different abilities, then there'll be no voodoo with opening books, just simple triggers.
 
Level 2
Joined
Dec 19, 2007
Messages
20
Nothing actually. I already spent a lot time for this system. I had to make a lot of changes. It seems I have to change it again.
 
Status
Not open for further replies.
Top