#[0.11.5.11] (Modding) Upper Bound does not work as intended

1 messages · Page 1 of 1 (latest)

tough marten
#

After extensive testing, it seems Upper Bound does in fact not work for the attribute it's applied to. It does correctly limit the effect duration to whatever the highest value is you received from an item, but not the intensity. I thought this might be due to "Multiple upper bounds are additive" but even setting the upper bound lower than the attribute (2 -> "<=1") had no effect.

**Tested with: **

  • Swimming Speed (60sec, 50%)
    SwimmingSpeed: 50% Upper Bound: "<=50%"

  • InvincibilityDuration (60sec, 2)
    InvincibilityDuration: 2 Upper Bound: "<=2"

tough marten
#

(Modding) Upper Bound does not work as intended

#

[0.11.5.11] (Modding) Upper Bound does not work as intended

shy maple
#

Uhh... I don't think that's how you code Upper Bounds.

#

SwimmingSpeed: "<=1.5" (I don't know the exact base value of this)
InvincibilityDuration: "<=2"

Wouldn't this just enough?

tough marten
#

That doesn't do anything

#

Swimming Speed Default is 3 (tiles per second), 4.5 would be 50% faster
Ingame the potion doesn't do anything now

#

Tried it with a different attribute that doesn't use %-based value, can't load mod due to formatting error in input string

#

Failed to load mod Aetheria Essentials due to exception: System.FormatException: Input string was not in a correct format.

#

Wait nevermind, that was because of something else. Trying again

#

No still doesn't work. Same as the swimming potion—just has no effect at all

#

Also tried changing "Upper Bound:" to "Upper Bounds:", didn't do anything (the effect still stacks)

shy maple
#

I have one question.

#

Where did you learn this?

#

I still really think you don't have to code the... Upper Bound like this.

#

Also I just noticed Now, that you are using "<="

tough marten
shy maple
#

The Lower Bound and Upper Bound is used to change the value that is dependent on the original base value.

I believe if you do InvincibilityDuration: ">=2"
It would mean, the value will always be "2"
Unless you have another item that tries to stack.

tough marten
shy maple
#

Hmmm, InvincibilityDuration has a base value of 1, if we made <=2, there's nothing changed because it is lower than 2.

tough marten
shy maple
#

Interesting interesting, but before I explain further, may I ask for confirmation, what do you intend to do again?

#

I'm actually at lost at the moment xd

tough marten
#

I don't know what you don't understand, I think I made it as clear as it can be

tough marten
#

Did you even read the explanations for Lower Bounds and Upper Bounds given in the example mod? It seems like you were confused about the difference of "<=x" and ">=x"

shy maple
#

I suppose xd.

#

But...

shy maple
#

Alright, I suppose I should ask better questions.
What does your potion even supposedly do? I really don't follow people's mod really, forgive me on that but still. (Though if you want, we could continue having this conversation in #🤖│mod-chat xd)
I made tests, it works as intended, I'm simply confused right now.

tough marten
#

They do what it says in the example

#

Mermaids Potion makes you swim 50% faster for example

shy maple
#

And you mentioned "Stack", what does that mean?
I tried with the same modded item that gives the same SwimmingSpeed, it doesn't stack, unless it meant something else?

tough marten
#

Because you only tested it with 1 item. In the mod every potion has 3 variants. They all have the same effect, but different durations (60, 30, 15 secs). The effect stacks when you use all 3. Now with the Upper Bound the effect *duration * doesn't stack anymore (it used to), but the effect still stacks.

shy maple
#

Ah, now that's an interesting usecase with the current modding.

#

Hmmmm...

shy maple
#

Alright, here's what you need to know about using Upper Bound (Even Lower Bound) as a value...
It is meant to give a "rule", it sounds weird, but it is what it is.
Here's my tests,
First Item SwimmingSpeed: "<=5" Duration: 10
Second Item SwimmingSpeed: +10 Duration: 30
Third Item SwimmingSpeed: +10 Duration 50

  • I took the Second and Third, yes it stacks, however the duration is separate for both, so in reality, I would have 30 Seconds of +10 SwimmingSpeed and 50 Seconds of +10 SwimmingSpeed (That means I'll be having +20 SwimmingSpeed for 30 Seconds)
  • Then I took the First item, since it has a rule of SwimmingSpeed to be not higher than 5, my SwimmingSpeed now is actually higher than 5, so during that 10 seconds, I would be having +5 SwimmingSpeed
  • After 10 Seconds, I would then have a SwimmingSpeed of +20 again.
  • Once the Second Item buff expires, SwimmingSpeed of +10

From this test alone, the feature works as intended, however, from your use case, it needs a new feature.

#

A single item can't have two same attributes at the same time, I tried :(.

shy maple
#

I tried giving an item having two same attribute.
SwimmingSpeed: +5
SwimmingSpeed: "<=5"

tough marten
#

Why would that be how it works

#

Of course that doesnt work

shy maple
#

It doesn't break surprisingly 😏

#

But instead choose the newest attribute in the code, haha, who knows, whatever works.

#

You'll never know...

tough marten
shy maple
#
Type: Consumable

Icon: Textures/DoubleHeart_Icon
Gizmo: Textures/DoubleHeart_Gizmo

# Optionally specify a custom animation for the item to display.
# Animation:
#   SpriteSheet:
#     Texture: Textures/DoubleHeart
#     Width: 16
#   Speed: 10

Name: Double Heart
Description: Replenishes {Highlighted:two} hearts.
Message: 
  - You got a {Highlighted:double heart}!
  - It replenishes two hearts.

Health: 16

# Uncomment this to play the eat voice clip when consuming this item. (This is used by food)
# Eat: true

# If set, attributes will apply as a buff with the given duration. Otherwise, the attributes are permanent.
Duration: 15

# You can optionally add attributes that are given to the player upon consumption.
Attributes:
  SwimmingSpeed: "<=5"
tough marten
#

Also why did you only specify for one potion? There wont be an Upper Bound if you drink just the other two

tough marten
shy maple
tough marten
shy maple
#

Like I said, Upper Bound and Lower Bound values are just "rules" you'll be giving

tough marten
#

If it worked for one potion, has to work for the other two

shy maple
#

If you give three of those potion Upper Bound.

#

You're not giving any additions to your SwimmingSpeed.

#

It would just stayed at base value.

tough marten
#

Ok let me ask you directly: Did you test the first potion individually

shy maple
#

Yes

tough marten
#

And it increased your swimming speed?

shy maple
#

It does not, because my "Base Value: is 4.

tough marten
#

3 actually, but yes

#

So what you just told me is it doesnt work

shy maple
#

Hmmm, we'll be going circles honestly, I stand by my tests really.
Where's Julian 😏

#

Like really.
When I read this, it just basically gives a rule to not go over that value.

tough marten
#

You just said the the 1st potion did not increase your swimming speed. It only works as Upper Bound for the other potions. That's what you're telling me right?

shy maple
#

Yes.

tough marten
#

So it does in fact not work as intended, since you need 2 items to apply an Upper Bound to 1 item, which makes no sense because then you'd need an extra item just for this one rule to add to every item that needs it.

shy maple
#

Well, to be fair, it could be used for Rings.

#

Think about "Cursed" Rings.

tough marten
#

You'd still need 2 rings for that

#

Unless you mean a ring that specifically prevents you from getting positive effects from potions and stuff

shy maple
#

Umm, no, like, a single ring could just prevent you giving any buffs from items and such.

#

I can see the applications for the Upper Bound being like this, though we still need Julian thoughts about this, since he is the one who made the system xd

tough marten
#

Oh hold on, now I get it. The feature was probably never intended for items. Its to make debuff and buff rings

#

No wonder it doesn't work

#

Lets wait for Julian to confirm it

shy maple