• 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.

Help w/ Spell Purchase

Status
Not open for further replies.

sentrywiz

S

sentrywiz

Hi!

I got a problem. Atleast a moderate one:

-Heroes purchase spells. Each hero should at normal logic purchase more spells than possible, this also has a hotkey issue. Multiple spells, ment for different classes share the Q or W or E or R hotkey.

? How to make that hotkeys don't overlap, meaning a hero purchases two Q spells, but one of them is bound to a new hotkey. The only solution is a huge if else then that will check which abilities the hero has. But that solution means I have to make that huge if else then for every spell possible, create multiple instances of each spell with a different hotkey so they don't overlap.

Thoughts, ideas are welcomed. Thank you!
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
You could initialize things into a hashtable.

You store the hotkey(string) using the id of the bought thing as a parent key. Do this at map initialization.

When you buy stuff, get the handle id of the bought type and load the string with it. Then load a boolean for the buying unit using the loaded string as a key. If the boolean is false, the unit does not have an ability with that hotkey. Give it the ability and save the boolean as true. If the boolean is true, the unit alraedy has an ability with that hotkey.
 

sentrywiz

S

sentrywiz

Thanks Maker. Though, this I already know how to make and there is no problem with it. I was thinking some alternate solution if possible.
 
Status
Not open for further replies.
Top