Need help trouble shooting a romance system plugin

● ARCHIVED · READ-ONLY
Started by Snarkyfork 4 posts View original ↗
  1. I'm not sure this is the right place to post this, but out of all the choices this seemed the most appropriate. Not sure if anyone can even help with this issue but I'd like to ask anyway, just in case. I downloaded the Romance System plugin from MV-Tan's site here:

    https://rpgmakermv.co/resources/romance-system.1468/

    And even in a new game with no other plugins there arose a bug where the romance increase message keeps popping up when I switch maps and close the main menu. You can see it here in the top left corner of the screen.

    upload_2017-12-28_22-50-45.png
    Here is the exact event I used:

    upload_2017-12-28_22-50-2.png
    And here is the plugin code.

    Code
    /**
    * @file upp_charRomance.js
    * @author William TheUnproPro
    * @desc This plugin gives you the ability to gain romance points for NPCs.
    *
    * @copyright 2017 (C) William Ramsey, you have the right to use this commercially or
    * non-commercially in any RPG Maker MV project you see fit. There
    * is no fee for using it in a commercial game.
    */

    /*:
    * @plugindesc v 1.0 | Character Romance System
    * @author William TheUnproPro
    * @support Please report any bugs to TheUnproPro@gmail.com
    *
    * @param Romance Name
    * @desc This is the name of the points. Change to something else if you don't want it to be Romance.
    * @Default Romance
    *
    * @param Romance Gain Sound
    * @desc This is the sound that plays when a romance point is gained.
    * @type file
    * @dir audio/se/
    * @Default Item1
    * @require 1
    *
    * @param Romance Lose Sound
    * @desc This is the sound that plays when a romance point is gained.
    * @type file
    * @dir audio/se/
    * @Default Parry
    * @require 1
    *
    * @param Max Points
    * @desc Maximum number of romance points.
    * @Default 15
    * @type number
    *
    * @param Window Controls
    *
    * @param Show Window
    * @type boolean
    * @Default true
    * @parent Window Controls
    *
    * @param Window Location
    * @desc This is the location of the popup window when a point is gained or lossed.
    * @type struct<WindowLocation>
    * @Default {"x":"16","y":"16"}
    * @parent Window Controls
    *
    * @param Fade Time
    * @desc How long until the message fades out?
    * @Default 120
    * @type number
    * @parent Window Controls
    *
    * @param Gain Message
    * @desc The text that shows up when a romance point is gained.
    * @Default \}\c[1]x${rom.amount}\c[0] ${rom.title} gained for \c[2]${rom.person}\c[0]!
    *
    * @param Lose Message
    * @desc The text that shows up when a romance point is lost.
    * @Default \}\c[1]x${rom.amount}\c[0] ${rom.title} lossed for \c[2]${rom.person}\c[0]!
    *
    * @Help
    * COPYRIGHT
    * Copyright (C) William Ramsey, you have the right to use this commercially or
    * non-commercially in any RPG Maker MV project you see fit. There
    * is no fee for using it in a commercial game.
    *
    * ABOUT
    * This plugin lets you have romantic points for any NPC you set up in the game.
    *
    * HOW-TO
    * In order to set up an event, you need to put <upp_rm_name:Entity Name> in the
    * events note section. "Entity Name" can be what ever you want, for example:
    * <upp_rm_name:Jessica Spinnach>
    *
    * Gain and Lose messages have symbols in them, and you're probably confused as to
    * what they mean. rom.amount is how many points were gained or lossed, rom.title
    * is the title of the points as defined in Romance Name, and rom.person is
    * whoever you set in the plugin command.
    *
    * Additionally, you can use the same text commands you would when typing a message.
    *
    * It's important to note that once an entities romance points are full, notifications
    * for gaining points will be disabled until you reduce some points.
    *
    * Plugin Commands:
    *
    * • upp_rom_manset Entity Name
    * This will manually add an entry, be careful though because if you have
    * an NPC already added and you use this, you'll get a double entry and
    * errors could happen. Only use this in cases where you want to
    * immediately add people at the start of the game, such as party members
    * for example.
    * [example] upp_rom_manset Jessica Spinnach
    * upp_rom_manset Albert Carrot
    *
    * • upp_rom_link variable_id Entity Name
    * This command will link a variable to the amount of romance points an entity
    * has.
    * [example] upp_rom_link 1 Jessica Spinnach
    *
    * • upp_rom_gain / upp_rom_lose amount Entity Name
    * This command will gain or lose a specified amount of romance points for an
    * entity.
    * [example] upp_rom_gain 5 Jessica Spinnach
    * upp_rom_lose 5 Jessica Spinnach
    *
    * Conditional Branch/Control Variables Script Commands:
    *
    * • uppRomance("value", "Entity Name")
    * This basically returns the romance value of an entity you've created. If
    * it doesn't exist, it will return 0. This will allow you to do some cool stuff
    * with events if your romance level is high enough (or low enough...) with a specific
    * character.
    *
    * • uppRomance("full", "Entity Name")
    * This checks and sees if the romance value of an entity is full. If it is, it'll
    * return true, if not, it'll return false.
    */

    /*~struct~WindowLocation:
    * @param x
    * @type number
    * @Default 14
    *
    * @param y
    * @type number
    * @Default 14
    */
    (function() {

    /**
    * @function PluginCommands
    * @desc Gives a plugin command to link a variable to an entities romance points
    */

    var plugAlias = Game_Interpreter.prototype.pluginCommand;
    Game_Interpreter.prototype.pluginCommand = function(command, args) {
    if(command == 'upp_rom_link') {
    var result = "";
    for(var j = 1; j<args.length; j++) {
    result += args[j];
    if(j<args.length - 1) {
    result += " "
    }
    }
    for(var i = 0; i < romEntities.length; i++) {
    if(romEntities.name == result) {
    $gameVariables._data[Number(args[0])] = romEntities.points;
    }
    }
    }

    if(command == 'upp_rom_manset') {
    var result = "";
    for(var i = 0; i<args.length; i++) {
    result += args;
    if(i<args.length - 1) {
    result += " "
    }
    }
    romEntities.push({
    name: result,
    points: 0,
    met: false,
    sprite: null,
    index: 0
    })
    }

    if(command == 'upp_rom_gain') {
    var add = Number(args[0]);
    var result = "";
    for(var j = 1; j<args.length; j++) {
    result += args[j];
    if(j<args.length - 1) {
    result += " "
    }
    }
    for(var i = 0; i < romEntities.length; i++) {
    if(romEntities.name == result) {
    if(romEntities.points+add>rom.max) {
    add = rom.max - romEntities.points;
    }
    if(romEntities.points<rom.max) {
    rom.sprite = romEntities.sprite
    rom.index = romEntities.index
    rom.amount = add;
    rom.person = result;
    var msg = parseValues(gain_msg);
    winMsg = msg;
    winUpdate = true;
    romEntities.points += add;
    AudioManager.playSe(se1);

    romEntities.points = Math.min(Math.max(romEntities.points, 0), rom.max)
    }
    }
    }
    }

    if(command == 'upp_rom_lose') {
    var add = Number(args[0]);
    var result = "";
    for(var j = 1; j<args.length; j++) {
    result += args[j];
    if(j<args.length - 1) {
    result += " "
    }
    }
    for(var i = 0; i < romEntities.length; i++) {
    if(romEntities.name == result) {
    rom.amount = add;
    rom.person = result;
    var msg = parseValues(lose_msg);
    winMsg = msg;
    winUpdate = true;
    romEntities.points -= add;
    AudioManager.playSe(se2);

    romEntities.points = Math.min(Math.max(romEntities.points, 0), rom.max)
    }
    }
    }
    }

    /**
    * @param params
    * @desc Gets the parameters
    */
    var params = PluginManager.parameters("upp_charRomance");

    var create_window = Boolean(params['Show Window']);
    var win = JSON.parse(params['Window Location']);
    win.x = Number(win.x);
    win.y = Number(win.y);

    var rom = {
    title:params['Romance Name'],
    amount: '',
    person: '',
    max: params['Max Points']
    }

    var gain_msg = params['Gain Message'];
    var lose_msg = params['Lose Message'];

    var fade_time = Number(params['Fade Time']);

    var se1 = {
    name: params['Romance Gain Sound'],
    volume: 90,
    pitch: 100,
    pan: 0
    }

    var se2 = {
    name: params['Romance Lose Sound'],
    volume: 90,
    pitch: 100,
    pan: 0
    }
    var romEntities = [];
    var winMsg = "";
    var winUpdate = true;

    /**
    * @function parseValues
    * @desc Gets the values of the text for gain/lose messages
    */

    function parseValues(msg) {
    var res = msg.replace("${rom.amount}", rom.amount);
    res = res.replace("${rom.person}", rom.person);
    res = res.replace("${rom.title}", rom.title);
    return res;
    }

    /**
    * @alias DataManager.createGameObjects
    * @desc Allows us to create data at the start of
    * the game.
    */
    var dm_cgo = DataManager.createGameObjects;
    DataManager.createGameObjects = function() {
    dm_cgo.apply(this, arguments);
    $dataUppRomance = romEntities;
    uppRomance = uppromance;
    };

    /**
    * @alias DataManager.makeSaveContents
    * @desc Allows us to append data to the save file
    */
    var dm_save = DataManager.makeSaveContents;
    DataManager.makeSaveContents = function() {
    var contents = dm_save.apply(this, arguments);
    contents.upprom = romEntities;
    return contents;
    };

    /**
    * @alias DataManager.extractSaveContents
    * @desc Allows us to load upprom data from the save file
    */
    var dm_load = DataManager.extractSaveContents;
    DataManager.extractSaveContents = function(contents) {
    dm_load.apply(this, arguments);
    $dataUppRomance = (typeof contents.upprom != 'undefined') ? contents.upprom:[]
    romEntities = $dataUppRomance;
    };

    /**
    * @function uppromance
    * @desc Provides the functions needed for conditional branch checking
    */
    function uppromance(type, args) {
    switch(type.toLowerCase()) {
    case "value":
    for(var i = 0; i < romEntities.length; i++) {
    if(romEntities.name == args) {
    return romEntities.points
    }
    }
    break;

    case "full":
    for(var i = 0; i < romEntities.length; i++) {
    if(romEntities.name == args) {
    if(romEntities.points == rom.max) {
    return true;
    } else {
    return false;
    }
    }
    }
    break;
    }
    }

    /**
    * @alias SceneMap.prototype.start
    * @desc Automatically adds an entry to the saveData file for events that
    * have the meta tag data <upp_rm>
    */
    var smps = Scene_Map.prototype.start;
    Scene_Map.prototype.start = function() {
    smps.apply(this, arguments);
    var i = $dataMap.events.length;
    var j = 0;
    while(i--) {
    if($dataMap.events != null) {
    var data = $dataMap.events.meta.upp_rm_name;
    if(typeof data != 'undefined') {
    var create = true;
    for(j=0;j<romEntities.length;j++) {
    if(romEntities[j].name == data) {
    create=false;
    }
    }
    if(create == true) {
    romEntities.push({
    name: data,
    points:0,
    met: false,
    sprite: null,
    index: 0
    })
    }
    }
    }
    }

    this.UppRomanceDisplay = null;
    if(create_window) {
    this.UppRomanceDisplay = new Window_UppRomanceDisplay();
    this.addChild(this.UppRomanceDisplay);
    }
    };

    /**
    * @function Window_UppRomanceDisplay
    * @desc This is the popup for when points are gained/lossed
    */
    function Window_UppRomanceDisplay() {
    this.initialize.apply(this, arguments);
    }

    Window_UppRomanceDisplay.prototype = Object.create(Window_Base.prototype)
    Window_UppRomanceDisplay.prototype.constructor = Window_UppRomanceDisplay;

    Window_UppRomanceDisplay.prototype.initialize = function() {
    Window_Base.prototype.initialize.call(this, win.x, win.y, Graphics.boxWidth/2, 144)
    this.opacity = 0;
    this.timer=0;
    this.refresh();
    }

    Window_UppRomanceDisplay.prototype.standardPadding = function() {
    return 0;
    }

    Window_UppRomanceDisplay.prototype.refresh = function() {
    this.contents.clear();
    this.drawTextEx(winMsg, 0, 0, this.contents.width-4);
    }

    Window_UppRomanceDisplay.prototype.update = function() {
    if(winUpdate == true) {
    this.refresh();
    this.y = win.y+24;
    winUpdate = false;
    this.contentsOpacity = 0;
    this.timer = 0;
    }

    var ft = fade_time;
    this.timer++;
    this.y = Math.min(Math.max(this.y, -200), win.y)
    this.contentsOpacity -= (this.timer>ft)?25:-25
    this.y -= (this.timer>ft || this.timer<12)?1:0;
    }

    })();
  2. Did you try emailing the plugin author?

    "* @support Please report any bugs to TheUnproPro@gmail.com"
  3. Yeah, he has been checking it out also. There wasn't much I could do to help so I thought I'd ask here in case someone who knows more about code might notice something out of place. It's not a terribly complicated or long plugin script but I'm completely ignorant when it comes to js.
  4. I've moved this thread to Plugin Support. Thank you.