Jump to content

Define the percentage for adding options to gear


rhrlima

Recommended Posts


  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.07
  • Content Count:  2
  • Reputation:   0
  • Joined:  05/11/25
  • Last Seen:  

 

Introduction

Current implementation of random options offers two options:

  • Fixed slots, with defined pool of options for each slot
  • Define the upper bound, for one big pool of options

With this setup is hard to control the drop chance for gear with a specific number options.

So, I thought about adding the option to define exactly the chance for a given random option slot.

Source (Github)

The source code is available in my fork of rAthena (branch feat/chances-rand-options)

https://github.com/rhrlima/rathena/tree/feat/chances-rand-options

You can also easily check the diff here:
https://github.com/rathena/rathena/compare/master...rhrlima:rathena:feat/chances-rand-options

Configuration

- Id: INTEGER
  Group: STRING
  MaxRandom: INTEGER
  Chances: LIST OF INTEGERS # new parameter
  Random: LIST OF OBJECTS
    - Option: STRING
      MinValue: INTEGER
      MaxValue: INTEGER
      Chance: INTEGER

In the item_randomopt_group.yml file, we have the parameter Chances which is a list of integers, that defines the chance of adding a option slot to the equipament.

The example above, defines a group that can generate up to 3 options, where the first option has a 50% chance of being applied, the second one 30%, and third 10%.

Once an option is added, then, the selected effect will be affected by the Chance defined in the Option list.

You can still use the original behavior with the MaxRandom parameter.

You can mix both Parameters, the upper bound with be defined by which value is bigger, MaxRandom or the length of Chances.

If MaxRandom is bigger than the length of Chances, slots that don't have a chance defined will use the fault behavior (the chance defined in each effect).

Example

# Group that generates 0-3 options
- Id: 1
  Group: GROUP_NAME
  Chances:
    - 5000 # 1st option has 50%
    - 3000 # 30%
    - 1000 # 10%
  Random:
    - Option: VAR_STRAMOUNT
      MinValue: 1
      MaxValue: 5
      Chance: 2000
    - Option: VAR_AGIAMOUNT
	  ...

 

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
Reply to this topic...

×   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...