Zarius / Bukkit-OtherBlocks

OtherBlocks (now known as OtherDrops) plugin for Bukkit (dev build: https://www.mediafire.com/?i6ows1g6kus2o0l)
http://dev.bukkit.org/server-mods/otherdrops/
GNU General Public License v3.0
17 stars 17 forks source link

exclusive parameter not working, sometimes many drops firing... #187

Open israelcurtis opened 11 years ago

israelcurtis commented 11 years ago

I've been using "flag:unique" as the "exclusive" parameter has been random and useless. I would like to be able to use "exclusive", however, when dealing with groups of related drops where I only want one to fire. I also don't want to use "unique" because it prevents other action events from firing that match the same conditions.

In this example, I have a special shovel that deals three possible levels of damage (based on the enderdragon example (http://dev.bukkit.org/server-mods/otherdrops/pages/basic-examples/)

Even though all action nodes are part of the same exclusive group, sometimes I'll see a dozen events fire, with my debugging messages "low,low,low,medium,high,high,villager killed, villager killed, villager kililed" -- just from one hit with the shovel. Doesn't happen with "flag:unique"..

VILLAGER:
  - action: HIT
    tool: ironshovel@!~the Smacker
    damage.victim: 3
    sound: HURT
    chance: 50%
    exclusive: 1
    message: "low"
  - action: HIT
    tool: ironshovel@!~the Smacker
    damage.victim: 9
    sound: HURT
    chance: 25%
    exclusive: 1
    message: "medium"
  - action: HIT
    tool: ironshovel@!~the Smacker
    damage.victim: 50
    message: "§8SMACK!"
    effect: ZOMBIE_CHEW_IRON_DOOR
    chance: 25%
    damagetool: 30
    exclusive: 1
    message: "high"
Zarius commented 11 years ago

Ah... the exclusive parameter was actually deprecated a while back in favor of the "flags: UNIQUE" parameter. Didn't realise it was still in the documentation.

There's still some code in there and I've been wondering recently if it would be handy to bring back but not sure. What flags: UNIQUE doesn't let you do is replicate the drop: {item/60%, item/40%} distribution. For now I'll remove exclusive from the documentation though and set up a new issue for the distribution.

israelcurtis commented 11 years ago

yes, it's handy for scenarios where UNIQUE doesn't cut it. For now, I'm using dropgroups, which is kinda working

 dropgroup: smacker
  action: HIT
  tool: ironshovel@!~the Smacker
  drops:
    - chance: 50%
      damage.victim: 3
      flags: UNIQUE
      message: "low"
    - chance: 25%
      damage.victim: 9
      sound: HURT
      flags: UNIQUE
      message: "medium"
    - chance: 25%
      damage.victim: 50
      message: "§8SMACK!"
      effect: ZOMBIE_CHEW_IRON_DOOR
      damagetool: 30
      flags: UNIQUE
      message: "high"
CelticMinstrel commented 11 years ago

As I recall, the use of the "exclusive" parameter was that, of all drops that have a particular value of "exclusive", only one would ever drop. However, it was done by checking each in turn and stopping once one was dropped, meaning that the order of drops affects the chance of dropping.

israelcurtis commented 11 years ago

ah - then probably my dropgroup use is better? still not sure if it really behaves like a group where only one item drops, but that one is determined by the 'chance' within the group

Zarius commented 11 years ago

I see what you're trying to do which is to replicate the exclusive list, ie. {low/50%, medium/25%, low/25%}. However what you get is {low/50% or nothing/50%, medium/25% or nothing/75%, low25% or nothing/75%} since the "unique" flag is checked first, then the chance value is rolled after a "unique" section has been selected.

You can "fake it" with the unique flag like the below. What this does is remove the chance values and add "low" twice. There are four sections therefore each section has a 25% chance of being chosen and the "low" has 50% as it's listed twice.

  - dropgroup: smacker
    action: HIT
    tool: ironshovel@!~the Smacker
    drops:
    - &low 
      damage.victim: 3
      flags: UNIQUE
      message: "low"
    - *low

    - damage.victim: 9
      sound: HURT
      flags: UNIQUE
      message: "medium"

    - damage.victim: 50
      message: "§8SMACK!"
      effect: ZOMBIE_CHEW_IRON_DOOR
      damagetool: 30
      flags: UNIQUE
      message: "high"

I'm still looking into a way to more comfortably replicate the { } style whilst using separate sections. Perhaps something like this:

  - action: HIT
    tool: ironshovel@!~the Smacker
    exclusivegroup:
    - damage.victim: 3
      flags: UNIQUE
      message: "low"
      chance: 50%

    - damage.victim: 9
      sound: HURT
      flags: UNIQUE
      message: "medium"
      chance: 25%

    - damage.victim: 50
      message: "§8SMACK!"
      effect: ZOMBIE_CHEW_IRON_DOOR
      damagetool: 30
      flags: UNIQUE
      message: "high"
      chance: 25%

Just not sure about calling it "exclusivegroup", "distributiongroup", "distgroup" or something else.

israelcurtis commented 11 years ago

maybe a "chancegroup"? since the defining characteristic is that these items' chances work in concert? Might be most clear if the first key of each sub-group were "chance: xx%"

i'm assuming we wouldn't need flags:unique in such a setup?

Zarius commented 11 years ago

Correct, the "unique" flag would be redundant.

CelticMinstrel commented 11 years ago

Or maybe...

  - exclusivegroup: group-name
    action: HIT
    tool: ironshovel@!~the Smacker
    drops:
    - damage.victim: 3
      flags: UNIQUE
      message: "low"
      chance: 50%

    - damage.victim: 9
      sound: HURT
      flags: UNIQUE
      message: "medium"
      chance: 25%

    - damage.victim: 50
      message: "§8SMACK!"
      effect: ZOMBIE_CHEW_IRON_DOOR
      damagetool: 30
      flags: UNIQUE
      message: "high"
      chance: 25%

Basically, exclusivegroup key replaces the dropgroup key. It's more consistent, right?