Updating weapons (SQL Help)
Hi,
I am attempting to replace all fabled weapon stats with regular weapon stats. I have a list of fabled Items and a list of regular items, and I've matched up each of the IDs. To replace all the stats on Fabled items with the stats on the regular items - what would that code look like? I also want to randomize some stats on the (then normalized fabled items, in this case WEAPONS) , and to do that I could do this, right? Code:
Update `items` set `damage` = `damage`*(RAND()+1), `astr`=`astr`+(15*RAND()), `asta`=`asta`+(15*RAND()),(ETC) WHERE (`itemtype` = 0 OR `itemtype` = 1 OR `itemtype` = 2 OR `itemtype` = 3 OR `itemtype` = 4 OR `itemtype` = 5 Do I need to make the randoms INTs or will the standard FLOATs be fine for this application? Code:
CONVERT(INT, (10+3)RAND()) #example In short: 1. Take Fabled Item, Replace stats with unfabled item (including req and rec level, etc) 2. Apply semi-random stats to fabled items. |
you'll probably want to match the value returned with the data type of the field it's going to be updating. i'm not sure it won't just truncate the result, but it's never a bad idea to cover your bases.
also, this is shorter and more readable: Code:
WHERE `itemtype` IN (1, 2, 3, 4, 5, 35, 45) |
Thanks c0nc,
Any suggestion how I can go about updating these tables? I have a list of regular items and their fabled counterparts saved, but I'm not really sure how to go about copying one set of values over to the other. (Well, all except name, and ID of course) That's a lot of information to copy over, there has to be an easy way to do it, but i dont know what it is! |
here's what I got so far
Code:
|
All times are GMT -4. The time now is 03:22 AM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.