JavaScript questions that don't deserve their own thread

Mr. Detective

NATO Special Operative
Veteran
Joined
Sep 9, 2012
Messages
861
Reaction score
332
First Language
English
Primarily Uses
N/A
I'm using MogHunter's splash screen on MZ. I'd like to start the intro music right on the splash screen, instead of having to wait until the players get to the title screen. How do I do this? Guess I'll need a little plugin? X3
 

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
637
Reaction score
211
First Language
English
Primarily Uses
RMMV
Would someone be able to help me create a script call that checks if an actor (ActorID equal to variable 20) has any of 5 different skills, and if they do, turn a switch on, and add 1 to a different variable for each of those 5 skills they have? (For example, if the actor has 3 of the skills being checked, then the variable gets +3 added to it, and the switch gets turned on)

I found a seemingly similar bit of code from @ramza a few months back, that I believe can be adjusted to do what I'm hoping to accomplish:

Code:
    var listofskills = [1,2,3,4,5,6,7,8,9]
    var knownskills = []
    for (var i = 0; i < listofskills.length; i++){
        if (user.isLearnedSkill(listofskills[i])) knownskills.push(true)
    }
    if (knownskills.length >= 5){
        value = true
    } else {
        value = false
    }
 

CHKNRAVE

Surprisingly not sponsored by Yanfly.
Veteran
Joined
May 11, 2020
Messages
216
Reaction score
124
First Language
French
Primarily Uses
RMMV
Hi everybody. I'm trying to change the code of the Battle Status Window script so that the sprites are displayed over the window. It's an issue because I'm trying to replace the character's face with the animated sideview character, and the sprite is only visible through the window's transparency.

Can somebody tell me what I need to move around?
 

boikish

Always trying to help :)
Veteran
Joined
Sep 8, 2016
Messages
162
Reaction score
49
First Language
English
Primarily Uses
N/A
Working with Yanfly's Critical Control plugin: http://www.yanfly.moe/wiki/Critical_Control_(YEP)

Having an issue where subtracting a percentage from Critical Multipliers just doesn't seem to work:
1609084561926.png

Switching the `-` to a `+` works perfectly, but I'm looking to lower critical hit damage when a certain state is applied. Anyone have any experience with this, or have a clue why subtracting wouldn't work?
 

Boonty

Veteran
Veteran
Joined
Oct 10, 2018
Messages
128
Reaction score
49
First Language
French
Primarily Uses
RMMV
Use this instead no?

<Critical Rate Formula>
rate -= 0.15;
</Critical Rate Formula>
 

boikish

Always trying to help :)
Veteran
Joined
Sep 8, 2016
Messages
162
Reaction score
49
First Language
English
Primarily Uses
N/A
The <Critical Rate/Multiplier Formula> tags are for use in Skills/Items.

I'm looking to make the change in a state. It works for addition, but not subtraction, and I'm unsure why.
 

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
637
Reaction score
211
First Language
English
Primarily Uses
RMMV
Bumping a question of mine from about a week ago:

Would someone be able to help me create a script call that checks if an actor (ActorID equal to variable 20) has any of 5 different skills, and if they do, turn a switch on, and add 1 to a different variable for each of those 5 skills they have? (For example, if the actor has 3 of the skills being checked, then the variable gets +3 added to it, and the switch gets turned on)

I found a seemingly similar bit of code from @ramza a few months back, that I believe can be adjusted to do what I'm hoping to accomplish:

Code:
    var listofskills = [1,2,3,4,5,6,7,8,9]
    var knownskills = []
    for (var i = 0; i < listofskills.length; i++){
        if (user.isLearnedSkill(listofskills[i])) knownskills.push(true)
    }
    if (knownskills.length >= 5){
        value = true
    } else {
        value = false
    }
 

CHKNRAVE

Surprisingly not sponsored by Yanfly.
Veteran
Joined
May 11, 2020
Messages
216
Reaction score
124
First Language
French
Primarily Uses
RMMV
Hi everybody, this one should be less technical than usual.

