JavaScript questions that don't deserve their own thread

Prescott

argggghhh
Veteran
Joined
Aug 28, 2014
Messages
521
Reaction score
465
First Language
English
Primarily Uses
RMMV
I think I asked this before but I can't remember where the hell I asked and now I need to know again o.0
My title screen is completely evented, and while I have a "skip title" plugin, if I call the title in game it will send it to the actual title rather than my evented one.
I figured out somehow how to make the game refresh completely rather than going back to the title, as if you pressed f5. It must have been with a script call or something because it is now in all the plugins I need it to be in, but now I need it in an event for the ending of the game (choices to go back to title, load screen, or new game +) and can't for the life of me figure out how to do this again.

Any help?
 

Lowell

The Walking Atelier
Veteran
Joined
Apr 21, 2012
Messages
292
Reaction score
69
First Language
English
Primarily Uses
How would I go about checking if an actor has an armor type equipped?
particular an if statement if armor type x is equipped
 

waynee95

Inactive
Veteran
Joined
Jul 2, 2016
Messages
697
Reaction score
624
First Language
German
Primarily Uses
RMMV
@Lowell
$gameActors.actor(ACTOR_ID).equips()[SLOT_ID].atypeId
Returns the armor type of an actor for a specific slot id.

You can insert something like this into a conditional branch
$gameActors.actor(2).equips()[1].atypeId == 4
Checks if the armor type of the equipment in slot 1 from actor 2 is 4.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
3,779
Reaction score
2,921
First Language
English
Primarily Uses
RMMZ
You may want to add a bit to that:

Code:
$gameActors.actor(2).equips()[1] && $gameActors.actor(2).equips()[1].atypeId == 4

Otherwise it'll crash if you don't have anything equipped in that slot.
 

Lowell

The Walking Atelier
Veteran
Joined
Apr 21, 2012
Messages
292
Reaction score
69
First Language
English
Primarily Uses
Thanks, works like a charm
 

jameswestbrook351

DecayingDev
Veteran
Joined
Apr 30, 2015
Messages
58
Reaction score
13
First Language
English
Primarily Uses
RMMV
$gameMap.eventsXy(x, y).forEach(function(event) {
if (event.event().meta.EVENT NOTETAG NAME) NAMEOFARRAY.push(event);
});
So this is what we use to get all events located in a specific area right? I'm trying to push all events in the map(not just in a specific spot) into an array, and I cannot find the proper function to use. Anyone know what I am looking for?
 

Damenshi

Villager
Member
Joined
Sep 1, 2014
Messages
12
Reaction score
0
First Language
English
Primarily Uses
First and foremost, I want to apologize of this isn't quite the proper place to ask this, but I'm afraid my abilities with Javascript are terribly limited, and I unfortunately need all the help I can get...

With that in mind, I've been attempting to develop a skill in MV that, when used, replaces a target's currently active buff with the equivalent debuff. (For example, if the target is currently under an attack buff, this would replace it with an attack debuff. A similar effect would apply in response to defense buffs, agility buffs, etc.) It also could potentially work the other way around - replacing debuffs with the appropriate buffs - but this isn't entirely necessary.

As of now, I'm currently utilizing a number of Yanfly's plugins, including the Battle Engine Core, all three Action Sequence Packs, and the Buff & States Core, among others. (Please feel free to ask any follow-up questions as necessary.)

Any and all assistance is greatly appreciated.
My thanks in advance, and thank you for reading.
 

IAmJakeSauvage

Veteran
Veteran
Joined
Dec 4, 2015
Messages
418
Reaction score
671
First Language
English
Primarily Uses
RMMV
Hey guys,

I know that you can use "gauge back" in Yanfly's plugin core to change the color of this background - but I do want the backs of my gauges to be grey. For these item backgrounds though I'd much prefer them to be another color in my system palette - is there a way to do this?

Thanks in advance!,

Gauge Back.png
 

waynee95

Inactive
Veteran
Joined
Jul 2, 2016
Messages
697
Reaction score
624
First Language
German
Primarily Uses
RMMV
@IAmJakeSauvage

Copy this to a new .js file, import it as a plugin and place it below the Equip Core.

