@Ramiro
Thanks!
I knew it was something simple, and I never worked with languages where 'function' can be a method, class, parameter or variable.
JavaScript questions that don't deserve their own thread
● ARCHIVED · READ-ONLY
-
-
Figured out a way to fix my problem: my version of the Scene_Menu.update() wasn't calling the basic update functions from Scene_Base.update(). By observing how other scenes call from parent scenes' functions, I managed to get it to work using this code:
Code:Now the playtime window updates once every second, and the menu commands are usable. Thanks for all the help.Scene_Menu.prototype.update = function() { Scene_Base.prototype.update.call(this); this._updateTimer += 1; if(this._updateTimer >= 60) { this._updateTimer = 0; this._goldWindow.refresh(); }}; -
Hi there, in mobile version, TwoFingers tap is the Cancel Button or Menù.
By script, One finger is:
TouchInput.isPressed()Wich is the equivalent for Two Fingers?
Thanks. -
I think, by looking at TouchInput, that there is no two-finger press.
There are : press, trigger, repeat, long press, move, release -
I see, i dont understand javascript, but i need to find out, when two finger pressed, and there must be a way, if you play on mobile and press Two Finger he cal the main menù.I think, by looking at TouchInput, that there is no two-finger press.
There are : press, trigger, repeat, long press, move, release
Maybe that function it's simply Cancel Button? so, something like If Cancel Button is pressed? -
In the status menu, how can I make the character's name blue? I'm trying to put this.changeTextColor(this.systemColor()); before the line that draws the character's name, but it isn't working.
-
Add this as a plugin :
Code:(function(){ Window_Status.prototype.drawActorName = function(actor, x, y, width){ width = width || 168; this.changeTextColor(this.systemColor); // Change this.systemColor into any other color, like mpColor or something... this.drawText(actor.name(), x, y, width); }})(); -
Is there perhaps a way to do this without the use of a plugin? It seems simple enough that a plugin is kind of overkill.Add this as a plugin :
(function(){ Window_Status.prototype.drawActorName = function(actor, x, y, width){ width = width || 168; this.changeTextColor(this.systemColor); // Change this.systemColor into any other color, like mpColor or something... this.drawText(actor.name(), x, y, width); }})();
I've gotten as far as to finding the this.drawActorName in rpg_windows.js. -
Yes, there is.
Go to rpg_windows.js and find Window_Base.prototype.drawActorName
It'll look like :
width = width || 168;this.changeTextColor(this.hpColor(actor)); // <==== IMPORTANTthis.drawText(actor.name(), x, y, width);Change this.hpColor(actor) to whatever other color you want, such as this.systemColor (that's black color)
EDIT: And why don't you use JGSS DevKit?
EDIT2: Forgot to say, this will change EVERY actor name to be drawn with color you specify -
Strange, this.systemColor() changes everything to blue for me. I actually like how it looks, but I do wonder if there's a way to make it so it only changes the color in the status menu. I have a feeling that the key may be by adding an if statement next to the part that changes the color.Yes, there is.
Go to rpg_windows.js and find Window_Base.prototype.drawActorName
It'll look like :
width = width || 168;this.changeTextColor(this.hpColor(actor)); // <==== IMPORTANTthis.drawText(actor.name(), x, y, width);Change this.hpColor(actor) to whatever other color you want, such as this.systemColor (that's black color)
EDIT: And why don't you use JGSS DevKit?
EDIT2: Forgot to say, this will change EVERY actor name to be drawn with color you specify
In pseudocode, maybe something like...
if menu=status{this.changeTextColor(this.hpColor(actor);} //The typical white.
else{this.changeTextColor(this.systemColor());} //Blue
But I don't know what to put in as a variable. -
Yes, it can. With the plugin above. Why is it a problem to use it?
You can also add that plugin text wherever you want, even without (function(){ part at the beginning and })(); at the end, but it's better to keep it as a plugin until you get more experienced with plugins... -
Is there a way to add a stat? I want to add weapon damage to my list of parameters
-
what parameters? On the status screen and the equip screen, the ATK figure includes any equipment you have.
And damage is not always a number - sometimes it's a formula. Sometimes it varies. -
What is the JS equivalent to FileTest.exist?("x")
-
What I mean is assigning each weapon their own damage value independant of the attack stat.
as it is right now, the attack stat is just a catch all stat for physical damage. I could make each weapon have its own attack skill and calculate into the formula the different weapon damage values I want, but that wont show up on the status or equip screen.
To better illustrate what I mean lets say a sword has a damage value of 8. Now, in the formula, the 8 will be modified by the characters attack value. So if the characters attack value is 12, the damage would be 12 + 8. Attack in this scenario represents the characters own strength.
Now I realize that 12 + 8 would be the exact same as if I just added 8 attack value. we'd get 20 either way, but when you get into more complex formula's, there can be a great difference. It also provides a difference with debuffs. I can make a debuff that specifically targets the weapon damage without affecting the characters attack value.
There were scripts back in vx ace that added in custom parameters. I guess I was just wondering how I would go about doing that in MV. -
That's not really a question that doesn't deserve its own thread. You'd be setting up notes and would need a plugin to let you read those notes and use them in the damage calculations (or on whatever screens you want to show them).
If you want to write this yourself, I think it'd be good to start your own thread in the JS/Plugin Support forum (this forum), because it's not something that has a simple/quick answer. -
well it was worth a shot. I realize writing it would be an undertaking, but I was hoping. Guess I'll just go dig around in the Javascript and figure something out. Thanks anyways for the help.
-
@ReddElite
Stackoverflow is a helpful community.
I found this answer.
So, you can test it like this :
function FileTest() { throw new Error("This is a static class"); }FileTest.exists = function(url){ var req = new XMLHttpRequest(); req.open('HEAD', url, false); req.send(); return req.status != 404;}After inserting this you may be able to use FileTest.exists on files...
EDIT: My mistake. You can't use synchronous XMLHttpRequests. So it becomes a bit more complicated now :
Code:function FileTest() { throw new Error("This is a static class"); }FileTest.exists = function(url, callback){ var req = new XMLHttpRequest(); req.onreadystatechange = function() { if(req.readyState == 4) callback.call(this, req.response); } req.open('GET', url, true); req.send();}; // And here is how you test it :FileTest.exists("js/main.js", function(response) { alert(response != ""); }); // This will alert trueFileTest.exists("js/main.j", function(response) { alert(response != ""); }); // This will alert false -
How can i change region ID for a specifiched XY position or ID?
For example
Every ID 5 become 7 (this is better in my situation)
in rgss it was something like:
Code:change_region_id(x, y, new_ID) -
@Lakaroth
Nope, I think that method does not exist even in RGSS
But here is a plugin that does that :
(function(){ var _kocka_random_alias_intialize_l2h9HbeF = Game_Map.prototype.initialize; Game_Map.prototype.initialize = function(){ _kocka_random_alias_intialize_l2h9HbeF.apply(this, arguments); this._changedRegions = [];}; Game_Map.prototype.regionId = function(x, y) { return this.isValid(x, y) ? this._changedRegions[x] ? this._changedRegions[x][y] ? this._changedRegions[x][y] : this.tileId(x, y, 5) : this.tileId(x, y, 5) : 0; }; Game_Map.prototype.changeRegionId = function(x, y, value){ if(!this._changedRegions[x])this._changedRegions[x] = []; this._changedRegions[x][y] = value; return this._changedRegions;}; })();Just use a script call to $gameMap.changeRegionId(x, y, value);