consumeItem strange result and need advise

Hello,

I want to change the default action when you use an item to declare a new one (for example, to display a message directly without waiting to close Menu) :

I created a new Game_Party.consumeItem function :

Code:
    var _Game_Party_consumeItem = Game_Party.prototype.consumeItem;
    Game_Party.prototype.consumeItem = function(item) {
        _Game_Party_consumeItem.call(this, item);
        if(DataManager.isItem(item))
        {
            $gameTemp.reserveCommonEvent(1);
            SceneManager.push(Scene_Item);
        }
    };

When common event 1 is finished, it should open Scene_Item (automatically closed by message or other action in common event) but it is Scene_Menu that is opened.

I tried to call SceneManager.push(Scene_Item) by script at the end of common event and it works correctly in this case.
Can you explain me why Scene_Menu is opened instead of Scene_Item when i do it with js ?

How can i select automatically item used when Scene_Item will be opened the second time ?


Last question : i would like to draw a red tile near the main actor. I tried this but $gamePlayer.x and $gamePlayer.y doesn't return the real value (tile is on the top left corner)
Code:
    var _Spriteset_Map_createCharacters = Spriteset_Map.prototype.createCharacters;
    Spriteset_Map.prototype.createCharacters = function() {
        _Spriteset_Map_createCharacters.call(this)
        var sprite = new Sprite();
        sprite.bitmap = new Bitmap(48,48);
        sprite.bitmap.fillAll('red');
        sprite.x = Number($gamePlayer.x);
        sprite.y = Number($gamePlayer.y);
        sprite.z = 2;
        this._tilemap.addChild(sprite);
        tabIndex = this._tilemap.tabIndex;
    };

I think i have to do it with Game_Player.prototype.executeMove function but what is the best way to draw directly on the map with position of player ?

Thanks for your help

Original thread: https://forums.rpgmakerweb.com/threads/consumeitem-strange-result-and-need-advise.104853/