JavaScript questions that don't deserve their own thread

Sketchward

Veteran
Veteran
Joined
Jul 26, 2016
Messages
111
Reaction score
8
First Language
English
Primarily Uses
RMMV
change the span to Turn instead of Battle so that the event with the script runs once every turn instead of once every battle
Yep that fixed it, works perfectly now. Thanks very much
 

Sketchward

Veteran
Veteran
Joined
Jul 26, 2016
Messages
111
Reaction score
8
First Language
English
Primarily Uses
RMMV
Second question,

I have a picture that I use as a screen effect/filter/overlay that's constantly visible during gameplay. When I enter battles, it goes away. I've tried to make it appear again on Turn 0, but it noticeably starts the battle without the picture displayed, then begins to display it 1 or 2 seconds later. Is there a way to make a picture overlay transition into battle screens smoothly?
 

Topaz

Warper
Member
Joined
Apr 19, 2012
Messages
3
Reaction score
1
First Language
English
Primarily Uses
RMMV
(For MV) I want to change the x anchor in rpg_sprites.js for state icons (seen in the code below), but I want to make the anchor value variable on whether the battler is an actor or an enemy. Is there a simple if,else condition that would check if the current this being affected is an actor or enemy?


JavaScript:
Sprite_StateIcon.prototype.initMembers = function() {
    this._battler = null;
    this._iconIndex = 0;
    this._animationCount = 0;
    this._animationIndex = 0;
//Want to add an if,else that tests if sprite is actor or enemy (and defaults to 0.5 if neither to catch any errors)
    this.anchor.x = 0.5;
    this.anchor.y = 0.5;
};
Thanks!
 
Last edited:

merboy22

Warper
Member
Joined
Sep 5, 2020
Messages
3
Reaction score
0
First Language
English
Primarily Uses
RMMV
Hey everyone, I'm recovering a file that got a bug. I'm copy pasting all the original game's files to a new game. I haven't copy pasted any data over because I don't know how to tell which data is bugged, but I realized this means I can't view my maps in the new game's map window (bottom left) because they are .json files. I can still access the maps in the playtest, but can't edit them. I'm wondering if any one has tips about how to safely move data over when there might be a bug in the data. I've never really coded before so don't know how bugs work.

Could I just copy paste the new project's current "MapInfos.json" file to my desktop as a backup, so that if pasting the original game's data doesn't solve the problem I can switch them out again? Or do I run the risk of giving the new game a bug by doing that?
 

SpacemanFive

Meteor Mage
Veteran
Joined
Jun 25, 2013
Messages
207
Reaction score
24
First Language
English
Primarily Uses
What should I do if a plugin creator only made their plugin available in raw text, and my computer doesn't have the ability to create js files (even by manual .js suffix adding)?
 

orochii

Abomination of life, or life itself.
Veteran
Joined
Apr 29, 2012
Messages
652
Reaction score
363
First Language
Spanish
Fix your computer.

What operating system? Windows, Linux, MacOS?
 

CHKNRAVE

Surprisingly not sponsored by Yanfly.
Veteran
Joined
May 11, 2020
Messages
114
Reaction score
65
First Language
French
Primarily Uses
RMMV
In MV, is there a condition I can write that's valid only if a skill from the user crits? It's going to be put in a state's Custom Establish Effect.

I made it so that weapon attacks and some skills generate TP.
I've got a passive state that forces a crit on the next action, its condition is that the user needs to have 100 TP.
This state has the Custom Establish Effect in question, and is here to remove 100 TP if the state's wearer performs a critical hit.
So I just need a condition that detects if the action that was just performed by the wearer was a crit.

EDIT: if(target.result().critical) works.
 
Last edited:

CHKNRAVE

Surprisingly not sponsored by Yanfly.
Veteran
Joined
May 11, 2020
Messages
114
Reaction score
65
First Language
French
Primarily Uses
RMMV
What should I do if a plugin creator only made their plugin available in raw text, and my computer doesn't have the ability to create js files (even by manual .js suffix adding)?
Are file extensions showing in your file explorer?
If not, a txt file would appear as "script", and putting the js extension at the end would change its real file name to "script.js.txt".
If file extensions are showing, replace ".txt" at the very end with ".js" and the file type will actually change this time.
 
Last edited:

SpacemanFive

Meteor Mage
Veteran
Joined
Jun 25, 2013
Messages
207
Reaction score
24
First Language
English
Primarily Uses
Are file extensions showing in your file explorer?
If not, a txt file would appear as "script", and putting the js extension at the end would change its real file name to "script.js.txt".
If file extensions are showing, replace ".txt" at the very end with ".js" and the file type will actually change this time.
Thank you! Apparently I'd missed the option to *enable* displaying file extensions, so when I tried to manually change the file extension previously the system didn't recognize it.
 

Vis_Mage

