KirieZ 88 Posted May 6, 2019 As of Release v2019.05.05 you can now create groups of random options that may be assigned to items dropped by monsters. In order to use it you must first create an Option drop group in db/option_drop_groups.conf, one group will set how each option slot is filled, the chance of it getting filled, etc. Each group has the following structure: <Group Name Constant>: ( { // Option Slot 1 Rate: (int) chance of filling option slot 1 (100 = 1%) // Possible options for slot 1 // min/max value : int, defaults to 0 // chance : int, 100 = 1% if not set, will be 100%/number of possibiltiies OptionName: value // or OptionName: [min value, max value] // or OptionName: [min value, max value, chance] // ... (as many as you want) }, // ... (up to MAX_ITEM_OPTION) ), Details about this file may be found on Hercules' docs (doc/option_drop_group.md). This is an example group called MYGROUP: MYGROUP: ( { /* Option Slot 1 */ Rate: 10000 /* It has 100% of chance of being filled */ /* This slot may have one of the following options: */ WEAPON_ATTR_WIND: 5 /* WEAPON_ATTR_WIND Lv5 (33.33%) */ WEAPON_ATTR_GROUND: [2, 4] /* WEAPON_ATTR_GROUND Lv 2~4 (33.33%) */ WEAPON_ATTR_POISON: [1, 4, 8000] /* WEAPON_ATTR_POISON Lv 1~4 (80%) */ }, { /* Option Slot 2 */ Rate: 5000 /* It has 50% of chance of being filled */ /* If filled, may have one of the following options: */ WEAPON_ATTR_WATER: 4 /* WEAPON_ATTR_WATER Lv4 (100%) */ } ) Once a group is defined, you can them assign it to monster drops in mob database by using a new syntax that works for both Drops and MvpDrops: AegisName: (chance, "GROUP_NAME") This will set that the item AegisName has chance chance of drop (like we already know from the format already in use), and, when dropped it will get random options as specified by the group GROUP_NAME. For example: Knife: (5000, "MYGROUP") Will make "Knife" be dropped with a chance of 50%, and when dropped it will get options as defined by MYGROUP option group, in other words, the first slot will be filled with Wind, Ground or Poison option, and the second slot may or may not be filled with Water option. This feature should work on any client that supports item random options. 5 Ridley, Jedzkie, Luciar and 2 others reacted to this Quote Share this post Link to post Share on other sites
IndieRO 33 Posted May 7, 2019 wow this is really cool! Quote Share this post Link to post Share on other sites
fiction 14 Posted May 20, 2019 @KirieZ Hi, i'm trying to implement this but isn't working for me.Hi, i'm triying to implement this but isn't working for me. I have the following in my option_drop_groups.conf: option_drop_group_db: ( { ValkRandom: ( { Rate: 5000 CLASS_DAMAGE_BOSS_TARGET: 5, // 5% más de daño a MvPS CLASS_DAMAGE_BOSS_TARGET: [6, 8] // 6 ~ 8% más de daño a MvPS CLASS_DAMAGE_BOSS_TARGET: [9, 15, 1000] // 9 ~ 15% más de daño a MvPS }, { Rate: 2500 CLASS_DAMAGE_BOSS_TARGET: 25, // 25% más de daño a MvPS }, ), TEST2: ( { Rate: 5000 VAR_MAXHPPERCENT: 5, // 5% MAXHP VAR_MAXHPPERCENT: [6, 8] // 6 ~ 8% MAXHP VAR_MAXHPPERCENT: [9, 15, 1000] // 9 ~ 15% MAXHP }, { Rate: 2500 RACE_TOLERACE_HUMAN: 25, // 25% resistencia Demi-Human }, ) } ) Later, in the drops mob, i have the following: { Id: 1751 SpriteName: "RANDGRIS" Name: "Valkyrie Randgris" Lv: 99 Hp: 3567200 Sp: 0 Exp: 2854900 JExp: 3114520 AttackRange: 3 Attack: [5560, 9980] Def: 25 Mdef: 42 Stats: { Str: 100 Agi: 120 Vit: 30 Int: 120 Dex: 220 Luk: 210 } ViewRange: 10 ChaseRange: 12 Size: "Size_Large" Race: "RC_Angel" Element: ("Ele_Holy", 4) Mode: { CanMove: true Aggressive: true CastSensorIdle: true Boss: true CanAttack: true Detector: true CastSensorChase: true ChangeChase: true ChangeTargetMelee: true ChangeTargetChase: true } MoveSpeed: 100 AttackDelay: 576 AttackMotion: 576 DamageMotion: 480 MvpExp: 1427450 MvpDrops: { Old_Violet_Box: 5500 Old_Blue_Box: 5000 Old_Card_Album: 2000 } Drops: { Valhalla_Flower: 5000 Valkyrie_Armor: (1600, "ValkRandom") Valkyrie_Manteau: (3000, "ValkRandom") Valkyrie_Shoes: (3000, "ValkRandom") Helm_: (5000, "ValkRandom") Bloody_Edge: 2500 Randgris_Card: 1 } }, At the first time, the console show no errors, but when i implemented a custom map with ./map-server --load-plugin mapcache --map , the console give me the following error: Quote Share this post Link to post Share on other sites
Zarbony 1 Posted May 20, 2019 (edited) Umm i just checked the doc file and in my Opinion, you use one { and } more than you need, so the Option cant be allign. Just remove it , and the script should watch like this: option_drop_group_db: ( ValkRandom: ( { Rate: 5000 CLASS_DAMAGE_BOSS_TARGET: 5, // 5% más de daño a MvPS CLASS_DAMAGE_BOSS_TARGET: [6, 8] // 6 ~ 8% más de daño a MvPS CLASS_DAMAGE_BOSS_TARGET: [9, 15, 1000] // 9 ~ 15% más de daño a MvPS }, { Rate: 2500 CLASS_DAMAGE_BOSS_TARGET: 25, // 25% más de daño a MvPS } ), TEST2: ( { Rate: 5000 VAR_MAXHPPERCENT: 5, // 5% MAXHP VAR_MAXHPPERCENT: [6, 8] // 6 ~ 8% MAXHP VAR_MAXHPPERCENT: [9, 15, 1000] // 9 ~ 15% MAXHP }, { Rate: 2500 RACE_TOLERACE_HUMAN: 25, // 25% resistencia Demi-Human } ) ) I think this will work, but i havent tested it yet... I hope it will do its job now Edited May 20, 2019 by Zarbony Quote Share this post Link to post Share on other sites
fiction 14 Posted May 20, 2019 (edited) Hi @Zarbony, thank you for reply. The syntax is option_drop_group_db: ( { /************************************************************************** ************* Entry structure ******************************************** ************************************************************************** <Group Name Constant>: ( { // Option Slot 1 Rate: (int) chance of filling option slot 1 (100 = 1%) // Possible options for slot 1 // min/max value : int, defaults to 0 // chance : int, 100 = 1% if not set, will be 100%/number of possibiltiies OptionName: value // or OptionName: [min value, max value] // or OptionName: [min value, max value, chance] // ... (as many as you want) }, // ... (up to MAX_ITEM_OPTION) ), ) } So, if i believe to this syntax, need to put an "}" at the end. Now that i pay more attention that i wrote, i think i put an extra comma here: VAR_MAXHPPERCENT: 5, Gonna test it at home @edit: Ok, i tested in my home with the same example, and isn't working for me. //================= Hercules Database ===================================== //= _ _ _ //= | | | | | | //= | |_| | ___ _ __ ___ _ _| | ___ ___ //= | _ |/ _ \ '__/ __| | | | |/ _ \/ __| //= | | | | __/ | | (__| |_| | | __/\__ \ //= \_| |_/\___|_| \___|\__,_|_|\___||___/ //================= License =============================================== //= This file is part of Hercules. //= http://herc.ws - http://github.com/HerculesWS/Hercules //= //= Copyright (C) 2018 Hercules Dev Team //= //= Hercules is free software: you can redistribute it and/or modify //= it under the terms of the GNU General Public License as published by //= the Free Software Foundation, either version 3 of the License, or //= (at your option) any later version. //= //= This program is distributed in the hope that it will be useful, //= but WITHOUT ANY WARRANTY; without even the implied warranty of //= MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //= GNU General Public License for more details. //= //= You should have received a copy of the GNU General Public License //= along with this program. If not, see <http://www.gnu.org/licenses/>. //========================================================================= //= Random Option Drop Group Database //========================================================================= option_drop_group_db: ( { /************************************************************************** ************* Entry structure ******************************************** ************************************************************************** <Group Name Constant>: ( { // Option Slot 1 Rate: (int) chance of filling option slot 1 (100 = 1%) // Possible options for slot 1 // min/max value : int, defaults to 0 // chance : int, 100 = 1% if not set, will be 100%/number of possibiltiies OptionName: value // or OptionName: [min value, max value] // or OptionName: [min value, max value, chance] // ... (as many as you want) }, // ... (up to MAX_ITEM_OPTION) ), **************************************************************************/ MYITEM: ( { // Option Slot 1 Rate: 10000 // It has 100% of chance of being filled // This slot may have one of the following options: WEAPON_ATTR_WIND: 5, // WEAPON_ATTR_WIND Lv5 (33.33%) WEAPON_ATTR_GROUND: [2, 4] // WEAPON_ATTR_GROUND Lv 2~4 (33.33%) WEAPON_ATTR_POISON: [1, 4, 8000] // WEAPON_ATTR_POISON Lv 1~4 (80%) }, { // Option Slot 2 Rate: 5000 // It has 50% of chance of being filled // If filled, may have one of the following options: WEAPON_ATTR_WATER: 4 // WEAPON_ATTR_WATER Lv4 (100%) }, ), } ) { Id: 1002 SpriteName: "PORING" Name: "Poring" Lv: 1 Hp: 50 Sp: 0 Exp: 2 JExp: 1 AttackRange: 1 Attack: [7, 10] Def: 0 Mdef: 5 Stats: { Str: 1 Agi: 1 Vit: 1 Int: 0 Dex: 6 Luk: 30 } ViewRange: 10 ChaseRange: 12 Size: "Size_Medium" Race: "RC_Plant" Element: ("Ele_Water", 1) Mode: { CanMove: true Looter: true CanAttack: true } MoveSpeed: 400 AttackDelay: 1872 AttackMotion: 672 DamageMotion: 480 MvpExp: 0 Drops: { Jellopy: 7000 Knife_: (100,"MYITEM") Sticky_Mucus: 400 Apple: 1000 Empty_Bottle: 1500 Apple: 150 Unripe_Apple: 20 Poring_Card: 1 } }, Edited May 21, 2019 by fiction Quote Share this post Link to post Share on other sites
KirieZ 88 Posted May 23, 2019 Sorry for the delayed answer, I can't use a computer at moment. This last post syntax does seem to be right. You can try removing the comma after the group block, but I don't think this is the cause... I will check once I can use my PC. Quote Share this post Link to post Share on other sites
fiction 14 Posted May 23, 2019 Hi @KirieZ thank you for answer. I removed the comma, but isn't fixed the problem. Note that the console isn't showing any warning o error, but when i apply some map in the mapcache, the error appear. [Error]: mob_read_db_optdrops: Invalid option drop group "MYITEM_M" on item "Knife_" in monster 1002, does this group really exists? Skipping... option_drop_group_db: ( { /************************************************************************** ************* Entry structure ******************************************** ************************************************************************** <Group Name Constant>: ( { // Option Slot 1 Rate: (int) chance of filling option slot 1 (100 = 1%) // Possible options for slot 1 // min/max value : int, defaults to 0 // chance : int, 100 = 1% if not set, will be 100%/number of possibiltiies OptionName: value // or OptionName: [min value, max value] // or OptionName: [min value, max value, chance] // ... (as many as you want) }, // ... (up to MAX_ITEM_OPTION) ), **************************************************************************/ MYITEM_M: ( { // Option Slot 1 Rate: 10000 // It has 100% of chance of being filled // This slot may have one of the following options: WEAPON_ATTR_WIND: 5, // WEAPON_ATTR_WIND Lv5 (33.33%) WEAPON_ATTR_GROUND: [2, 4] // WEAPON_ATTR_GROUND Lv 2~4 (33.33%) WEAPON_ATTR_POISON: [1, 4, 8000] // WEAPON_ATTR_POISON Lv 1~4 (80%) }, { // Option Slot 2 Rate: 5000 // It has 50% of chance of being filled // If filled, may have one of the following options: WEAPON_ATTR_WATER: 4 // WEAPON_ATTR_WATER Lv4 (100%) }, ) } ) { Id: 1002 SpriteName: "PORING" Name: "Poring" Lv: 1 Hp: 50 Sp: 0 Exp: 2 JExp: 1 AttackRange: 1 Attack: [7, 10] Def: 0 Mdef: 5 Stats: { Str: 1 Agi: 1 Vit: 1 Int: 0 Dex: 6 Luk: 30 } ViewRange: 10 ChaseRange: 12 Size: "Size_Medium" Race: "RC_Plant" Element: ("Ele_Water", 1) Mode: { CanMove: true Looter: true CanAttack: true } MoveSpeed: 400 AttackDelay: 1872 AttackMotion: 672 DamageMotion: 480 MvpExp: 0 Drops: { Jellopy: 7000 Knife_: (100, "MYITEM_M") Sticky_Mucus: 400 Apple: 1000 Empty_Bottle: 1500 Apple: 150 Unripe_Apple: 20 Poring_Card: 1 } }, Quote Share this post Link to post Share on other sites
fiction 14 Posted May 26, 2019 Up. This system isn't working 😕 Quote Share this post Link to post Share on other sites
KirieZ 88 Posted May 29, 2019 (edited) @fiction I finally got to my pc and could test it... The only issue I found is that when I run mapcache plugin it shows the error that it haven't found the group, but mapcache plugin kills map-server after adding the map. After the map is added and I properly start the server (this time without map-cache plugin), I don't get any errors and the drops does work. Tried on both pre-re and re. Is this the issue you found? I've copy pasted your example and it also works (diff attached). Edit: It probably doesn't matter but in my test I've used this "vip" map: https://herc.ws/board/files/file/73-vip-room-indoor/ random_opt_drop_groups.diff Edited May 29, 2019 by KirieZ Quote Share this post Link to post Share on other sites
4144 366 Posted May 29, 2019 probably missing options because chance too low? Quote Share this post Link to post Share on other sites
fiction 14 Posted May 29, 2019 i tried up the rate until 10,000 but the result is the same Quote Share this post Link to post Share on other sites
fiction 14 Posted May 29, 2019 Ok... the problem was me . I used a npc to identify all the time the items, and i forget that the npc delete the item in first place. i made a fool of myself 😢 Quote Share this post Link to post Share on other sites
4144 366 Posted May 29, 2019 this is still issue. Issue with existing scripts Quote Share this post Link to post Share on other sites
aabarreto 0 Posted February 2, 2021 Is this working properly now? Quote Share this post Link to post Share on other sites
Caiba 0 Posted February 25, 2021 On 2/2/2021 at 3:05 PM, aabarreto said: Is this working properly now? Want to know too, because the same issue occurs trying to slot option items. When u slot the item, the options disappear... Quote Share this post Link to post Share on other sites
KirieZ 88 Posted April 17, 2023 On 2/2/2021 at 3:05 PM, aabarreto said: Is this working properly now? Very late reply, but: The previous messages ended up not being an issue in the option system, but in the script being used. (more on that after the next quote) On 2/25/2021 at 5:20 PM, Caiba said: Want to know too, because the same issue occurs trying to slot option items. When u slot the item, the options disappear... Very late reply, but: Are you sure the issue is in the random option system and not in what you are trying to do? The previous messages ended up not being an issue in the option system, but in the script being used. It is important to note that a combination of delitem + getitem does NOT carry options by itself, and this is working as intended. If you want to carry options when deleting an item and creating a new one, you have to do it yourself. If I understand your message, the issue you are experiencing is that: 1. you have Knife [3] with options 2. you want to "slot it" so you get Knife [4] with options but when you try to do that, you get Knife[4] with 0 options (so options were lost). Without information on how the script was coded, I can only assume it is like the official slotting NPC where it does something like: // Deletes Knife[3] -- the item you originally had delitem(Knife, 1); // Adds Knife[4] -- the sloted item getitem(Knife_, 1); In this case, the options does NOT get carried to Knife_, and this is working as intended, because you are deleting the previous item and creating a brand new one -- the script engine doesn't know you were simply "upgrading" the item, they will even get completely different Item UIDs. The issue fiction mentioned before was exactly this case, a script was deleting the unidentified (and optioned) item and creating a new one (identified, but without options). In order to carry the options to the new item, you will need to use script commands to get the options of the old item before delete and them set the options in the new one. See "getequipoption" and "setequipoption" script commands for some leads. Quote Share this post Link to post Share on other sites