Help with Yanfly's Attachable Augments (States and Element script calls)

Discussion in 'Javascript/Plugin Support' started by CrappyName, Mar 31, 2017.

  1. CrappyName

    CrappyName Villager Member

    Messages:
    25
    Likes Received:
    2
    First Language:
    English
    Hi! I have a question that might be a little difficult... I'm using Yanfly's Attachable Augments script and I got inspired by his duplicity augments tips and tricks. I'm wondering if I can do this idea with states and elements.

    Here's what would happen:

    attach Fire Orb on a weapon: add Fire as an attack element
    attach Fire Orb on an armor: Become immune to Fire damage

    Or:

    attach Poison Orb on a weapon: add Poison as an attack state (50% chance or something)
    attach Poison Orb on an armor: Become immune to Poison state

    I know I can use Yanfly's note tags to do these things but not with the duplicity augments way. I really like the offense or defense choice it makes the player make. This is what I've tried so far and of course, it failed:

    Element:

    <Augment Attach Eval: Orb>
    if (DataManager.isWeapon(item)) {
    item.attackElements(2);
    } else {
    item.ElementRate(2) -= 1;
    }
    </Augment Attach Eval: Orb>

    <Augment Detach Eval: Rune>
    if (DataManager.isWeapon(item)) {
    item.attackElements(2).remove;
    } else {
    item.ElementRate(2) += 1;
    }
    </Augment Detach Eval: Rune>

    State:

    <Augment Attach Eval: Orb>
    if (DataManager.isWeapon(item)) {
    item.attackStatesRate(4) += 0.5;
    } else {
    item.stateRate(4) -= 1;
    }
    </Augment Attach Eval: Rune>

    <Augment Detach Eval: Orb>
    if (DataManager.isWeapon(item)) {
    item.attackStatesRate(4) -= 0.5;
    } else {
    item.stateRate(4) += 1;
    }
    </Augment Detach Eval: Rune>

    Is my idea even possible? Anyone know how to do this? Thanks for any help!!!
     
    #1
  2. shockra

    shockra Slightly Crazy Programmer Veteran

    Messages:
    394
    Likes Received:
    166
    Location:
    US
    First Language:
    English
    Primarily Uses:
    RMMV
    The first problem I see is that you're mixing and matching your terms. You're using the Orb and Rune terms as if they're interchangeable, but for this to work, you need to use either all Orb or all Rune, depending on your augment item. Start by fixing that, and see what happens then.
     
    #2
  3. CrappyName

    CrappyName Villager Member

    Messages:
    25
    Likes Received:
    2
    First Language:
    English
    I fixed that and it still doesn't work. Thanks for catching that though!
     
    #3
  4. falken14

    falken14 Veteran Veteran

    Messages:
    38
    Likes Received:
    11
    First Language:
    English
    Wow, I was literally about to make a thread on just this topic. I hope you can get some assistance on this, I've tried and failed as well. It seems such a natural usage of the plugin and less clunky than making separate categories of augments for weapons and armour.
     
    #4
  5. Knightmare

    Knightmare Knight of the Night Veteran

    Messages:
    1,057
    Likes Received:
    107
    Location:
    Central USA
    First Language:
    English
    Primarily Uses:
    RMMV
    Maybe try these...I have no idea but it's worth a try.

    Element:

    <Augment Attach Eval: Orb>
    if (DataManager.isWeapon(item)) {
    item.attackElement(2);
    } else {
    item.ElementRate(2) -= 1;
    }
    </Augment Attach Eval: Orb>

    <Augment Detach Eval: Orb>
    if (DataManager.isWeapon(item)) {
    item.attackElement(2).remove;
    } else {
    item.ElementRate(2) += 1;
    }
    </Augment Detach Eval: Orb>

    State:

    <Augment Attach Eval: Orb>
    if (DataManager.isWeapon(item)) {
    item.attackStateRate(4) += 0.5;
    } else {
    item.stateRate(4) -= 1;
    }
    </Augment Attach Eval: Orb>

    <Augment Detach Eval: Orb>
    if (DataManager.isWeapon(item)) {
    item.attackStateRate(4) -= 0.5;
    } else {
    item.stateRate(4) += 1;
    }
    </Augment Detach Eval: Orb>

    I mainly just made sure the Evals matched to Orb (which I know you said you tried but just to have that part be correct, I then got rid of the plurals in your item.attackStatesRate and attackElementsRate. I'm probably wrong but for some reason I don't think it's supposed to be plural. If it doesn't work I too would like to know how to do it.
     
    #5
  6. falken14

    falken14 Veteran Veteran

    Messages:
    38
    Likes Received:
    11
    First Language:
    English
    I don't think it worked for me :frown:. It seems like it should be a simple if/else statement. Hopefully someone can crack it, it would be a really handy option.
     
    #6
  7. shockra

    shockra Slightly Crazy Programmer Veteran

    Messages:
    394
    Likes Received:
    166
    Location:
    US
    First Language:
    English
    Primarily Uses:
    RMMV
    This is gonna annoy me if I can't figure it out. I think that we need to look at the code directly and see if we can determine where and how the equipment is handled, because that's the part we need.

    Edit: I think I have something. Try this:

    Element:

    <Augment Attach Eval: Orb>
    var text = '';
    if (DataManager.isWeapon(item)) {
    text += '2';
    ItemManager.applyAugmentAttackElement(item, text, true);
    } else {
    text += '2, 50%';
    ItemManager.applyAugmentElement(item, text, true);
    }
    </Augment Attach Eval: Orb>

    <Augment Detach Eval: Orb>
    var text = '';
    if (DataManager.isWeapon(item)) {
    text += '2';
    ItemManager.applyAugmentAttackElement(item, text, false);
    } else {
    text += '2, 50%';
    ItemManager.applyAugmentElement(item, text, false);
    }
    </Augment Detach Eval: Orb>

    State:

    <Augment Attach Eval: Orb>
    var text = '';
    if (DataManager.isWeapon(item)) {
    text += '4, 50%';
    ItemManager.applyAugmentAttackState(item, text, true);
    } else {
    text += '4';
    ItemManager.applyAugmentStateResist(item, text, true);
    }
    </Augment Attach Eval: Orb>

    <Augment Detach Eval: Orb>
    var text = '';
    if (DataManager.isWeapon(item)) {
    text += '4, 50%';
    ItemManager.applyAugmentAttackState(item, text, false);
    } else {
    text += '4';
    ItemManager.applyAugmentStateResist(item, text, false);
    }
    </Augment Detach Eval: Orb>

    Some of the text numbers may need changed for your purposes, but try that and see if it works.
     
    Last edited: Apr 5, 2017
    #7
  8. falken14

    falken14 Veteran Veteran

    Messages:
    38
    Likes Received:
    11
    First Language:
    English
    As far as I can tell, they both work well. Haven't tested every situation so I'll wait for others to confirm. Thanks a lot!
     
    #8
  9. Knightmare

    Knightmare Knight of the Night Veteran

    Messages:
    1,057
    Likes Received:
    107
    Location:
    Central USA
    First Language:
    English
    Primarily Uses:
    RMMV
    Can confirm. Tested Shockra's code, seems to check out. Thank you Shockra.
     
    #9
  10. CrappyName

    CrappyName Villager Member

    Messages:
    25
    Likes Received:
    2
    First Language:
    English
    I tested it too. Looks like it all works. Thanks a bunch Shockra! This is great.
     
    #10

Share This Page