Yanfly's Attachable Augments Questions

Status
Not open for further replies.

Yawgmoth

Veteran
Veteran
Joined
Jan 9, 2018
Messages
114
Reaction score
10
First Language
English
Primarily Uses
RMMV
Hi all, I'm using Yanfly's Attachable Augments Plugin along with Yanfly's Equip Core. I was wondering if there was a way using the augments to change a weapon's type to another specific weapon type.

EX: Lets say you have an Axe but your rogue can't use it he only uses daggers. You now have a special rune that turns other weapons into daggers when it is socketed. It's a fun idea. I think this may be possible via script but I lack the knowledge.

If this is impossible I would like to know if there is anyway to use Yanfly's Equip Core which allows you to place class restrictions on items, weapons, and armor to place such limitations on an augmented item when it becomes augmented?

Any answer would be great, thanks to those who took the time to read this and bigger thanks to any who respond.
 

Silenity

Veteran
Veteran
Joined
Dec 17, 2013
Messages
649
Reaction score
242
First Language
English
Primarily Uses
RMMV
<Augment Attach: type>
Add Passive State: x
</Augment Attach: type>

Make state with a trait that allows them to equip whatever weapon type you want.

EDIT:
Wait I misread the question.

The above answer is wrong. I'll keep looking.
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
568
Reaction score
319
First Language
English
Primarily Uses
RMMV
Try this one. Change type to the type of augment, change the number 2 to whatever weapon type your dagger is.
Code:
<Augment Attach Eval: type>
 item.wtypeId = 2
</Augment Attach Eval: type>
 

Yawgmoth

Veteran
Veteran
Joined
Jan 9, 2018
Messages
114
Reaction score
10
First Language
English
Primarily Uses
RMMV
Thanks for all the quick reply's!

@ramza I tried the code, I typed it in as a notetag. I can equip the augment but the weapon still is not able to be equipped by the class. I changed "type" to the appropriate socket and altered the weapon type ID too. Anymore ideas?

Also any ideas on adding restrictions such as level and class to weapons and armor after an augment is applied?

Thanks for all your efforts.
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
568
Reaction score
319
First Language
English
Primarily Uses
RMMV
Thanks for all the quick reply's!

@ramza I tried the code, I typed it in as a notetag. I can equip the augment but the weapon still is not able to be equipped by the class. I changed "type" to the appropriate socket and altered the weapon type ID too. Anymore ideas?

Also any ideas on adding restrictions such as level and class to weapons and armor after an augment is applied?

Thanks for all your efforts.
I have taken the time to test the note tags I gave you, and they work perfectly.

For testing, I used the following tag on the augment item:
Code:
<Augment Attach Eval: Glyph>
 item._oldType = item.wtypeId
 item.wtypeId = 1
</Augment Attach Eval: Glyph>
<Augment Detach Eval: Glyph>
 item.wtypeId = item._oldType
 item._oldType = undefined
</Augment Detach Eval: Glyph>
This makes it so that when placed into a 'Glyph' slot on a weapon, it saves the old type, and then changes the weapon to type 1, which is dagger. If you augment the weapon while it's equipped, it is immediately removed (as Harold can't use daggers). The detach eval is used to return it to being it's original wType if the augment is removed, which also works.

Keep in mind that these things may not always function on an old save game. Sometimes note tags don't always update from old saves, resulting in it appearing that they don't work. Always test from a new save.

Before augment:
Before augment.png
After augment:
After augment.png

Harold is no longer able to equip the sword item again until the augment is removed, returning it to the sword type.
 

Yawgmoth

Veteran
Veteran
Joined
Jan 9, 2018
Messages
114
Reaction score
10
First Language
English
Primarily Uses
RMMV
@ramza Thanks so much I got it to work! My problem was I had copied and pasted only a partial amount of my augments name. I was so busy making sure I had copied your code exactly I had missed making sure my note tag was correct. Thank you for being so patient.

Any ideas on adding requirements such as level or class via augments?
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
568
Reaction score
319
First Language
English
Primarily Uses
RMMV
@Yawgmoth For those you could use the same sort of setup to change some equipment requirement information on the weapon via functions added by Yanfly's Equip Requirements plugin.

