YEP ItemCore & AttachAugments - can't work out baseItem.params or item.params

Calluses

Bee
Veteran
Joined
Mar 17, 2019
Messages
36
Reaction score
57
First Language
English
Primarily Uses
RMMV
plugins involved:
Item Core (YEP)
Attachable Augments (YEP)

So, I'm trying to make a system involving improving independent item stats based on the augment attached. Items that are acquired come with an augment that dulls and can be fixed/improved by blacksmiths. I want this augment to be applicable globally to all weapon types, so it's important that it only improves the item's stats rather than the player's ones.

In weapon/armor notetag
<On Creation Eval>
ItemManager.applyAugmentEffects($dataWeapons[1], $dataItems[181+$gameVariables.value(X)], 3, 1);
</On Creation Eval>
(where X = smithing level)

In augment notetag
<Augment Attach Eval: Quality>
item.params[2] += Math.round(baseItem.params[2]*0.4);
</Augment Attach Eval: Quality>

For some reason, when I use 0.2 instead of 0.4 it seems to work. But when I increase by 0.4 and anything else, it stacks the independent item parameters rather than the base. The parameter value I've been modifying for tests is 10, so with 0.2 it goes to 12, but with 0.4 goes to 11, then 9, 8, 7, and stays at 6.
 

Magnus0808

Software Developer
Veteran
Joined
Feb 2, 2019
Messages
147
Reaction score
164
First Language
Danish
Primarily Uses
RMMV
Just from taking a look on your notetags. It seems like in <On Creation Eval> you apply the Augment effect to the base item $dataWeapons[1] instead of the new individual item.

Try instead using this:
JavaScript:
<On Creation Eval>
ItemManager.applyAugmentEffects(item, $dataItems[181+$gameVariables.value(X)], 3, 1);
</On Creation Eval>
Using item instead of $dataWeapons[1] should apply the augment effect to the individual item instead of the base item.
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,129
Reaction score
815
First Language
English
Primarily Uses
RMMV
Omg I can totally use this! But I got a few questions:

Does the above code make it so a weapon/armor come w/ the augment attached or simply grants it the effects of the augment?

Also, what would be the reverse of this function? (I'm looking for the code that tells it to remove an augment as well)
 

Calluses

Bee
Veteran
Joined
Mar 17, 2019
Messages
36
Reaction score
57
First Language
English
Primarily Uses
RMMV
Omg I can totally use this! But I got a few questions:

Does the above code make it so a weapon/armor come w/ the augment attached or simply grants it the effects of the augment?

Also, what would be the reverse of this function? (I'm looking for the code that tells it to remove an augment as well)
ItemManager.applyAugmentEffects(item, augment, slot, true/false);
So it adds the augment to a slot.

Reverse is just to use the same code in <Augment Detach Eval: augment> but replace "+=" with "-="

Also, if your item has negative values you can use if (item.params[x] >= 0) {code}; to make sure they don't increase negatives.
: )
 

Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,129
Reaction score
815
First Language
English
Primarily Uses
RMMV
Sorry, I'm having trouble wrapping my head around the syntax...

<Augment Detach Eval: Arrow>
ItemManager.applyAugmentEffects(item, augment, slot, true/false);
</Augment Detach Eval: Arrow>

What do I put for augment if I simply want it to reference the currently selected augment in question?

What is the true/false for?

Also, I don't see a "+=" anywhere to replace... I think there was some confusion, by reverse I meant destroying/discarding the augment when you detach it (the opposite of adding an augment).

Thx, in advance!

Edit: Nvm, just realized I probably have to utilize some code from YEP_X_ItemDiscard...
 
Last edited:

Calluses

Bee
Veteran
Joined
Mar 17, 2019
Messages
36
Reaction score
57
First Language
English
Primarily Uses
RMMV
Sorry, I'm having trouble wrapping my head around the syntax...
Just replace at true/false with "1", I'm not sure it matters too much. For augment, you either have to do a variable or a direct number reference. Also, all of this isn't in Detach or Attach, this is <On Creation Eval>. The rest of the code is in the spoilers of the thread's first post, and that's where you'll also find the "+=" and the Attach / Detach that i'm talking about.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Ami
--- Diary ---

M.Mage: It's the F.Mage's Diary. While she isn't here,i can read it.

May, 10: I'm hurt after the battle with the Minotaur. But luckily,F.Healer heal me with her Heal-2. That why,i Fall in Love with her.

M.Mage: Eh???
So... some of my Desktop hardware has kicked it apparently (still trying to figure out what and how at the moment :/ ) .... yay?
Stream will be live shortly with some Darkest Dungeon! Feel free to drop by!
Made a HUGE (YYOOOOJJ) Update to Monstructs and moving towards a Steam Early Access release!

Forum statistics

Threads
104,225
Messages
1,004,810
Members
135,740
Latest member
Animalblack
Top