Spell Bar

So, I’m looking to create a spell bar in my game – sort of like there is in every MMO game.

What is the best way to do this? I’ve been thinking about it, and can’t think of a nice way to do it.

Thanks!

Do you mean a power bar to show a spell charging up or a control bar with all available spells laid out or… what?

I mean a bar with spells. Click a spell, just like a button, but it fades in and out to show to show cool downs. Also, it would be nice to move the buttons around, so the user can customize his UI layout.

It just seems like a lot of this wouldn’t be easily plausible with Unity’s current GUI. :?

You’re right, there isn’t any built-in control that can handle anything that complicated. However, you can do quite a bit by using GUI.DrawTexture to draw the buttons as textures and then detecting clicks on the texture rectangles directly. You will likely be able to get the effects you are looking for, but admittedly Unity doesn’t do much of the work for you in this case.

Hmm, I can do that – but that would get messy real quickly.

I think I’d be better off just finding a new UI. Haha.

In case anyone was wondering, this doesn’t seem feasibly possible with Unity’s GUI. I ended up ditching this type of UI, even though it is possibly the best UI for a game of my genre.

If anyone else wants to do something like this, the only way to probably achieve anything with a reasonable amount of time would be to use actual polygonal planes with textures as buttons. This way, you can move and snap them into other polygonal planes (I.E. the spell bar.)

It would certainly be an adventure if someone wanted to make a spell bar like this. (Sort of like a dumbed down version of WoW’s.)

you can program the spells into the number keys. and have a background box tell you which number has which spell.

Sorry mate, if you read what I was trying to do – that’s not at all what I was looking for. I wanted something more intuitive and open, where the user can drag and drop buttons – there changing his keybindings to his liking. Sure, one can easily denote “1” to fireball, “2” to iceball, etc. But at the end of the day, players like to choose what abilities goes where.

Ended up dropping this entire scheme and went with something different.

Actually, this is entirely possible to do in Unity. I am working on the same thing, and have to just implement the drag and drop part of the script. I can post whatever I have when its done . . .

This thread’s a bit old, but I’d still be interested in what you come up with, so please do post it.

I’m a little lost as to how this is impossible as well.

Got the drag and drop working, here’s a webplayer:
http://www.mikecookportfolio.com/unitystuff/test-build.html

I also have item restrictions setup. So the bottom bar can accept any items, but the top one only allows “Actions” in it (so the smiley and fist actions).

Keyboard mappings are setup so you can use those on the top bar.

Can you post an example or give some details on how you achieved this?

I’ve tried it several times with various textures, but usually it seems to have alot of overhead.

I’ve been thinking of using EZ GUI, but seeing this seems to boost my hopes in using the standard GUI.

@dacrazycoder -
Sure, I’ll explain how to do it. It might be a while till I can get to that because I’m stupidly busy at work (working 16+ hours) but once I have some free time I will type something up here.

Very nice!

You should put it on the wiki. I’m sure it would be quite popular.

Ok, spell bar tutorial is on the wiki. Still not finished with it yet, but at least people can try out the code. Still need to add explanations of what each function does, etc:

http://www.unifycommunity.com/wiki/index.php?title=Creating_a_Drag_and_Drop_Spell_Bar

This just goes to show me how noob I am at this.

I think I am working above my paygrade lol.