Changing an event's note tag via JS

● ARCHIVED · READ-ONLY
Started by GeneralIroh 7 posts View original ↗
  1. Hello!

    I am currently creating a game using the Alpha ABS plugin. It is an awesome plugin. Enemies are created by giving an event a notetag. The number on the note tag responds to the enemy database and determines which kind of enemy it will be.

    I am looking to find a way to change the note tag during the game. I know this is a bad idea in many cases, but I have reason to believe that it will work in my game without too many issues.

    I am new to JavaScript, and what I have been trying to use is this:
    $dataMap.events[n].note=<ABS:5>

    However, it gives me an error message. Can someone please let me know the proper way to write this JS code?

    Thank you in advance.
  2. what error? You probably have to put that in quotes. However, if by the time the event appears on the map, the notes have already been read and turned into metadata, and the plugin may already have done its processing as well. So apart from the fact that notes will be reset every time the map loads, the plugin may not detect your change anyway.
  3. I have attached a picture of the error message.

    Hmmm... well, if I can't change the note tag, then I can't do it. But it seemed like the best way to go about changing the enemies on my map. I understand what you are saying, though. Is there any way to change a note tag before the events load? I don't see how, but I figure it is worth asking.
  4. There is always a way, you just need to prepare yourself for sometimes small and sometimes huge changes of the default engine or even plugins.

    For example you could have reworked the default DataManager.onload function that if there's certain mapID and a switch is active, you replace a certain part of _note via string.replace method.
    For example:
    Code:
    DataManager.onLoad = function(object) {
        var array;
        if (object === $dataMap) {
            this.extractMetadata(object);
            array = object.events;
        } else {
            array = object;
        }
        if (Array.isArray(array)) {
            for (var i = 0; i < array.length; i++) {
                var data = array[i];
                if (data && data.note !== undefined) {
    if ($dataMap._mapId == 5 && $gameSwitches.value(5)) data.note.replace ("ABS: 5", "ABS: 150");
                    this.extractMetadata(data);
                }
            }
        }
        if (object === $dataSystem) {
            Decrypter.hasEncryptedImages = !!object.hasEncryptedImages;
            Decrypter.hasEncryptedAudio = !!object.hasEncryptedAudio;
            Scene_Boot.loadSystemImages();
        }
    };

    Of course if you have many possible changes like these, it would result in the game's loading getting slow due to many ifs. In that case it would probably be better to load all possible dataMaps beforehand and process this thing asynchronously, then just upon map change pass the dataMap that is needed. Or there are many other ways, I'm sure of that.
  5. Or you could change the plugin to look for a comment on an event page rather than a note on the event itself, so you just need to change the conditions dictating which page is active.

    That is a very strange error message, and likely has nothing to do with what you wrote (except that you need to use quotes after the = but that still won't do what you want it to do).

    Can you play your game, hit F8 to open the dev tools, and then do what you did to generate the error? At that point it should give you the real error. Whenever you have an issue that's generated an error, always use F8 and go to the console and copy/paste or post a screenshot of the messages in the console. The ones that appear on the game screen, as in your screenshot above, are only of very limited use.
  6. @SarcasticSloth
    This type of print screen you show seems to show that you have not learned the basic dev and also javascript to work effectively in rmmv.
    I suggest you try to start working with the terminal and the chromium inspector.
    The error you present has no logical and reel value, it does not allow the developers to help you sorry.

    You issue are maybe more luck in a plugin issue than a js issue.
    Show a reel log please if you need more help.

    if you need help , please study how dev tool work to understand issue and show us.
    https://developers.google.com/web/tools/chrome-devtools/

    If you don't have access to dev tool at boot, you can use F8
  7. Thanks everybody for the replies. No, I do not know JS, that is the biggest reason I was asking. However, the plugin I am working with was recently updated and it fixed the problem I was having. Thank you all for your kind replies though!