Code:
Window_StatCompare.prototype.drawDarkRect = function(dx, dy, dw, dh) {
    //var color = this.gaugeBackColor(); old
    //var color = '#FF00FF'; use this for hex color
    var color = this.textColor(12); //use this for MV color codes
    this.changePaintOpacity(false);
    this.contents.fillRect(dx + 1, dy + 1, dw - 2, dh - 2, color);
    this.changePaintOpacity(true);
};
 

IAmJakeSauvage

Veteran
Veteran
Joined
Dec 4, 2015
Messages
418
Reaction score
671
First Language
English
Primarily Uses
RMMV
@IAmJakeSauvage

Copy this to a new .js file, import it as a plugin and place it below the Equip Core.

Code:
Window_StatCompare.prototype.drawDarkRect = function(dx, dy, dw, dh) {
    //var color = this.gaugeBackColor(); old
    //var color = '#FF00FF'; use this for hex color
    var color = this.textColor(12); //use this for MV color codes
    this.changePaintOpacity(false);
    this.contents.fillRect(dx + 1, dy + 1, dw - 2, dh - 2, color);
    this.changePaintOpacity(true);
};
Thank you so much for your help - but it doesn't seem to be working.
 
Joined
Nov 5, 2016
Messages
69
Reaction score
6
First Language
English
Primarily Uses
What would be the script for a conditional Branch that checks if Switch 12 is on
(Just need the conditional not the Then & else stuff)
 

IAmJakeSauvage

Veteran
Veteran
Joined
Dec 4, 2015
Messages
418
Reaction score
671
First Language
English
Primarily Uses
RMMV
I was able to play around with Yanfly's Victory Aftermath and get it to look a little bit better with my resolution - but the area on the right looks like it has enough space for another faceset and changing the width only squishes the other elements. Does anybody have an idea as to how I can spread things out? :3

AftermathWindows.png
 

waynee95

Inactive
Veteran
Joined
Jul 2, 2016
Messages
697
Reaction score
624
First Language
German
Primarily Uses
RMMV
@IAmJakeSauvage
Put this into a .js file and place it under the Aftermath Plugin

Code:
Window_VictoryExp.prototype.gaugeRect = function(index) {
    var rect = this.itemRect(index);
    var fw = Window_Base._faceWidth;
    rect.x += fw + this.standardPadding() * 2;
    // rect.width -= fw * 2 + this.standardPadding() * 4; old
    rect.width -= fw + this.standardPadding() * 3;
    return rect;
};
 

Stigma

Warper
Member
Joined
Oct 29, 2016
Messages
4
Reaction score
0
First Language
English
Primarily Uses
Hi all,

Can someone please help. I need the code to show the name of the actor's equipped weapon.

A replacement for this code: "ATK: " + actor.atk

Found in this video
So basically, on the menu, I would like to see what is the name of the actors currently equipped weapon.

thx <3

EDIT: A problem was solved on Steam forums. Solution is: actor.weapons()[0] ? actor.weapons()[0].name : "None"
 
Last edited:

Resonance

Veteran
Veteran
Joined
Oct 25, 2015
Messages
43
Reaction score
6
First Language
English
1. I used to have a bookmark of a Google Doc that had script call equivalents of every Event Command. Does someone have that doc on them? Because it'd possibly give me the information I'd need to figure out my actual question on my own.

2. Specifically, right now I need it to figure out how to perform Set Movement Routes through scripting. Like I want to move a map event x tiles downwards. Doing it through eventing means re-issuing single Set Movement Routes, which introduces a slight stutter as the event needs to be given its next movement route each time it completes a step, which is undesirable.
 

IAmJakeSauvage

Veteran
Veteran
Joined
Dec 4, 2015
Messages
418
Reaction score
671
First Language
English
Primarily Uses
RMMV
Hey again,

My status menu is cut off my one line and I think it has to do with my padding etc. in the Core plugin - is there any way to somehow change the padding for this window to allow that last line to show through?
 

Attachments

  • statusmenu.png
    statusmenu.png
    728.6 KB · Views: 5

Latest Threads

Latest Posts

Latest Profile Posts

Woot got a promotion and a pay rise ᕙ( • ‿ • )ᕗ now I'm set.
does anyone feel like explaining to me the difference between simulation and emulation? you have my full permission to be as pedantic as you want.
About the Deer, I had to cut some piece of video due the *swearing* Youtube copyrights issues...
A caveman pokes his head in...

Forum statistics

Threads
116,008
Messages
1,094,885
Members
151,323
Latest member
yuyucomi
Top