One of the enemies I've set up has an AI (from Battle AI Core) that includes a skill. That skill has a passive state that I don't want on enemies, so of course I'll use the following code in the state's notes so that enemies can't have it:
JavaScript:
<Custom Passive Condition>
if(user.isActor()) {
  condition = true;
} else {
  condition = false;
}
</Custom Passive Condition>
But for some reason, this condition doesn't work.
I tried putting just condition = false to see what's wrong, and the passive state still appears on everybody that knows the skill, as if the conditions for this specific state were entirely ignored.

Can somebody help me with troubleshooting this?
 
Last edited:

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
637
Reaction score
211
First Language
English
Primarily Uses
RMMV
Simpler question this time, how would I divide a variable by 2 (using eval, since I'm using this in a notetag for Yanfly's Buff and State Core)?
 

Oxem

Villager
Member
Joined
Sep 30, 2015
Messages
10
Reaction score
2
First Language
French
Primarily Uses
Hi there, sorry for interrupting, but i just resolve a problem and i wanted to share it with you guys maybe it will make you gain some time in the future :
When you use the tcr parameter in order to upgrade or downgrade tp gain, the engine by default don't Math.round the final value. I was really surprised to learn that because in battle by default you juste have on screen some infinite number after decimal for tp.

You just need to go in rpg_objects.js line 3196 and just add some Math.round

Game_Battler.prototype.gainTp = function(value) {
this._result.tpDamage = Math.round(-value * this.tcr);
this.setTp(this.tp + Math.round(value * this.tcr));
};
 

Elisabelle

