Conflicts Posted October 17, 2014 Group: Members Topic Count: 14 Topics Per Day: 0.00 Content Count: 317 Reputation: 63 Joined: 11/13/11 Last Seen: March 23 Share Posted October 17, 2014 Hello rAthena. I am in need of a Random Bonuses for a massive headgear collection. Pretty sure I've seen one before based on .php, but I just can't find it now. Bonuses must be configurable, and must accept a minimum and maximum value for val1, val2 etc.. Meaning I should have the ability to set a custom effect "bonus2 bCustomEffect,x,n;<2><10>;" Where 2 is min and 10 is max. Each headgear must have 3 bonuses. If the script (or .php script) could generate a description for it, that would be awesome. Thank you. Quote Link to comment Share on other sites More sharing options...
Skorm Posted October 17, 2014 Group: Forum Moderator Topic Count: 33 Topics Per Day: 0.01 Content Count: 1282 Reputation: 393 Joined: 02/03/12 Last Seen: April 11 Share Posted October 17, 2014 This is probably a pretty convoluted way of doing it... But I've found with SQL things are either extremely easy or nearly impossible. LOL DELIMITER $$ DROP PROCEDURE IF EXISTS dowhile $$ CREATE PROCEDURE dowhile() BEGIN DECLARE v1 INT DEFAULT (SELECT COUNT(*) FROM `item_db2_re` WHERE `equip_locations` & 769 AND `script` IS NULL); DECLARE v2 INT DEFAULT FLOOR( 1 + RAND( ) * 10 ); DECLARE v3 INT DEFAULT FLOOR( 1 + RAND( ) * 100 ); WHILE v1 > 0 DO CASE FLOOR( 1 + RAND( ) * 2 ) WHEN 1 THEN UPDATE `item_db2_re` SET `script` = CONCAT( 'bonus bStr,', v2, ';' ) WHERE `equip_locations` & 769 AND `script` IS NULL ORDER BY RAND() LIMIT 1; WHEN 2 THEN UPDATE `item_db2_re` SET `script` = CONCAT( 'bonus2 bAddEle,', v2, ',', v3, ';' ) WHERE `equip_locations` & 769 AND `script` IS NULL ORDER BY RAND() LIMIT 1; END CASE; SET v1 = v1 - 1; SET v2 = FLOOR( 1 + RAND( ) * 10 ); SET v3 = FLOOR( 1 + RAND( ) * 100 ); END WHILE; END $$ CALL dowhile(); Quote Link to comment Share on other sites More sharing options...
Conflicts Posted October 17, 2014 Group: Members Topic Count: 14 Topics Per Day: 0.00 Content Count: 317 Reputation: 63 Joined: 11/13/11 Last Seen: March 23 Author Share Posted October 17, 2014 Hello Skorm, thank you for the response. However, I think your way would be severely limited. I'm planning to add a lot of different effects, and even scripts such as changebase on the item's scripts. I think I'll just have to use this RagRE Item Builder's random script generator. Quote Link to comment Share on other sites More sharing options...
Skorm Posted October 17, 2014 Group: Forum Moderator Topic Count: 33 Topics Per Day: 0.01 Content Count: 1282 Reputation: 393 Joined: 02/03/12 Last Seen: April 11 Share Posted October 17, 2014 Limited is a poor choice in words... Complicated but not necessarily limited is how I would describe it. Quote Link to comment Share on other sites More sharing options...
Conflicts Posted October 18, 2014 Group: Members Topic Count: 14 Topics Per Day: 0.00 Content Count: 317 Reputation: 63 Joined: 11/13/11 Last Seen: March 23 Author Share Posted October 18, 2014 Limited is a poor choice in words... Complicated but not necessarily limited is how I would describe it. Hello Skorm, I meant no offense whatsoever on my previous response. I guess complicated fits it better, sorry for that. I was confused on the v2 value which made me think it was limited, 'cause based on how I understand it, it can do a random from X to Y value. But in your example, in this case the bonus bAddEle2, we might need to use Ele_XXX and not an integer. However later after reading it a couple more times. I realized we can use as much v(X) value as we want, and Ele_XXX even works with numbers, albeit a little confusing when you read the script again. Quote Link to comment Share on other sites More sharing options...
Question
Conflicts
Hello rAthena.
I am in need of a Random Bonuses for a massive headgear collection.
Pretty sure I've seen one before based on .php, but I just can't find it now.
Bonuses must be configurable, and must accept a minimum and maximum value for val1, val2 etc..
Meaning I should have the ability to set a custom effect "bonus2 bCustomEffect,x,n;<2><10>;" Where 2 is min and 10 is max.
Each headgear must have 3 bonuses. If the script (or .php script) could generate a description for it, that would be awesome.
Thank you.
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.