Changing classes based on an item

Discussion in 'RPG Maker MV' started by justalazygamer, Jun 20, 2017.

  1. justalazygamer

    justalazygamer Villager Member

    Messages:
    9
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    I am new to RPG Maker so I am still trying to get a handle on some things.

    I created an event with conditional branches which correctly changes classes based on the equipped item. I currently have that event being called in "rpg_scenes" on all equipment changes using "$gameTemp.reserveCommonEvent(1);" which does not run the event while a menu is open.

    Is there an easy way for the equipment menu to still be open after the event runs so values are all updated? I thought I might be able to force it with the SceneManager to go to map then to previous scene quickly but even that did not work.
     
    #1
  2. justalazygamer

    justalazygamer Villager Member

    Messages:
    9
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    if(this.actor().equips()[5] == null){ //default
    this.actor().changeClass(5, true);
    }
    else{
    if(this.actor().equips()[5].id == 5){//hero
    this.actor().changeClass(1, true);
    }
    if(this.actor().equips()[5].id == 6){//warrior
    this.actor().changeClass(2, true);
    }
    }

    Working with it I was able to figure out class change with equipment that works in the menu. My new problem is that I can't seem to find a way to keep HP and MP from going to the max after the class change instead of staying at the previous value.
     
    Last edited: Jun 20, 2017
    #2
  3. Zarsla

    Zarsla Veteran Veteran

    Messages:
    688
    Likes Received:
    201
    First Language:
    English
    var currentHP = this.actor().hp;
    var currentMP = this.actor().mp;
    you're code
    this.actor().setHp(currentHP);
    this.actor().setMp(currentMP);
     
    #3
  4. justalazygamer

    justalazygamer Villager Member

    Messages:
    9
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    This is still keeping their hp at max after the class change.
     
    #4
  5. Zarsla

    Zarsla Veteran Veteran

    Messages:
    688
    Likes Received:
    201
    First Language:
    English
    so you did this?

    var currentHP = this.actor().hp;
    var currentMP = this.actor().mp;
    if(this.actor().equips()[5] == null){ //default
    this.actor().changeClass(5, true);
    }
    else{
    if(this.actor().equips()[5].id == 5){//hero
    this.actor().changeClass(1, true);
    }
    if(this.actor().equips()[5].id == 6){//warrior
    this.actor().changeClass(2, true);
    }
    }

    this.actor().setHp(currentHP);
    this.actor().setMp(currentMP);
     
    #5
  6. justalazygamer

    justalazygamer Villager Member

    Messages:
    9
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    I found the problem appears to be related to the yanfly equip plugin I was using to make the equip menu look better. I will have to dive into that when I get the chance to find the cause.

    Thank you for your help.
     
    #6
  7. Zarsla

    Zarsla Veteran Veteran

    Messages:
    688
    Likes Received:
    201
    First Language:
    English
    Happy to Help :)
     
    #7

Share This Page