Warper
Member
Joined
Aug 26, 2018
Messages
1
Reaction score
0
First Language
English
Primarily Uses
RMMV
Hi :( I installed Yanfly Core Engine and (underneath) Yanfly Core Message in the Plugins as described on the website. I have a new project and on the guide it says I can add \n<x> anywhere in the message window to get a namebox. I tried this by putting \n<James>, but all that happens is that the in-game dialogue displays <James>. I tried \n<2> instead and it also just gives me <2>. I have no other plugins and this is a fresh install on a PC I received last week. I have no other projects and am a bit confused why it is not working when everything was downloaded from Yanfly's site 30min ago. Thank you!

I attached an example. When I run the game, it appears exactly like that. No namebox. I also tried putting the \n<James> at the beginning of the message and the result is the same.

[EDIT] Regional Restrictions also is not working. I followed the guide for that as well. The three Yanfly plugins are in the right order and turned on in Plugins. I edited the Regional Restrictions so that events cannot past through Region 3, but they go through it anyway. I'm trying to contain my fish to the lake.
 

Attachments

  • example.PNG
    example.PNG
    106.6 KB · Views: 4
Last edited:

MiddleMang

Villager
Member
Joined
Jan 24, 2019
Messages
15
Reaction score
2
First Language
English
Primarily Uses
RMMV
Hello, I'm using all of yanfly's plugins on MV and I'm trying to make an item with a passive state that converts the current game party gold into defense, but only while equipped. The problem is that I don't think <Custom Apply Effect> works because it's passive rather than something cast on the target, and...

<Custom Battle Effect>
user.addDef($gameParty.gold());
</Custom Battle Effect>

<Custom Remove Effect>
user.clearParamPlus()
</Custom Remove Effect>

Only updates every battle, and does not reflect the defense buff in the menu after gaining more gold. Is there any <Custom Effect> tag that fits the bill? I'd like to have the stats be reflected, and when the item is unequipped, have the bonuses disappear.
 

CHKNRAVE

Surprisingly not sponsored by Yanfly.
Veteran
Joined
May 11, 2020
Messages
216
Reaction score
124
First Language
French
Primarily Uses
RMMV
Hello, I'm using all of yanfly's plugins on MV and I'm trying to make an item with a passive state that converts the current game party gold into defense, but only while equipped. The problem is that I don't think <Custom Apply Effect> works because it's passive rather than something cast on the target, and...

<Custom Battle Effect>
user.addDef($gameParty.gold());
</Custom Battle Effect>

<Custom Remove Effect>
user.clearParamPlus()
</Custom Remove Effect>

Only updates every battle, and does not reflect the defense buff in the menu after gaining more gold. Is there any <Custom Effect> tag that fits the bill? I'd like to have the stats be reflected, and when the item is unequipped, have the bonuses disappear.
Set the custom battle effect to change that state's counter to the amount of Gold the party has (user.setStateCounter(X, $gameParty.gold())).
Then, use user.addDef(user.getStateCounter(X)) to add the Defense stat. Make sure the Defense cap (Base Parameter Control plugin settings) is high enough to not be hit.
In all effects that happen at the end of battles (Victory, Defeat, Escape), use user.minusDef(user.getStateCounter(X)) to end the effect.

Notes: might not work if that item can be removed from the wearer mid-battle. Won't adapt to gold gains in the middle of a battle. Won't appear in the menus, it would've worked very easily if we could use the <stat Plus: +x> tag.
 

MiddleMang

Villager
Member
Joined
Jan 24, 2019
Messages
15
Reaction score
2
First Language
English
Primarily Uses
RMMV
Set the custom battle effect to change that state's counter to the amount of Gold the party has (user.setStateCounter(X, $gameParty.gold())).
Then, use user.addDef(user.getStateCounter(X)) to add the Defense stat. Make sure the Defense cap (Base Parameter Control plugin settings) is high enough to not be hit.
In all effects that happen at the end of battles (Victory, Defeat, Escape), use user.minusDef(user.getStateCounter(X)) to end the effect.

Notes: might not work if that item can be removed from the wearer mid-battle. Won't adapt to gold gains in the middle of a battle. Won't appear in the menus, it would've worked very easily if we could use the <stat Plus: +x> tag.
Thanks a bunch, really appreciate it. Are you saying that the <stat Plus: +x> can work or it doesn't work with $gameParty.gold()?
 

CHKNRAVE

Surprisingly not sponsored by Yanfly.
Veteran
Joined
May 11, 2020
Messages
216
Reaction score
124
First Language
French
Primarily Uses
RMMV
Thanks a bunch, really appreciate it. Are you saying that the <stat Plus: +x> can work or it doesn't work with $gameParty.gold()?
You might as well try, but as far as I know it's a tag in which the x has to be a number and not a formula.
 

UniqueName

Veteran
Veteran
Joined
Nov 12, 2018
Messages
83
Reaction score
13
First Language
Russian
Primarily Uses
Other
Hey guys, I really need some advanced javascript advice. So I have a string "Gen0Ba3" and I need to check if "Ba3" is in it. Usually, I'd do "Gen0Ba3".match(/Ba3/) but the problem is that the number after "Ba" is random and after "Ba(number)" there may be random letters. For example, it may be "Gen0Ba31Dn" and "Gen0Ba31Dn".match(/Ba3/) would still match despite the fact the number is different. How can I make it so that it would only match "Ba" and the number as a whole?
 

Kyuukon

主人公
Veteran
Joined
Aug 22, 2013
Messages
2,256
Reaction score
1,116
First Language
Spanish
Primarily Uses
RMMV
What's the script call to refresh all events on the map?
 

Latest Threads

Latest Posts

Latest Profile Posts

Signed a lease on a new place today. Back into town, closer to shops, family and takeaway - none of those could be a good thing! 10 days to moving date.
let me introduce you to my worlds source of "wool". A pretty simple-minded, easily scared and mostly blind, double-headed big wooly bird thingy :D Children may be able to ride on a trained one, but they don't support the weight of adults, so they aren't suitable for transportation. And herders use the shown tool to give them sound commands
6nwyqEJ.png
This Life is a Dream is in full production! More pics and some free promo assets coming soon!
Dragonfly3116 wrote on Redweaver's profile.
i need to ask do you mind sending me a link to tutorial town an legend of ancients Please My new Email is necroboy1973@gmail.com
I Am A Member On The Site Here As Well If Your Still teaching Let Me Know Thanks Joseph

Forum statistics

Threads
110,530
Messages
1,053,956
Members
143,618
Latest member
Flauschifluff
Top