Get the note box off a game enemy

Discussion in 'Javascript/Plugin Support' started by DarknessFalls, Oct 29, 2015.

Thread Status:
Not open for further replies.
  1. DarknessFalls

    DarknessFalls Rpg Maker Jesus - JS Dev. Veteran

    Messages:
    1,393
    Likes Received:
    209
    First Language:
    English
    Is there a function on either battler, enemy or something where I can get the contents of the note box? I didn't see anything
     
    #1
  2. Mellye

    Mellye Veteran Veteran

    Messages:
    347
    Likes Received:
    277
    First Language:
    Portuguese
    One cool thing about MV is that the DataManager already gets some MetaData from the Notes box for you.

    It follows the format

    <foo:bar>The Data object will have a .meta.foo property that equals to bar. You can use multiple of those to set up multiple properties.

    Then you can set up a method like this:

    Game_Enemy.prototype.getFoo = function() {        if (typeof $dataEnemies[this._enemyId].meta.foo !== 'undefined')        {            return $dataEnemies[this._enemyId].meta.foo;        }        return null;    };Alternatively, you can also set up just

    <foo>and the DataManager will assign true to that property.

    But anyway, if you do want to access the Note field, it's data.note.

    Code:
    console.log($dataEnemies[1].note)
    This should log the contents of the Note field of the enemy at index 1.
     
    Last edited by a moderator: Oct 29, 2015
    #2
Thread Status:
Not open for further replies.

Share This Page