[SOLVED]Yanfly's Attachable Augments: Add extra slots to Weapons

Discussion in 'Javascript/Plugin Support' started by SmashArtist, Apr 26, 2019.

Thread Status:
Not open for further replies.
  1. SmashArtist

    SmashArtist Lazy Artist Veteran

    Messages:
    556
    Likes Received:
    1,004
    First Language:
    English
    Primarily Uses:
    RMMV
    Hello!
    I've been using Yanfly's Attachable Augments plugin and I wanted to be able to create upgrades to my characters' weapons through quests/story which would unlock extra augment slots to their weapons, however I came to realize that there was no direct way without scripting to add extra slots.
    I'm definitely no programmer, and I couldn't find an answer through searching online, so I decided I'd ask you guys.
    What would be ideal is having a single script call which would add a specific extra slot to a weapon. Of course, it would have to keep previous attached augments as well.
    If anyone could help it'd be most appreciated!

    EDIT:
    Someone PM'd me about this problem, and they brought up a couple of things, so I thought I'd try making it more clear why and how I'd like this:

    WHY:
    1. My actors each have only 1 weapon each, they do not receive duplicates
    2. I want to keep the augments I have already attached on the weapons, so I cannot just create a duplicate of the weapons but with more slots, since this will cause the attached augments to be lost
    HOW:
    1. I'd like the slot to be added through a script call so I can add it through eventing (after main story points or quests)
    2. This script call can effect all of one type of weapon(for example all of "Sword 1", since there will be no duplicates and therefore there is no need to specify the current equipped weapon)
     
    Last edited: Apr 28, 2019
    #1
  2. Maliki79

    Maliki79 Veteran Veteran

    Messages:
    625
    Likes Received:
    233
    Location:
    New Jersey
    First Language:
    English
    Primarily Uses:
    N/A
    By far, the easiest way to do this is via an Augment item.
    Simply create an item and add this to it's notes:

    <Upgrade Effect>
    Slots: 0;
    Eval: item.upgradeSlots += 1;
    </Upgrade Effect>

    This will boost the available slots on that item by 1.
    Of course, you can change the 1 to whatever you need.
     
    #2
  3. SmashArtist

    SmashArtist Lazy Artist Veteran

    Messages:
    556
    Likes Received:
    1,004
    First Language:
    English
    Primarily Uses:
    RMMV
    I'm unable to test this now, does it work with the "Attachable Augments" plugin? It seems this is for the "Item Upgrade Slots" plugin, which is not the same. :/
     
    #3
  4. Maliki79

    Maliki79 Veteran Veteran

    Messages:
    625
    Likes Received:
    233
    Location:
    New Jersey
    First Language:
    English
    Primarily Uses:
    N/A
    Ah yes. You are right. I'll have to look into it more for you.

    Edit: Looks like a plugin addon may be needed.
    I'll see if I can find time to put it together.

    Edit2: So it seems I was half right with my original answer.
    So, a way to increase Augment Slots is fairly easy and CAN be done in a single script call.
    Namely:
    obj.augmentSlots.push("slotNameHereWithinQuotes");
    Doing this will put whatever slot you specify by name at the end of that particular equip's
    Augment list.

    The problem is how you specify which item is the object being worked on.
    (My first answer happens to do this already, but if you aren't using Upgrade slots, you'll have to find another way to select an item.)
     
    Last edited: Apr 27, 2019
    #4
    SmashArtist likes this.
  5. SmashArtist

    SmashArtist Lazy Artist Veteran

    Messages:
    556
    Likes Received:
    1,004
    First Language:
    English
    Primarily Uses:
    RMMV
    @Maliki79 Sorry for the late reply, didn't see your edits! :kaoswt2:
    I ended up updating the main post before noticing your edits, but basically: there are no duplicates of any weapons in my game- each actor only has one weapon for the entirety of the game that they cannot remove.
    So all I need is a script call that effects one weapon, but not necessarily a specific item duplicate of the item, the script call could just effect all weapons that are weapon #001"Sword".
    Hope this helps!:kaohi:
     
    #5
  6. Maliki79

    Maliki79 Veteran Veteran

    Messages:
    625
    Likes Received:
    233
    Location:
    New Jersey
    First Language:
    English
    Primarily Uses:
    N/A
    Ok. So if your actors will never change weapon equips and they are ALWAYS in their first equip slot, you can use this script call in an event:

    $gameParty.members()[x].equips()[0].augmentSlots.push("slotNameHereWithinQuotes");

    with x being the party memeber's slot Id. (0 is the topmost party member on the menu screen.)
    And as an aside, this will only ADD to the slots.
    You cannot remove the slots as easily (although it is possible to do.)
     
    #6
    SmashArtist likes this.
  7. SmashArtist

    SmashArtist Lazy Artist Veteran

    Messages:
    556
    Likes Received:
    1,004
    First Language:
    English
    Primarily Uses:
    RMMV
    This works perfectly!
    There should be no reason for me to need to remove slots, so it's fine.

    Just one more thing, would it be possible to specify a specific actor instead of a party slot or not?
    If not, that's fine, just means I'll need to add a couple of conditional branches.

    Seriously, thank you for this- this mechanic was an important part of the game and gives the weapons more value. :kaoblush:
     
    #7
  8. Maliki79

    Maliki79 Veteran Veteran

    Messages:
    625
    Likes Received:
    233
    Location:
    New Jersey
    First Language:
    English
    Primarily Uses:
    N/A
    $gameActors.actor(x).equips()[0].augmentSlots.push("slotNameHereWithinQuotes");
    with x being the actorId of the actor you want.
     
    #8
    SmashArtist likes this.
  9. SmashArtist

    SmashArtist Lazy Artist Veteran

    Messages:
    556
    Likes Received:
    1,004
    First Language:
    English
    Primarily Uses:
    RMMV
    Big thanks on this! Works like a charm!
    You will definitely be mentioned in the game's credits! :kaopride:
     
    #9
  10. Maliki79

    Maliki79 Veteran Veteran

    Messages:
    625
    Likes Received:
    233
    Location:
    New Jersey
    First Language:
    English
    Primarily Uses:
    N/A
    Much appreciated.
     
    #10
  11. hiddenone

    hiddenone Lurker Extraordinaire Moderator

    Messages:
    1,801
    Likes Received:
    4,444
    First Language:
    english
    Primarily Uses:
    RMMV

    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.

     
    #11
Thread Status:
Not open for further replies.

Share This Page