Looks like changing item.equipRequirements.atLeast[8] will set a minimum level requirement, and pushing a required class to item.equipRequirements.classes would add a class requirement.

So something like this:

Code:
<Augment Attach Eval: Glyph>
 item.equipRequirements.atLeast[8] += 3
</Augment Attach Eval: Glyph>
Would add 3 to the level requirement of the item, and something like this:

Code:
<Augment Attach Eval: Glyph>
 item.equipRequirements.classes.push(3)
</Augment Attach Eval: Glyph>
Should make it so that someone would need to belong to classId 3 to be able to equip the item.

Naturally you'd need to undo these changes on detach note tags as well, so the item could return to normal.

Note I haven't tested these ones, but they should work based on what I see in the plugin.
 

Yawgmoth

Veteran
Veteran
Joined
Jan 9, 2018
Messages
114
Reaction score
10
First Language
English
Primarily Uses
RMMV
@ramza these look like they should work, I will hopefully test them sometime this weekend. Thank you for all the help!

Also all my augments are interchangeable between weapons and armors and because of it I have came across a similar issue with my dagger augment above and wish to disallow it from being used on an armor. What would that piece of code look like for armors and weapons? I assume it should be similar to your possible solutions above?

EDIT: I tested both of your codes from above and When you select the augment it now asks you to select an actor and it makes the buzz sound on the actors if they meet the conditions without anything happening and without the augment being used. I think you are close, I think it is checking the actors before the augment is placed and we want the restrictions applied to the armor or weapon after the augment has been used, along with equipping the weapon or armor if the actor does not meet the requirement. I think that portion would be automatic though.

I am more concerned about restricting augments to specific types of equipment though, as the level and class restrictions would just be nice to have but my project needs a way of distinguishing armor and weapons when augmenting.
 
Last edited:

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
568
Reaction score
319
First Language
English
Primarily Uses
RMMV
I'm not sure why it would be showing an actor select screen. I don't actually have much work with the augment plugin, but it sounds like you're using the item from the items menu instead of by going to the weapon/armor in the item/equip menu and attaching the augment from there. This sort of behavior would probably happen if you had a usable item that had no effect on it, and tried to use it on an actor... I think anyway. The scene I screenshotted earlier is the item scene, but I tested it by going to the weapons section, not by using the augment item.

You're in luck for the other thing though, as I've actually engineered a real janky solution to a similar problem I was having in my own project, where I had an augment that could be applied to all armors, but provided a stat boost to block chance, which meant it should only ever be put on a shield. I used the following code for that:

Code:
Window_AugmentItemList.prototype.includes = function(item) {
    if (!item) return false;
    if (DataManager.isIndependent(item)) return false;
    if (!this.containsType(item)) return false;
    if (item.meta.SHIELDONLY == true && this._item.etypeId != 2) return false;
    return true;
};
The last if check is checking a line I put in the note tags of the augment item itself, indicating that it is shield only. It checks if this._item (which is the item being augmented) is of etypeId 2, which is my shield type, and returns false if it isn't a shield, hiding this augment from the list of augments usable on the non-shield.

You can use a tag on augments in the same way, and use a check against either etypeId == 1 (which is weapon by default), or etypeId != 1 (which would be every other type of armor).

This types are listed in the database on the types tab under the equipment types heading, btw.
 

Yawgmoth

Veteran
Veteran
Joined
Jan 9, 2018
Messages
114
Reaction score
10
First Language
English
Primarily Uses
RMMV
@ramza Your correct I was using the augment from the item menu but had done so with all my augments, your solution does work from the weapon menu, just strange I can use other augments from item menu.

As for your code I must be doing something wrong because when I go to the armor menu it still allows be to select the augment which sounded like it should be hidden? Anyways it allows me to select it. The code I am using is as follows:

Code:
Window_AugmentItemList.prototype.includes = function(item) {
if (!item) return false;
if (DataManager.isIndependent(item)) return false;
if (!this.containsType(item)) return false;
if (item.meta.WEAPONONLY == true && this._item.etypeId == 1) return false;
return true;
};
};
Did I type something wrong into the code?

As always thanks for all the help I really appreciate it.
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
568
Reaction score
319
First Language
English
Primarily Uses
RMMV
@ramza Your correct I was using the augment from the item menu but had done so with all my augments, your solution does work from the weapon menu, just strange I can use other augments from item menu.

