Can't make a item that gives user Exp

Discussion in 'RPG Maker MV' started by Animebryan, Apr 28, 2019.

  1. Animebryan

    Animebryan Feels like I'm slowly dying! Veteran

    Messages:
    337
    Likes Received:
    154
    Location:
    Marysville, CA
    First Language:
    English
    Primarily Uses:
    RMMV
    I'm trying to make items that gives the user Exp, but it seems impossible by default. I tried using a common event using the Change EXP option but there's no way to apply the effect directly to the user & there's no option to target the user by default. The only way I see to get around this without a plugin would be to use a script call to either directly give the user Exp or to detect the user's Actor ID & store that in a variable.

    Does anyone know if such a script call exists?
     
    #1
  2. Poryg

    Poryg Dark Lord of the Castle of Javascreeps Veteran

    Messages:
    3,922
    Likes Received:
    9,906
    Location:
    Czech Republic
    First Language:
    Czech
    Primarily Uses:
    RMMV
    What about damage formula? a.gainExp(30); or something, not sure now what is the exact method as I don't have the script with me (although can be found inside the core scripts)

    Then just add ;0; to make sure the eval returns 0 and doesn't heal your character.
     
    #2
  3. Andar

    Andar Veteran Veteran

    Messages:
    28,419
    Likes Received:
    6,485
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    or you could do what others do when needing to target an skill-event on an actor:
    have the skill add an invisible and useless state to the user, and then use conditional branches to check which actor got the state. It's a bit more complicated than the solution above (it needs one conditional branch per actor), but it works even when the effect doesn't fit into the damage formula.
     
    #3
  4. Silva

    Silva Scoobityboo Veteran

    Messages:
    289
    Likes Received:
    139
    First Language:
    English
    Primarily Uses:
    RMMV
    a.gainExp(x) is the correct method.

    If you're looking to pass information about the user or target to a common event from a skill you can assign their id to a variable using the damage formula as well, then you can just use event commands by designating with said variable.

    Code:
    $gameVariables.setValue(x, a.actorId())
    Replace x with the variable id you want to use.

    This avoids the need for any conditional branches.
     
    #4

Share This Page