Spells usable by all classes
Hello everyone,
I am looking for tips or hints to mod the 'spells_new' entries so any class could use any spell. So far i found this query that works, it changes lvl255 restriction to the lvl i want by columns (lvl50 for mage spells for example here) : update spells_new set classes(13)=50 where classes(13)>253; ..Now i would like to go farther and for each spell ID to check the minimum lvl rec from classes1 to classes16 colums and apply that level to the rest of the classes. Not sure if it's clear, english is not my native tongue. Thanks for your help ladies and gentlemen :-D |
The way the table is set up make this a bit of a pain...
Code:
DROP TEMPORARY TABLE IF EXISTS temp_spells_classes; Back up spells_new first!! |
Thanks so much Zaela_S, that's exactly what I was looking for .. It works perfectly.
I was trying to figure it out by myself but I am still in the process of learning the more complex SQL functions, and as you said the way the table is set up is a pita...I now understand that the use of temp table was the key here... Thanks again for your help ;) |
After testing some more,I found that bard's songs could cause bugs ("you missed a note" instead of "your spell fizzle"), not sure for tanks tomes but better remove it too ..
Also when you put 65535 as item.class for spells scroll it shows ingame on it with all classes and a bunch of 255 for those that can't use it. The code would then be for mage for instance ( Run this before Zaela_S's code) : Code:
update items, spells_new set classes=classes+4096 WHERE Classes(number) in spells_new : 2 Cleric 3 Paladin 4 Ranger 5 Shadowknight 6 Druid 10 Shaman 11 Necromancer 12 Wizard 13 Magician 14 Enchanter 15 Beastlord Classes in items : 1 Warrior 2 Cleric 4 Paladin 8 Ranger 16 Shadowknight 32 Druid 64 Monk 128 Bard 256 Rogue 512 Shaman 1024 Necromancer 2048 Wizard 4096 Magician 8192 Enchanter 16384 Beastlord Then you can mod the classes in spells_new Code:
DROP TEMPORARY TABLE IF EXISTS temp_spells_classes; Thanks again for the insight Zaela_S, and I hope it will help people like it helped me :cool: |
Quote:
Quote:
By changing `item`.`class` .. you are altering what classes can 'access' the item..but, not what classes can use the spell. This would explain the '255' values you are seeing and is not unexpected. To properly create a bitmask (in this case,) you would take the class id and subtract 1 (since it is a 1-based index,) then left bit-shift 1 by that amount. Finally, you would bitwise-or each value to attain the final result. Code:
int final_bitmask = 0; Code:
update items, spells_new set classes=classes+4096 WHERE `item`.`classes` = 4097 (warrior and magician) [update triggered because `classes` > 4096] 4097 + 4096 = 8193 (warrior and enchanter) Also, by setting the item to be usable by class '4096' where `classes13` = 255, you only allow them access to the item, not the spell. You would need to change `classes13`to a usable level for them to be able to use the actual spell and not just the item. |
Sorry it was not very clear, read a foreign language is one thing, writing is another ;)
To sum up, when i tested the code Zaela_S shared, it was what I was looking for ( a way to make spells available to other classes at the appropriate level ) But once in game I had a couple issues like 'you missed a note' as fizzle message when casting spells instead of 'your spell fizzles' ( I thing i read somewhere bard songs could cause that bug ), as well as pet's focus effects not working anymore, so i removed all non caster classes from Zaela's code. Then it was perfect. When it came time to change scrolls in game to be writable by all classes, I just put 65535 in the item table for spell scrolls. It worked but you could see all the classes in the description of the scroll with those who cant use it, like war(255),rog(255) etc.. For cosmetic purposes I went with that (bruteforce) method to add the class bitmask, 4096 for mage for example, excluding the spells mages already known and also excluding the spells mages shared with other classes ( like invisibility ) because when I added the bitmask the way i did it messed up those spells. That solution worked for me, hence the excitement to share it ( I bet you guys write miles of lines of code in a finger snape :D ), but I couldn't figure out how the class bitmask worked .. Thanks for the help on that Uleat ! |
Sorry to bump an old thread... Does anyone have an idea if a sql query could be written to update the scroll/"Spell:" in 'items' by simply reading the data out of 'spells_new'?
I'm having trouble with reading from one table into the other. It seems like the code in this thread was close to doing that... I'm assuming you'd have to build a sum under the logic of items.classes = (if spells_new.classes11 < 255, add 1024) #necromancer all the way through each class? Any help would be appreciated! Thank you |
Almost there! Looking for some coding experts...
I have the following code based on Zaela's above... this reads from spells_new table and creates the correct classes bitmask is the items table for all spell scrolls. I confirmed the temp table operates properly, the problem is in updating the items table via JOIN. This code I have below causes HeidiSQL to hang and then ultimately crash SQL. Am I missing something that is causing this? Code:
UPDATE items s Code:
DROP TEMPORARY TABLE IF EXISTS temp_spells_classes; |
All times are GMT -4. The time now is 01:01 PM. |
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.