As for your code I must be doing something wrong because when I go to the armor menu it still allows be to select the augment which sounded like it should be hidden? Anyways it allows me to select it. The code I am using is as follows:

Code:
Window_AugmentItemList.prototype.includes = function(item) {
if (!item) return false;
if (DataManager.isIndependent(item)) return false;
if (!this.containsType(item)) return false;
if (item.meta.WEAPONONLY == true && this._item.etypeId == 1) return false;
return true;
};
};
Did I type something wrong into the code?

As always thanks for all the help I really appreciate it.
Looks like I forgot to mention it in my post, but that item.meta line is actually a really basic note tag reader. In order for it to hide the augment, you need to put a note tag on the augment item in the notebox that matches the capitalized section <WEAPONONLY>.
 

Yawgmoth

Veteran
Veteran
Joined
Jan 9, 2018
Messages
114
Reaction score
10
First Language
English
Primarily Uses
RMMV
@ramza I tried the copied and pasted the <WEAPONONLY> notetag and put it into the augment item's notebox. It doesn't seem to do anything. It still allows me to place the augment onto an armor. Anything else we may be forgetting?
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
568
Reaction score
319
First Language
English
Primarily Uses
RMMV
Did you import that code posted as a plugin into your plugin manager?
 

Yawgmoth

Veteran
Veteran
Joined
Jan 9, 2018
Messages
114
Reaction score
10
First Language
English
Primarily Uses
RMMV
No I put that code in the notetag. One sec. Ill try that.

EDIT: OK, so I copied the above code and put it into notepad and saved the file as AugmentRestriction.js and placed it in the plugin folder for my project and turned the plugin on. I tried the augment again and it still does not work. I suspect that I have done something wrong but not sure what.
 
Last edited:

Yawgmoth

Veteran
Veteran
Joined
Jan 9, 2018
Messages
114
Reaction score
10
First Language
English
Primarily Uses
RMMV
@ramza I know you are probably busy but any help is always appreciated. I'm still trying to get the code you gave me to work. This is what I have set up in my plugin folder. Is everything correct? If not what can I do try now? Thanks for your time.

Code:
//=============================================================================
// AugmentRestriction.js
//=============================================================================
/*:
 * @plugindesc A plugin that works with Yanfly's Augment plugin, this plugin adds restrictions via notetags that prevent augments from being used on armors or weapons.
 *
 * @author
 *
 * @help
 *
 *  <WEAPONONLY> and <ARMORONLY>
 *
 * TERMS OF USE
 *
 *
 * COMPATIBILITY
 *
 */
 
Window_AugmentItemList.prototype.includes = function(item) {
    if (!item) return false;
    if (DataManager.isIndependent(item)) return false;
    if (!this.containsType(item)) return false;
    if (item.meta.WEAPONONLY == true && this._item.etypeId == 1) return false;
    return true;
};

Window_AugmentItemList.prototype.includes = function(item) {
    if (!item) return false;
    if (DataManager.isIndependent(item)) return false;
    if (!this.containsType(item)) return false;
    if (item.meta.ARMORONLY == true && this._item.etypeId == 4) return false;
    return true;
};

})();
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
568
Reaction score
319
First Language
English
Primarily Uses
RMMV
@Yawgmoth I'm not sure what I can tell you here. The code I gave works in my own project specifically for shields. I just retested to make sure I wasn't going crazy and it works.

One thing that is a problem is that you're overwriting your own changes with the second function. You should combine them into one.

Code:
Window_AugmentItemList.prototype.includes = function(item) {
    if (!item) return false;
    if (DataManager.isIndependent(item)) return false;
    if (!this.containsType(item)) return false;
    if (item.meta.WEAPONONLY == true && this._item.etypeId == 1) return false;
    if (item.meta.ARMORONLY == true && this._item.etypeId == 4) return false;
    return true;
};
The other thing is that the way you have the armor only tag written implies you only have one type of equipment that is armor, so the augment will only ever go on that one equipment type. I'm not sure if that was deliberate or not, but I'd change the '== 4' to '!= 1' on that line, so the augment will slot in anything that isn't a weapon.

