Llareian, unfortunately that did not work. I think that's on the right track, though. From playing around with the code, it seems that the message window activates automatically, but doesn't wait for player input before calling this._numberWindow.activate() which then activates the sell window and ignores the message window. If I comment out the numberWindow activation, the message window works--but then of course the shop doesn't work any more.
For now, I've sort of solved the problem just by adding \\|\\^ to the end of the message so it pauses briefly before closing automatically. I can work on a more elegant JavaScript-based solution later.
Thanks for the help, Llareian!
JavaScript questions that don't deserve their own thread
● ARCHIVED · READ-ONLY
-
-
I'm using Yanfly's equip core, and I can't figure out how to increase the experience rate by a variable.
I want to create an item that increases a user's Experience Rate by their Level/10. -
Can someone explain to me how the drawItem from the Window_Selectable works?
I need to create a list of achievements for my game, but I dont know how to create commands (list) with more the one line with content, like the Window_MenuStatus. -
Can someone explain to me how the drawItem from the Window_Selectable works?
I need to create a list of achievements for my game, but I dont know how to create commands (list) with more the one line with content, like the Window_MenuStatus.
The function body is empty meaning you're supposed to replace the function with one of your own design. If you're not doing anything fancy then one option is to replace the drawAllItems method.
ExampleCode:function achievementsWindow(x, y, width, height) { "use strict"; var achivements = ["First", "Second", "Third"]; var win = Object.create(Window_Selectable.prototype); win.maxCols = function () { return 1; }; win.maxItems = function () { return achivements.length; } win.drawAllItems = function () { achivements.forEach(function (achievement, i) { var rect = win.itemRect(i); var width = rect.width - win.textPadding(); win.drawText(achievement, rect.x, rect.y, width, "left"); }); }; win.initialize(x, y, width, height); win.refresh(); win.activate(); win.select(0); return win; } // To demo, open the console and type // SceneManager._scene.addWindow(achievementsWindow(0, 0, 200, 150)); -
How can I make the "Quit to Title Screen" option just transfer someone instead of going to the title screen? I'm trying to make a rogue-lite with only one save file and it autosaves when you return to the title screen (there's no option to quit the game unless you are on that screen). The title screen is evented though, so I can have a little bit more control over things. So I just want to teleport to that map instead of going to the actual title screen, which still sends them to that map but it refreshes the game so their save data is lost.
-
The function body is empty meaning you're supposed to replace the function with one of your own design. If you're not doing anything fancy then one option is to replace the drawAllItems method.
ExampleCode:function achievementsWindow(x, y, width, height) { "use strict"; var achivements = ["First", "Second", "Third"]; var win = Object.create(Window_Selectable.prototype); win.maxCols = function () { return 1; }; win.maxItems = function () { return achivements.length; } win.drawAllItems = function () { achivements.forEach(function (achievement, i) { var rect = win.itemRect(i); var width = rect.width - win.textPadding(); win.drawText(achievement, rect.x, rect.y, width, "left"); }); }; win.initialize(x, y, width, height); win.refresh(); win.activate(); win.select(0); return win; } // To demo, open the console and type // SceneManager._scene.addWindow(achievementsWindow(0, 0, 200, 150));
Okay, but insted of var achivements = ["First", "Second", "Third"];, can I put some functions to make the command with more info?
Like:
var achivements = [conquista1(), conquista2(), ... , conquistaN()];
win.prototype.conquista1 = function() {
this.drawIcon(12, 0, 0);
this.drawText('Conquista 1', Window_Base._iconWidth + 4, this.lineHeight() * 0, this.janelaLargura(), 'left');
this.drawText('Mate 10x Morcegos', 0, this.lineHeight() * 1, this.janelaLargura(), 'left');
}; -
Okay, but insted of var achivements = ["First", "Second", "Third"];, can I put some functions to make the command with more info?
I think an array of objects would work better.
Example CodeCode:function achievementsWindow(x, y, width, height) { "use strict"; var achivements = [ { icon: 1, title: "Conquest 1", text: "Kill 10x Bats" }, { icon: 1, title: "Conquest 2", text: "Swat 10x Mosquitos" }, { icon: 82, title: "Tourist", text: "Visit all 3 hidden taverns." } ]; var win = Object.create(Window_Selectable.prototype); win.maxCols = function () { return 1; }; win.maxItems = function () { return achivements.length; }; win.itemHeight = function () { return win.lineHeight() * 2; }; win.drawAllItems = function () { achivements.forEach(function (achievement, i) { var rect = win.itemRect(i); var width = rect.width - win.textPadding(); var iconWidth = 36; win.drawIcon(achievement.icon, rect.x, rect.y); win.drawText(achievement.title, rect.x + iconWidth, rect.y, width); win.drawText( achievement.text, rect.x, rect.y + win.lineHeight(), width ); }); }; win.initialize(x, y, width, height); win.refresh(); win.activate(); win.select(0); return win; } // To demo, open the console and enter // SceneManager._scene.addWindow(achievementsWindow(0, 0, Graphics.width, Graphics.height)); -
Hey all. Need some help with a Volume command in MV.
I know you can set the volume like this with a script:
Code:ConfigManager['bgmVolume'] = 35;
But what is the call to get the current volume, I'd like to store it in a variable! -
@Narch, try AudioManager.bgmVolume
-
-
It's me again.
I'm looking for a script to change the event priority (layer).
I think in VXace you could do:
Code:$game_map.events[event_id].instance_variable_set:)@priority_type, int)
Anything similar for MV?
EDIT: unrelated, but do you guys know if it's dangerous to call "SceneManager.push(Scene_Map)" when you're already on the map? -
@Narch, in MV it's: $gameMap.event(id).setPriorityType(priority);
The priority values are 0 for below, 1 for same level as characters, or 2 for above.
I'm not sure about using SceneManager to push a map scene. Searching through the code I can't see an instance of SceneManager.push being used that way. It only seems to be used to push menus, submenus, or battles. It looks like when loading a map, SceneManager.goto(Scene_Map) is used instead. The difference between the two is that when a scene is pushed, it gets put on a stack. This is so that when the scene is closed, the previous scene can be shown, which you wouldn't need to do for a map.
Mind you, I've only been looking at this JavaScript code for a few weeks, so I could be completely wrong about how scenes work. :) -
@scanime Great, thanks for the help.
The reason I want to use the Scene.Manager is pretty Bethesdaesque.
Via Galv_EventSpawner, I spawn events with "same as characters" priority, on graphics tiles that are player levels too.
But the tiles are under the events, and I want the contrary.
I tried tons of solutions, plugins that were not working. And I figured that when I was opening the menu when playing normaly, getting out of it was placing the tiles ON the events, like I wanted.
So on my maps common event loading, I put the SceneManager.xxx(Scene_Map), so when the player enters, the tiles and spawned events are prioritize like I want.
Both .goto and .push are having the same effects visualy, freezes the screen for some frames the same way you close the menu.
I'll go with .goto and hope it won't break in the future. -
Hey everybody, I'm trying to draw a icon in a textbox, how to do that?
I'm using RMMV, Yanfly's Skill Core.
Code:<Before Eval> if (target.isEnemy()) { var text = target.name() + '\n'; text += '\\px[100]\\c[4]ATK:\\c[0] ' + target.atk; text += '\\px[300]\\c[4]MAT:\\c[0] ' + target.mat; text += '\n'; text += '\\px[100]\\c[4]DEF:\\c[0] ' + target.def; text += '\\px[300]\\c[4]MDF:\\c[0] ' + target.mdf; $gameMessage.add(text); } for (var i = 1; i < $dataStates.length; i++ ) { if (target.isStateAffected(i)) { var text = $dataStates[i].name+ '\n'; text.drawIcon(i, 0, 0); // cause error: undefined is not a function. var notedata = $dataStates[i].note; var match = notedata.match(/<Help Description>/); } } if (match != null) { text += '\x1b}' + "Hello world!" $gameMessage.add(text); } </Before Eval>
Please @ me if you know how to make it. Thank you! -
@jack2396
I believe it's an escape code, try adding "\\i[X]" where X is the icon ID# -
Hello maybe you can help me?
In VX-Ace i could insert the following Codeline into the Custom Moveroute of an Eventpage:
Code:
moveto(@event.x , @event.y)
This made the Event Teleport back to its original Editor starting position, even after moving around.
How would this look in RPG Maker MV?
Edit: If this is the wrong place to ask this, please let me know and i make an extra Thread.
-I also searched the Helpfile and the Linked List, the wanted information isnt there.
Edit2: I understand that Scripts are now Plug inns, but where do i find the standard scripts with there awesome documentation like in vxace scripteditor? Where does it hide? -
@jack2396
I believe it's an escape code, try adding "\\i[X]" where X is the icon ID#
@Aloe Guvner
I tried to type "\\i[X]" but it only shows "[X]".
btw X = i.
Edit: that problem just solved by myself. Now, another question, how to check the state's icon?
Edit2: never mind. I solved. -
It's me again. After finding information of Regular Expressions, still don't know how to search words between <Help Description> and </Help Description>. Can somebody teach me?
Code:<Before Eval> if (target.isEnemy()) { var text = target.name() + '\n'; text += '\\px[100]\\c[4]ATK:\\c[0] ' + target.atk; text += '\\px[300]\\c[4]MAT:\\c[0] ' + target.mat; text += '\n'; text += '\\px[100]\\c[4]DEF:\\c[0] ' + target.def; text += '\\px[300]\\c[4]MDF:\\c[0] ' + target.mdf; $gameMessage.add(text); } for (var i = 1; i < $dataStates.length; i++ ) { if (target.isStateAffected(i)) { var delta = $dataStates[i].iconIndex var text2 = "\\i[" + delta + "]" + $dataStates[i].name+ '\n'; var notedata = $dataStates[i].note; // Should search words between <Help Description> and </Help Description> var match = notedata.match(/Help Description/); if (match) { text2 += match + '\n'; // Should search words between <Help Description> and </Help Description> } $gameMessage.add(text2); } } </Before Eval>
By the way is it shame or inappropriate to asking a lot of question? -
Hello maybe you can help me?
In VX-Ace i could insert the following Codeline into the Custom Moveroute of an Eventpage:
Code:
moveto(@event.x , @event.y)
This made the Event Teleport back to its original Editor starting position, even after moving around.
How would this look in RPG Maker MV?
Edit: If this is the wrong place to ask this, please let me know and i make an extra Thread.
-I also searched the Helpfile and the Linked List, the wanted information isnt there.
Edit2: I understand that Scripts are now Plug inns, but where do i find the standard scripts with there awesome documentation like in vxace scripteditor? Where does it hide?
@Bex, add a Script at the end of your Movement Route with this code:
Code:$gameMap.events()[ this._eventId - 1 ].setPosition( $dataMap.events[ this._eventId ].x, $dataMap.events[ this._eventId ].y );
This should teleport the event back to its starting position. We use $gameMap to reference the current event, and we use $dataMap to reference the original map information so we can get starting location of the event. With this._eventId we can get the event's id, but the arrays are built differently between $gameMap and $dataMap, so we have to subtract one from the event id to get the correct event from $gameMap.
All of the standard scripts are in the js folder inside your game folder. They will be named rpg_core.js, rpg_objects.js, et cetera. -
Thank you very much that Scriptline is working.
This Helps making it easier building a passage with Flame Balls to avoid.Without worrying to much about all the position Settings.
I have Win10 when i click the rpg_core.js Folder, i just get an error message and cant open it.
Is that normal? Do i need a special Program to open it?