Jump to content
  • 0

Random Headgear Bonuses


Conflicts

Question


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  317
  • Reputation:   63
  • Joined:  11/13/11
  • Last Seen:  

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


  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   381
  • Joined:  02/03/12
  • Last Seen:  

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();
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  317
  • Reputation:   63
  • Joined:  11/13/11
  • Last Seen:  

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.

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   381
  • Joined:  02/03/12
  • Last Seen:  

Limited is a poor choice in words... Complicated but not necessarily limited is how I would describe it.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.00
  • Content Count:  317
  • Reputation:   63
  • Joined:  11/13/11
  • Last Seen:  

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...