You mentioned already that some of your augments can be used directly from the item menu and they work. I'm not sure how you managed that, as none of my augment items can be used at all. But as noted with the one that changed the level requirement before, it's possible that using it from the item menu instead of from the augment command window from a weapon/armor is messing with it too.

The only other thing I can come up with is to ensure that this plugin file is loaded below the attachable augments plugin on your plugin list. We're overwriting functions in the original plugin, so it needs to load after it, or there will be no changes.

Edit:
Okay I figured out that your augments have a scope set, either to ally, or self, and an occasion set to 'menu' or 'always'. IMO you should change these to no scope, and 'never', to stop players from using them directly from the item menu.
 

Yawgmoth

Veteran
Veteran
Joined
Jan 9, 2018
Messages
114
Reaction score
10
First Language
English
Primarily Uses
RMMV
@ramza thanks for the reply

Okay I figured out that your augments have a scope set, either to ally, or self, and an occasion set to 'menu' or 'always'. IMO you should change these to no scope, and 'never', to stop players from using them directly from the item menu.
I took a look and you were correct. The augments I was testing and some of my other augments which were mostly copied and pasted and then altered had a scope set to ally and were usable from the menu. I have since altered all these augments as you suggested. I must of known this at one point and after my break from my project forgot.

So I now have the following code as a plugin listed below Yanfly's Augment Plugin:

Code:
Window_AugmentItemList.prototype.includes = function(item) {
Window_AugmentItemList.prototype.includes = function(item) {
    if (!item) return false;
    if (DataManager.isIndependent(item)) return false;
    if (!this.containsType(item)) return false;
    if (item.meta.WEAPONONLY == true && this._item.etypeId == 1) return false;
    if (item.meta.ARMORONLY == true && this._item.etypeId != 1) return false;
    return true;
};
};

The other thing is that the way you have the armor only tag written implies you only have one type of equipment that is armor, so the augment will only ever go on that one equipment type. I'm not sure if that was deliberate or not, but I'd change the '== 4' to '!= 1' on that line, so the augment will slot in anything that isn't a weapon.
This was my fault as I have added more equipment slots and armor is 4. I did not realize you could just do weapon or no weapon but it is preferable because of the simplicity. Now the plugin works but not as intended. My notetags are 'reversed'... <ARMORONLY> allows me to place the augment on weapons and <WEAPONONLY> allows it to only be placed on non weapons. I'm not sure why but this took me awhile to figure out. I wonder if this has been my problem since I started using the code you gave me? So now I have a functional code which is great but for the sake of curiosity I would like to know what I have done to cause the note tags to be wrong? Any ideas?

Thanks again for all your efforts and time.
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
568
Reaction score
319
First Language
English
Primarily Uses
RMMV
Ah, the logic was backwards. In my original code it checks for the SHIELD ONLY tag and returns false if the item isn't a shield. Looks like at some point back there we got it reversed. In the code you just posted, swapping WEAPONONLY and ARMORONLY should be all we need to do to fix that.
 

Yawgmoth

Veteran
Veteran
Joined
Jan 9, 2018
Messages
114
Reaction score
10
First Language
English
Primarily Uses
RMMV
Ok sounds like a simple fix. I'm not home atm. When I get home I'll try it out and let you know the results.

Thank you again for all the help.

EDIT: Just checked it with the new altered code. Everything works how it should! Thank you so much Ramza!

I will be closing this thread now.
 
Last edited:

Kes

Global Moderators
Global Mod
Joined
Aug 3, 2012
Messages
21,403
Reaction score
10,841
First Language
English
Primarily Uses
RMVXA

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

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

Latest Threads

Latest Profile Posts

I really need to stop thinking there are new freebies just because someone made a new post in the freebies subforum lol.
AND just like that..... I got STEAM DLC up and working! YES!
Game making is like a marathon, except the last 1/4 is more like sprint... a very long and intense sprint.
Finally got to finish the demo for my project!
Another week has gone by. Maybe you made changes to your project/s. Maybe you didn't. Nonetheless, THAT IS NO EXCUSE TO NOT BACK THEM UP O_O!

Forum statistics

Threads
93,440
Messages
912,433
Members
122,964
Latest member
AZAIKING
Top