Trouble with creating a class trait.

Discussion in 'Javascript/Plugin Support' started by DMJohn0X, Oct 12, 2019.

  1. DMJohn0X

    DMJohn0X Villager Member

    Messages:
    24
    Likes Received:
    3
    First Language:
    English
    So I now have 2 states.
    One is called Vampirism and the other is Necrotic.

    I want Necrotic to be on at the start of battle so long as hp is .3 of mhp, else I want Vampirism on.

    The code I tried (which doesnt work) is:

    <Custom Passive Condition>
    if (user.hp / user.mhp <= 0.3) {
    condition = true;
    <Passive State: Vampirism>
    } else {
    condition = false;
    <Passive State: Necrotic> }
    </Custom Passive Condition>


    Bit of a nub here. anyone got any tips?
     
    #1
  2. Oddball

    Oddball Veteran Veteran

    Messages:
    1,545
    Likes Received:
    390
    First Language:
    English
    Primarily Uses:
    N/A
    You can do this with eventing. I'll tinker with battle events then show you how and edit it into this post

    Edit: Now, i don't know the proper script command to get current HP, but otherwise, the event would look like this. You just need a way to get current HP as opposed to MaxHP, and your golden with this

    Edit: The condition needs to be turn 0. Forgot to add that

    Nectortic vampirism.png
     
    Last edited: Oct 12, 2019
    #2
    DMJohn0X likes this.
  3. DMJohn0X

    DMJohn0X Villager Member

    Messages:
    24
    Likes Received:
    3
    First Language:
    English
    Thats for an enemy though. I want to add this to a player class that activates automatically in combat.
     
    #3
  4. Oddball

    Oddball Veteran Veteran

    Messages:
    1,545
    Likes Received:
    390
    First Language:
    English
    Primarily Uses:
    N/A
    Did you try it out? "Example person" in the event page is an actor
     
    #4
  5. DMJohn0X

    DMJohn0X Villager Member

    Messages:
    24
    Likes Received:
    3
    First Language:
    English
    I managed to get this solved with some help from discord peeps on the rpgmaker.net discord. Everything works great except one glaring problem. My character is still taking damage on the overworld map. Is there a way with YEP_AutoPassiveStates to only turn on states in battle?


    Edit: Problem is now solved thanks to Madame Delsin Tenkosheep over on RPGMaker net discord.


    First, we had to add this code to YEP_Z_PassiveCases so that the plugin would be able to check if party was in battle:

    } else if (data.match(/IN[ ]BATTLE/i)) {
    if ($gameParty.inBattle()){ condition = true; }
    else { condition = false; }

    Then Finally my Necrotic state was coded like this:

    <Passive Condition Cases>
    HP% >= 30
    IN BATTLE
    </Passive Condition Cases>
     
    Last edited: Oct 13, 2019
    #5

Share This Page