Yanfly JP - Lose JP based on variable

Discussion in 'Javascript/Plugin Support' started by dragonx777, Mar 21, 2018.

  1. dragonx777

    dragonx777 Veteran Veteran

    Messages:
    61
    Likes Received:
    5
    Location:
    SC
    First Language:
    English
    Primarily Uses:
    RMMV
    So I'm trying to create a system where JP can be used to gain experience based on the number input (set to a variable). The issue is I am unable to get the plugin command loseJP to work with a variable. Is there any way this can be done?

    http://yanfly.moe/2015/11/13/yep-27-job-points/
     
    #1
  2. shockra

    shockra Slightly Crazy Programmer Veteran

    Messages:
    355
    Likes Received:
    135
    Location:
    US
    First Language:
    English
    Primarily Uses:
    RMMV
    Assuming that ClassID isn't important, there's a script that may be more ideal for this. Before I can give an exact function, I need to know more about how the system is supposed to work. Is the experience gained through a skill? An event?
     
    #2
  3. dragonx777

    dragonx777 Veteran Veteran

    Messages:
    61
    Likes Received:
    5
    Location:
    SC
    First Language:
    English
    Primarily Uses:
    RMMV
    The XP gain is via event. I use a number input to set the JP to XP value, check the current JP via script call (which works), but unable to subtract the JP to XP variable from the actor's JP.

    upload_2018-3-20_12-26-37.png

    upload_2018-3-20_12-29-44.png
     
    #3
  4. shockra

    shockra Slightly Crazy Programmer Veteran

    Messages:
    355
    Likes Received:
    135
    Location:
    US
    First Language:
    English
    Primarily Uses:
    RMMV
    Two possible reasons that this could be happening.

    First, I don't think the plugin command can discern uppercase from lowercase. The loseJP should be loseJp, which a lowercase p. If that doesn't work, try the second option below.

    Second, the plugin reader may not be able to read \v[15] in the plugin command. Replace that with $gameVariables.value(15)

    If neither of those work, you may need the script call itself. The basic function is $gameActors.actor(actorID).loseJp(value, classID);
     
    #4
  5. dragonx777

    dragonx777 Veteran Veteran

    Messages:
    61
    Likes Received:
    5
    Location:
    SC
    First Language:
    English
    Primarily Uses:
    RMMV
    $gameActors.actor(1).loseJp($gameVariables.value(15), 1); worked perfectly. Thanks much!

    Mods: you may close this thread as it is resolved.
     
    #5

Share This Page