tom22 Posted November 3, 2008 Author Share Posted November 3, 2008 Hi there,I want to create an actionbar with keybindings and icons to activate spells instead of the current spell list which is really uncomfortable to play with.Has such thing been done before? How should I do this? Any suggestions or tips?Currently I'm not even sure where to start so any help is appreciated. I can do some VB6. Link to comment Share on other sites More sharing options...
Tyr Posted November 3, 2008 Share Posted November 3, 2008 i did it for my tiny project, and its probalby oing to be added in Aura: The Beginning to :)i aslo added casting time for spells, reload time and even interrupt skills for PVP.anyhow the basic idea to create such a system (basic is just casting thats all) is to create icons of your spells and add this code to the button```Sub picSpell01_Click()SpellMemorized = 1 If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then If GetTickCount > Player(MyIndex).AttackTimer + 1000 Then If Player(MyIndex).Moving = 0 Then Call SendData("cast" & SEP_CHAR & SpellMemorized & END_CHAR) Player(MyIndex).Attacking = 1 Player(MyIndex).AttackTimer = GetTickCount Player(MyIndex).CastedSpell = YES Else Call AddText("Cannot cast while walking!", BRIGHTRED) End If End If Else Call AddText("No spell here.", BRIGHTRED) End If```its just a mix of the original code for casting & learning spells.BUT: you have to be sure that your spell that the icon needs to CAST is on the RIGHT place in the listbox!well, thats the basic stuff, i added way more features already (oh and click on the lisbox, visible = false the ppl don't need to c that box)i also know that this code can be made way easier, but i thought this code would might be the best to udnerstand :)i hope i helped you out, if there are any other questions feel free to ask me ^^Peace out, Tyr Link to comment Share on other sites More sharing options...
tom22 Posted November 3, 2008 Author Share Posted November 3, 2008 Thanks.Looks like it's going to be a hard thing to do and thus I'll add it to the end of my ToDo.Still trying to figure out how to smoothly convert 3d models to 2d sprites. Problem is that I'm seeing a black border (or whatever colour, depends on what background colour the character sprite has) around the character. Which is no problem for pixely sprites, but when you have those very detailed ones converted from 3d models, it's very ugly.Anyhow thats a different topic so I'll start another thread in the graphics section. :)Thanks! Link to comment Share on other sites More sharing options...
Tyr Posted November 3, 2008 Share Posted November 3, 2008 yep u do that :) i'm glad i could help you out! Link to comment Share on other sites More sharing options...
apf42589 Posted November 3, 2008 Share Posted November 3, 2008 @Tyr:> i did it for my tiny project, and its probalby oing to be added in Aura: The Beginning to :)> i aslo added casting time for spells, reload time and even interrupt skills for PVP.> > anyhow the basic idea to create such a system (basic is just casting thats all) is to create icons of your spells and add this code to the button> > ```> Sub picSpell01_Click()> > SpellMemorized = 1> If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then> If GetTickCount > Player(MyIndex).AttackTimer + 1000 Then> If Player(MyIndex).Moving = 0 Then> Call SendData("cast" & SEP_CHAR & SpellMemorized & END_CHAR)> Player(MyIndex).Attacking = 1> Player(MyIndex).AttackTimer = GetTickCount> Player(MyIndex).CastedSpell = YES> Else> Call AddText("Cannot cast while walking!", BRIGHTRED)> End If> End If> Else> Call AddText("No spell here.", BRIGHTRED)> End If> > ```> its just a mix of the original code for casting & learning spells.> > BUT: you have to be sure that your spell that the icon needs to CAST is on the RIGHT place in the listbox!> > well, thats the basic stuff, i added way more features already (oh and click on the lisbox, visible = false the ppl don't need to c that box)> i also know that this code can be made way easier, but i thought this code would might be the best to udnerstand :)> > i hope i helped you out, if there are any other questions feel free to ask me ^^> > Peace out, Tyri think i'm going to give this a shot too, if you don't mind that is :P Link to comment Share on other sites More sharing options...
Tyr Posted November 3, 2008 Share Posted November 3, 2008 nope its on the forums for something, that ppl don't ask twice the same questions for example :pits just a quickly made standard code, have fun with it! Link to comment Share on other sites More sharing options...
apf42589 Posted November 4, 2008 Share Posted November 4, 2008 @Tyr:> nope its on the forums for something, that ppl don't ask twice the same questions for example :p> its just a quickly made standard code, have fun with it!haha thank you :cheesy: Link to comment Share on other sites More sharing options...
Warconn Posted November 12, 2008 Share Posted November 12, 2008 hey, dont no if this is a necro or not, but i am trying to apply this to my game. This only casts the spell that i have selected in the spells list box, like i have the second one sellected, and it casts it, and then i have the third spell selected, and it does the third spell. Also i have 6 spell buttons, and they all do the same spell. Sorry i couldnt find any help on this.Thanks Link to comment Share on other sites More sharing options...
Tyr Posted November 12, 2008 Share Posted November 12, 2008 lol dude ^^first of all, its not a necro 3/11 and 11/11 so whatever, just check the date.secondly when i post a code on the forums its not meant just to copy and paste you will have to UNDERSTAND the code.the code i gave you actually worked for spell 1 (of course) ok gimme a second… i'll make the code easier for you all, and also way more efficient (as i only posted the code for spell 1 i will now post the code for every single spell you desire)Put this at the end of modgame logic:```Sub CastSpell(ByVal SpellNum As Integer, ByVal Mana As Integer)If GetPlayerMP(MyIndex) >= Mana Then 'check for MPIf Player(MyIndex).Moving = 0 Then If GetTickCount > Player(MyIndex).AttackTimer + 1000 Then If Player(MyIndex).Moving = 0 Then Call SendData("cast" & SEP_CHAR & SpellNum & END_CHAR) Player(MyIndex).Attacking = 1 Player(MyIndex).AttackTimer = GetTickCount Player(MyIndex).CastedSpell = YES SpellCasted = 0 Else Call AddText("Cannot cast while walking!", YELLOW) End If End IfElse Call AddText("Cannot cast while Moving", YELLOW)End IfElse Call AddText("Not enough mana!", YELLOW) End IfEnd Sub```well now add to each spell button this code: ```Call CastSpell(SPELLNUMER, MANA)```with spellnumber the number of the spell listed in the casting dialog and mana of course the amount of mana needed to cast the spell (this may not be needed as this is also checked at the server side, i only did this because with my reloading system you would cast and then it would say not enough mana etc… whatever)so, again wait an example:you have a spell button that needs to cast fireball, and the code under it is for example Call CastSpell(1 ,5)THEN YOU HAVE TO BE SURE THAT THE SPELL IS IN THE FIRST PLACE! if not everything would go wrong...Note: with this system it will also "disable" that persons can buy scrolls and lean spells taht way because they can learn them in a random way! (instead when you make your own item type and code it all like i did, but thats not the point) this means that players will have to learn spells when they have a good magic req ok?mhh, i might consider making a tut about this =/ok, i hope i helped you all out now. Took me some time to make this postGood luck, Tyr Link to comment Share on other sites More sharing options...
Warconn Posted November 12, 2008 Share Posted November 12, 2008 yea, thanks i did not under stand at first, i thought that went in my button sub lol, i am trying it out now.Thanks[EDIT]ok when i compile the client, i get a Variable not defined onSpellcasted = 0i will try some other things to get it to work, any ideas? Link to comment Share on other sites More sharing options...
Tyr Posted November 13, 2008 Share Posted November 13, 2008 @Warconn:> yea, thanks i did not under stand at first, i thought that went in my button sub lol, i am trying it out now.> > Thanks> > [EDIT]> ok when i compile the client, i get a Variable not defined on> > Spellcasted = 0> > i will try some other things to get it to work, any ideas?well ya i forgot to add that, as i guess everyone knew what to do when a variable isn't defenice, you have to declare it oOgo to modGlobals and add to the bottom```'Visual Spell DeclarationsPublic SpellCasted As Integer```but probably you won't need that var as its probably for the reloading system… anyhow that should work eve nif you didn't need the variable. Link to comment Share on other sites More sharing options...
Warconn Posted November 13, 2008 Share Posted November 13, 2008 yea, i just deleted that variable, sorry Link to comment Share on other sites More sharing options...
Robin Posted November 13, 2008 Share Posted November 13, 2008 ```HotKey(1 to 12) as byte``````Select Case KeyCode Case vbKeyF1 If Spell(HotKey(1)) > 0 then CastSpell HotKey(1) end if Case vbKeyF2 If Spell(HotKey(2)) > 0 then CastSpell HotKey(2) end ifetc. etc.``````If ControlDown = true then Select Case KeyCode Case vbKeyF1 AddText "Hotkey 1 spell set", Red? HotKey(1) = lstSpells.listindex + 1etc. etc..```Or just steal my spell book system :3 Link to comment Share on other sites More sharing options...
Tyr Posted November 14, 2008 Share Posted November 14, 2008 mhh well, i try making my own code… i made it basicaly for learning vb6.0 :)though easy and nice code you have there :p Link to comment Share on other sites More sharing options...
apf42589 Posted November 14, 2008 Share Posted November 14, 2008 tried it… didnt work.. i suck.. i quit... lmfao... nah i dont quit... but.. anyways... hopefully it works out for all of you, i'm not really going into changing the interface as of right now in my game... APF Link to comment Share on other sites More sharing options...
Tyr Posted November 14, 2008 Share Posted November 14, 2008 @apf42589:> tried it… didnt work.. i suck.. i quit... lmfao... nah i dont quit... but.. anyways... hopefully it works out for all of you, i'm not really going into changing the interface as of right now in my game...> > APFactually that post didn't made really sense, if you are not changing the the interface… whatever it s not a code you copy paste in 5 secs oO Link to comment Share on other sites More sharing options...
codemeister1990 Posted November 14, 2008 Share Posted November 14, 2008 I got lost a few times trying to understand how to use this code or whateverand I still don't know what to doyou gotta be clearer man Link to comment Share on other sites More sharing options...
Tyr Posted November 14, 2008 Share Posted November 14, 2008 warconn succeded, you need to have at least some coding skill before trying to understand it…but i guess thats normal when u post in this section? Link to comment Share on other sites More sharing options...
Warconn Posted November 14, 2008 Share Posted November 14, 2008 yea, i had some difficulty when i just tryed to copy and paste the code, but i took some time, and i have some skill with source, and i read the code to try and understand it better, thats how i learned vb6, reading other peoples codes ;) Link to comment Share on other sites More sharing options...
codemeister1990 Posted November 14, 2008 Share Posted November 14, 2008 oh, I dunno anything about editing source other than its vb6 Link to comment Share on other sites More sharing options...
Tyr Posted November 14, 2008 Share Posted November 14, 2008 @Warconn:> yea, i had some difficulty when i just tryed to copy and paste the code, but i took some time, and i have some skill with source, and i read the code to try and understand it better, thats how i learned vb6, reading other peoples codes ;)and thats how it should be done :) Link to comment Share on other sites More sharing options...
Warconn Posted November 15, 2008 Share Posted November 15, 2008 @Robin:> ```> HotKey(1 to 12) as byte> > ```> ```> Select Case KeyCode> Case vbKeyF1> If Spell(HotKey(1)) > 0 then> CastSpell HotKey(1)> end if> Case vbKeyF2> If Spell(HotKey(2)) > 0 then> CastSpell HotKey(2)> end if> etc. etc.> > ```> ```> If ControlDown = true then> Select Case KeyCode> Case vbKeyF1> AddText "Hotkey 1 spell set", Red?> HotKey(1) = lstSpells.listindex + 1> etc. etc..> > ```> Or just steal my spell book system :3so this will allow the user to set the spells to a hotkey, can they choose which one they want in a certain hotkey, or is it just by the spells list.Also, which spellbook system are you talking about, i have searched and searched for it, but i have found nothing.Thanks Link to comment Share on other sites More sharing options...
Robin Posted November 15, 2008 Share Posted November 15, 2008 PM me about it ;D Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now