This doesn't answer your question, but: Please don't directly edit the base scripts. Always write a plugin if you want to change something. Otherwise, you might run in a lot of compatibility problems with other plugins and it's hard to keep an eye on what you've changed.
JavaScript questions that don't deserve their own thread
● ARCHIVED · READ-ONLY
-
-
I get that, which is why I always save backups of the base scripts and leave the original parts in there, commented out, in case something does end up breaking.
-
having trouble with parsing notetags:
<var_req:x,y>
where x is the variable required and y is the value needed for the variable.
I've tried:
var str;
var variable_req;
var variable_num;
var variable_val;
var chk_val;
if (item.meta.req_var!=null)
{str=item.meta.req_level.toString();
variable_req=str.split(",");
variable_num=variable_req[0];
variable_val=variable_req[1];
chk_val=Game_Variables._data[num];
}
else
chk_val=0;
but it throws an error:
TypeError
Cannot read property 'toString' of undefined
any help will be appreciated. -
Hey, I've been wondering how to fix weather effects, I've read all of the guides and no matter what happens, the rain alway stays for a split second on the next map before fading away, as well as the sound effects (see below)

But in the event I made it's supposed to stop the weather effects after the screen fades out as well as the background noise after the screen fades out. However the BGS and weather effects fade away in the next map that the character transfers to. (see below)

And below is the event I made in Map 1 to trigger the weather in case anyone needs to see it.

-
Your tag under notes is "<var_reg>" and your calling toString on item.meta.reg_level.having trouble with parsing notetags:
<var_req:x,y>
where x is the variable required and y is the value needed for the variable.
I've tried:
var str;
var variable_req;
var variable_num;
var variable_val;
var chk_val;
if (item.meta.req_var!=null)
{str=item.meta.req_level.toString();
variable_req=str.split(",");
variable_num=variable_req[0];
variable_val=variable_req[1];
chk_val=Game_Variables._data[num];
}
else
chk_val=0;
but it throws an error:
TypeError
Cannot read property 'toString' of undefined
any help will be appreciated.
But there is no property called "reg_level".
Try item.meta.var_reg.toString(); -
Oh my God.Your tag under notes is "<var_reg>" and your calling toString on item.meta.reg_level.
But there is no property called "reg_level".
Try item.meta.var_reg.toString();
That explains everything.......I made a script that checks a variable called req_level
i guess i forgot to switch that one part out..
Also, how do you read the value of a game variable?
I tried:
var value = Game_Variables._data[20]
and it says: cannot read property "20' of undefined.
I'm guessing its an issue is with the Game_Variables call...
EDIT: I was right - the call was bad
The correct call was $gamevariables.value(20) -
I'm having another issue with tilesets. Recently I downloaded a door tileset and after toying around with the sections (I didn't put them in section A), this has been my result. I tried to resize them in GIMP but that didn't work either. This tileset pack was for VX Ace, do I need to download one for VM? If so where can I find one?

Well I found out how to enlarge the doors, but unfortunately it isn't sharp anymore. Anyway I can sharpen the sprites back to their original appearance? -
I want to modify the level up function to add an item to the party's stash (to be used as currency for skill choices at the shop). What is the correct method for doing so?
-
I'm trying to zoom the game view in on the player character - but when I do so the view is 'off'. Seen here, which should have the PC at the center of the screen:

Can anyone provide a correct formula that returns the player's X and Y coordinates, taking the game's zoom factor into consideration?
My current formulae:
SpoilerSets the game zoom factor (called once on scene load):
$gameScreen.setZoom((SceneManager._screenWidth)/2,(SceneManager._screenHeight)/2,2.5);
Centers the screen on the player (or would if it worked properly):
$gameScreen._zoomX = (Graphics.width / 2) + ($gamePlayer._realX * 48) / 2
$gameScreen._zoomY = (Graphics.height / 2) + ($gamePlayer._realY * 48) / 2 -
If you are using VX ACE resources, you need to resize that by 1,5.I'm having another issue with tilesets. Recently I downloaded a door tileset and after toying around with the sections (I didn't put them in section A), this has been my result. I tried to resize them in GIMP but that didn't work either. This tileset pack was for VX Ace, do I need to download one for VM? If so where can I find one?

Well I found out how to enlarge the doors, but unfortunately it isn't sharp anymore. Anyway I can sharpen the sprites back to their original appearance? -
I find an answer thanks to Iavra !I'm trying to zoom the game view in on the player character - but when I do so the view is 'off'. Seen here, which should have the PC at the center of the screen:

Can anyone provide a correct formula that returns the player's X and Y coordinates, taking the game's zoom factor into consideration?
My current formulae:
SpoilerSets the game zoom factor (called once on scene load):
$gameScreen.setZoom((SceneManager._screenWidth)/2,(SceneManager._screenHeight)/2,2.5);
Centers the screen on the player (or would if it worked properly):
$gameScreen._zoomX = (Graphics.width / 2) + ($gamePlayer._realX * 48) / 2
$gameScreen._zoomY = (Graphics.height / 2) + ($gamePlayer._realY * 48) / 2
Code:$gameScreen.startZoom(x, y, scale, duration); -
Well, yes, I'm aware of that function. What should I replace the x and y parameters in the function call with to center the view properly on the player character if that is in fact the solution?
-
i see.. i'm looking for that too, it will be amazing if we find a way to use game variables.Well, yes, I'm aware of that function. What should I replace the x and y parameters in the function call with to center the view properly on the player character if that is in fact the solution?
-
The formula above gets close - but it isn't dead on. It only uses existing variables.i see.. i'm looking for that too, it will be amazing if we find a way to use game variables.
-
From Iavra againThe formula above gets close - but it isn't dead on. It only uses existing variables.
$gameScreen.startZoom($gamePlayer.screenX(), $gamePlayer.screenY() - 24, scale, duration);Don't work when the player is moving around. -
Ah, it was so simple all along. I swore I'd tried that one out before. Well, it's working now. Thanks you two - this resolves one of the last obstacles impeding this plugin from being completely fixed up and finished.
-
You are welcome!Ah, it was so simple all along. I swore I'd tried that one out before. Well, it's working now. Thanks you two - this resolves one of the last obstacles impeding this plugin from being completely fixed up and finished.
PS: I find this complete plugin at the end...
http://forums.rpgmakerweb.com/index.php?/topic/48267-mbs-map-zoom/ -
I've got a question that I couldn't find my own answer to, I'm sure someone else will know better.
Instead of using something like this to detect movement:
if ($gamePlayer.isMoving()){}Is there an easy way to detect movement in actual steps taken? -
In Game varabile > Game data > Other > StepsI've got a question that I couldn't find my own answer to, I'm sure someone else will know better.
Instead of using something like this to detect movement:
if ($gamePlayer.isMoving()){}Is there an easy way to detect movement in actual steps taken?
You can find that, so there's a way -
New question:
I was told to alias the Game_battlerBase.prototype.canEquipWeapon
function.
I was told to do something like this:
var oldcanequip = Game_BattlerBase.prototype.canEquipWeapon;
Game_BattlerBase.prototype.canEquipWeapon = function(item) {
//do stuff
return oldcanequip.call(this, item);
};
But it doesn't seem to work.
I understand that Aliasing would work better than overriding (Since other scripts could use the function)
and want this to work, but I just can't seem to get it to do so.
I replaced the original return call to return false, in the hopes that it would essentially force the canequip function to always return false. but I'm wondering if I did something wrong.