Novice Magician
Veteran
Joined
Jul 28, 2013
Messages
551
Reaction score
185
First Language
English
Primarily Uses
RMMV
Is there a script call I can use in conjunction with this one to get the database ID of an enemy (as opposed to the enemy's troop ID), and store it in a variable?

BattleManager._action._subjectEnemyIndex
 

CHKNRAVE

Surprisingly not sponsored by Yanfly.
Veteran
Joined
May 11, 2020
Messages
114
Reaction score
65
First Language
French
Primarily Uses
RMMV
According to this topic, using b.enemyId() will return the database ID of the enemy.


My turn to ask a question: how do I see / change how the Luck stat influences state application?
I want the chance of applying to be 50% if the luck of the user and the target are even, and inch towards 100% and 0% (never fully reaching them) if one is higher than the other.
Also, I have no idea what the formula would be for that. I was thinking about (a.luk/b.luk)/100+(a.luk/b.luk), but it doesn't cover states I want to always apply and using b.addState would display 0 damage on state-only skills.
 
Last edited:

PauloHPBender

Delirious Storyteller
Veteran
Joined
Oct 16, 2015
Messages
92
Reaction score
22
First Language
Portuguese
Primarily Uses
N/A
Howdy, developers!

How do I:
- Completely nullify TP natural Gain?
- Hide TP Bars outside of battles?

I want TP Bars only to be shown in battle, and each character will have it's own methods of gaining TP.
 

CHKNRAVE

Surprisingly not sponsored by Yanfly.
Veteran
Joined
May 11, 2020
Messages
114
Reaction score
65
First Language
French
Primarily Uses
RMMV
Hi y'all.

While using the Buffs and States Core, is there a way to point at the user of the skill in a Custom Apply Effect?
I want the user to apply a state on the target, who will then give the user another state in return.

I could've used the formula bar and just done a.addState(X), but the state is given by a skill that does no damage / recovery so I'd end up with a 0 damage pop-up which isn't desirable.
 

kiriseo

Veteran
Veteran
Joined
Oct 27, 2015
Messages
244
Reaction score
81
First Language
German
Iirc, you get the user of the skill by using "user". "a" should also work.
 

CHKNRAVE

Surprisingly not sponsored by Yanfly.
Veteran
Joined
May 11, 2020
Messages
114
Reaction score
65
First Language
French
Primarily Uses
RMMV
And that's the issue, it works for action effects (from Initiate to Conclude and Select to Deselect) but not for timing effects like Apply.
 

kiriseo

Veteran
Veteran
Joined
Oct 27, 2015
Messages
244
Reaction score
81
First Language
German
hmm... it should still work.
there are only two places in that plugin that have the customEvalEffect method to process them.
Once in Game_Action (for initiate, select, deselect, conclude, react, confirm, respond, establish)
and once in Game_Battler (for add [includes apply], remove, leave, turn start, turn end, regenerate, action start, action end).
In both methods "user" and "target" are assigned their values.

can you post your notetag?

/Edit:
alright, I did a quick test.
I added the "Fascination" state to a skill and tried to give the actor who uses that skill the "Immortal" state when he applies "Fascination" to an enemy.
"user" gives "Immortal" to the target who gets "Fascination", so you have to use "origin" instead.

 
Last edited:

CHKNRAVE

Surprisingly not sponsored by Yanfly.
Veteran
Joined
May 11, 2020
Messages
114
Reaction score
65
First Language
French
Primarily Uses
RMMV
Hell yeah, origin. works as planned. Thank you!
 

joepmeloen

Veteran
Veteran
Joined
Feb 23, 2019
Messages
38
Reaction score
11
First Language
Dutch
Primarily Uses
RMMV
Hey everyone, I'm recovering a file that got a bug. I'm copy pasting all the original game's files to a new game. I haven't copy pasted any data over because I don't know how to tell which data is bugged, but I realized this means I can't view my maps in the new game's map window (bottom left) because they are .json files. I can still access the maps in the playtest, but can't edit them. I'm wondering if any one has tips about how to safely move data over when there might be a bug in the data. I've never really coded before so don't know how bugs work.

Could I just copy paste the new project's current "MapInfos.json" file to my desktop as a backup, so that if pasting the original game's data doesn't solve the problem I can switch them out again? Or do I run the risk of giving the new game a bug by doing that?
Make a new game, and create as much as new empty maps as your old game.
Then copy amd past all the maps from the old game to the newly created game?

What should I do if a plugin creator only made their plugin available in raw text, and my computer doesn't have the ability to create js files (even by manual .js suffix adding)?
Past the raw codes into a new notepad file. Then save as
"Plugin.js", make sure you use the " " when you safe the file.
 

Lanzy

Veteran
Veteran
Joined
Feb 29, 2020
Messages
123
Reaction score
50
First Language
English
Primarily Uses
RMMV
Howdy, developers!

How do I:
- Completely nullify TP natural Gain?
- Hide TP Bars outside of battles?

I want TP Bars only to be shown in battle, and each character will have it's own methods of gaining TP.
Are you still looking for a solution? If so, let me know and I'll help you out.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 2)

Latest Threads

Latest Posts

Latest Profile Posts

Yesterday I made my first step towards eating more healthily.
I saw candy on discount and did not buy it.
"They yearn for what they fear for."
I always told my DA fans how much I hate slot machines. They're fine in games as a risk-and-reward system. But when you're spending REAL MONEY in a Vegas casino to try and hit the jackpot (which very, very few people will), it can really hurt your budget. Gambling is a bad habit, and I don't like wasting my money on a slim chance. Go to Vegas for the experience, not the jackpot.
Took the kids to a corn maze. They gave us a map and had lights at certain points in the maze. Not overwhelming... or underwhelming... just... whelming.
Okay, vacuuming fruit flies out of the air is surprisingly effective.

Forum statistics

Threads
104,393
Messages
1,006,073
Members
135,927
Latest member
ecelebrithytrend
Top