JavaScript questions that don't deserve their own thread

Rigor Mortex

Mankind's Mirror
Veteran
Joined
Mar 14, 2012
Messages
58
Reaction score
3
First Language
English
Primarily Uses
In MV, how can I set up a skill that randomly hits X number of times, but can't hit the same target more than Y number of times, and ends the skill as soon as the latter limit is reached? Examples:
  1. Skill A: Randomly attacks 10 times, but can't target a given enemy more than 4 times. Against a Troop of one enemy, or a Party of one, it would hit the sole unit four times, and then end without the other six hits coming into play.
  2. Skill B: Randomly attacks 8 times, but can't target a given enemy more than 2 times. Against a Troop or Party of four, provided they were all alive, each unit would take two hits.
I should note I have most of Yanfly's Plugins, and not much else atm. On that note, I actually tried changing the numbers in the "Chain Lightning" Tip/Trick they'd posted, first, believing that would be sufficient, but it didn't work at all.
 

Restart

Veteran
Veteran
Joined
Mar 15, 2019
Messages
311
Reaction score
204
First Language
English
Primarily Uses
RMMV
I'm trying to figure out how to keep track of the number of basic attacks a character makes. I don't think it can be done by eventing, and I don't know how it would be scripted. Anyone know? Best regards.
It'd be considerably easier to only track hits - you can do that just by sticking a counter into the damage formula, wrapped in an if statement that checks which character is attacking.

If you want to be more elaborate, easiest way is to use yanfly's action sequence pack to increment the counter in the first phase of your basic attack, before it hits or misses.
 

Bryling

Warper
Member
Joined
Aug 16, 2019
Messages
3
Reaction score
0
First Language
English
Primarily Uses
RMXP
It'd be considerably easier to only track hits - you can do that just by sticking a counter into the damage formula, wrapped in an if statement that checks which character is attacking.

If you want to be more elaborate, easiest way is to use yanfly's action sequence pack to increment the counter in the first phase of your basic attack, before it hits or misses.
Thanks, Restart. I'll try that.
 

Bryling

Warper
Member
Joined
Aug 16, 2019
Messages
3
Reaction score
0
First Language
English
Primarily Uses
RMXP
Sorry, I have another question. It's about a plugin: NeMV Tags. I can figure out the basics, but I'm completely stumped on this. I'm trying to have a weapon inflict 20% more damage when used on a enemy tagged "monster". I'm not really sure how I would do this though. Anyone familiar with the plugin and knows how it's done?
 

Myst88

Veteran
Veteran
Joined
Jul 3, 2012
Messages
95
Reaction score
181
First Language
English
Primarily Uses
Hope this is the right thread for this. Don't think it needs its own thread... I just bought Atelier Irina's new plugin. It's a recruiting board that allows me to hire party members. Only problem I'm facing is that it allows me to buy them all at once, it's not taking the party limit into account. There is a bit in the Lunatic mode that allows the user to customise the recruiting process.

<Custom Recruit Enable>
JavaScript Code
JavaScript Code
enable = JavaScript Code
</Custom Recruit Enable>
- Replace the JavaScript Code inside the notetags with JavaScript.
This code will determine custom enable requirements for the recruit list.
- 'actor' variable will refer to the actor being recruited.
- 'enable' variable is a true/false that determines if recruiting is enabled


So basically my question is, is there a code to make it possible to only enable a actor to be recruited if the party limit has not been reached? (Basically if i have 4 party members I will have to get rid of one to be able to recruit more?
 

Ossra

Formerly Exhydra
Veteran
Joined
Aug 21, 2013
Messages
963
Reaction score
701
First Language
English
Primarily Uses
RMMV
@Myst88 Hmm, well, I do not have access to the plugin to check, so the following is a bit of a guess on my part :

Code:
<Custom Recruit Enable>
enable = $gameParty.size() < 4;
</Custom Recruit Enable>
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
571
Reaction score
320
First Language
English
Primarily Uses
RMMV
Hope this is the right thread for this. Don't think it needs its own thread... I just bought Atelier Irina's new plugin. It's a recruiting board that allows me to hire party members. Only problem I'm facing is that it allows me to buy them all at once, it's not taking the party limit into account. There is a bit in the Lunatic mode that allows the user to customise the recruiting process.

<Custom Recruit Enable>
JavaScript Code
JavaScript Code
enable = JavaScript Code
</Custom Recruit Enable>
- Replace the JavaScript Code inside the notetags with JavaScript.
This code will determine custom enable requirements for the recruit list.
- 'actor' variable will refer to the actor being recruited.
- 'enable' variable is a true/false that determines if recruiting is enabled


So basically my question is, is there a code to make it possible to only enable a actor to be recruited if the party limit has not been reached? (Basically if i have 4 party members I will have to get rid of one to be able to recruit more?
Code:
<Custom Recruit Enable>
   if ($gameParty.members().length >= 4){
   enable = false
   } else {
   enable = true
   }
</Custom Recruit Enable>
That should do it.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,039
Reaction score
10,258
First Language
Czech
Primarily Uses
RMMV
@Okk it's the last line of

Code:
Window_PartyCommand.prototype.makeInBattleStatusCommand = function() {
  if (!$gameSystem.isShowInBattleStatus()) return;
  var index = this.findSymbol('escape');
  var text = Yanfly.Param.IBSCmdName;
  this.addCommandAt(index, text, 'inBattleStatus', true);
};
if you're searching for a way to add command. If you want to merely call the window, it's more complicated than that as you need to hide everything and then show that window.

But you show the window using
Code:
SceneManager._scene.commandInBattleStatus();
 

Okk

Veteran
Veteran
Joined
Apr 24, 2015
Messages
46
Reaction score
10
First Language
English
Primarily Uses
if you're searching for a way to add command. If you want to merely call the window, it's more complicated than that as you need to hide everything and then show that window.

But you show the window using
I'm having some trouble. I managed to add a Status command to the actor command menu in battle, but it doesn't actually do anything. Maybe it's an issue with the privacy of Yanfly's command symbol? I don't really know javascript well enough to be sure.
I also tried calling it in a common event, and you were right about that being more complicated; it called the status window, but never went back to the command menu, effectively soft locking the game.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,039
Reaction score
10,258
First Language
Czech
Primarily Uses
RMMV
No, I forgot to attach the setHandler.

The last two lines show the attachment of the handler.

Code:
Yanfly.IBS.Scene_Battle_createPartyCommandWindow =
  Scene_Battle.prototype.createPartyCommandWindow;
Scene_Battle.prototype.createPartyCommandWindow = function() {
  Yanfly.IBS.Scene_Battle_createPartyCommandWindow.call(this);
  var win = this._partyCommandWindow;
  win.setHandler('inBattleStatus', this.commandInBattleStatus.bind(this));
};
I've also made some MV Javascript tutorial series if you're interested in knowing more.
 

Okk

Veteran
Veteran
Joined
Apr 24, 2015
Messages
46
Reaction score
10
First Language
English
Primarily Uses
No, I forgot to attach the setHandler.

The last two lines show the attachment of the handler.

Code:
Yanfly.IBS.Scene_Battle_createPartyCommandWindow =
  Scene_Battle.prototype.createPartyCommandWindow;
Scene_Battle.prototype.createPartyCommandWindow = function() {
  Yanfly.IBS.Scene_Battle_createPartyCommandWindow.call(this);
  var win = this._partyCommandWindow;
  win.setHandler('inBattleStatus', this.commandInBattleStatus.bind(this));
};
I've also made some MV Javascript tutorial series if you're interested in knowing more.
No luck, just a bunch of undefined errors. This is a more complicated problem than I thought.
And apparently you can't actually program anything without knowing the "Syntax" or whatever.
 

ZankokuNoYami

Veteran
Veteran
Joined
May 11, 2018
Messages
55
Reaction score
15
First Language
English
Primarily Uses
N/A
Hoping this is the right place. I don't know if it deserves it's own thread. Not sure where just a 'general discussion' section is, but this sounded like it?

Alright. So I am importing my maps from XP to MV. Naturally, huge hurdle. However, I have been told about things like TileD. Which would ultimately lead into parallax mapping, right?

What is THE best plugin for having multiple parallax levels? Something that wont conflict with other scripts like MOG's Weather (since that seems to have multiple weather layers).

When looking it up, I only found old threads. One from 2015 saying to not use Bind Pictures to Map due to huge memory issues. I also had read that RMMV had memory leaking issues to begin with... but in 2016, a thread mentioned an update 1.3.2 that fixed the memory leak issue.

I am essentially planning to do a lot of things. And I want my game to run as smoothly as possible without eating up memory or costing FPS.

Any plugin ideas would be greatly appreciated!
 

Almightypebble

Veteran
Veteran
Joined
Jan 13, 2017
Messages
69
Reaction score
1
First Language
Bulgarian
Primarily Uses
RMMV
Hey, guys!

So I'm using SRD's Battle Status Customizer, and I'm showing some text through it, like: `Health[${actor.hp}/${actor.mhp}]`
I'm wondering how can I make it so that the ${actor.xx} values are a different color, since text codes don't seem to work there.
I tried with \C[x] but it doesn't work. Since it says in the description that it should be a javascript evaluation,
I'm guessing I should use a script for the color change as well? I just don't know what the script would be.

Cheers!
 

Ossra

Formerly Exhydra
Veteran
Joined
Aug 21, 2013
Messages
963
Reaction score
701
First Language
English
Primarily Uses
RMMV
@Almightypebble Hmm, if it is evaluating the script, then try the following :

Code:
// 'colorId' points to the colors on the windowskin
this.changeTextColor(colorId);

// Then after your code, reset the color ...
this.resetTextColor();
 

Almightypebble

Veteran
Veteran
Joined
Jan 13, 2017
Messages
69
Reaction score
1
First Language
Bulgarian
Primarily Uses
RMMV
@Ossra
Ah, if I try that it just returns the new color eval as undefined.
So if I use:
`Health[${this.changeTextColor(10)}${actor.hp}]`
it shows up as:
Health[undefined100]
 

Ossra

Formerly Exhydra
Veteran
Joined
Aug 21, 2013
Messages
963
Reaction score
701
First Language
English
Primarily Uses
RMMV
@Almightypebble Ah, yeah, actually looking at the code, what I suggested will not work. I do not think there is a way to do so without modifying the plugin.
 

BurningOrca

Veteran
Veteran
Joined
Apr 14, 2019
Messages
111
Reaction score
90
First Language
German
Primarily Uses
RMMV
Is it good or bad thinking to keep plugins private, because of knowing that there exist already at least one (probably better) plugin from another author, that serves the same purpose?
 

Anarcho-paladin

Veteran
Veteran
Joined
Feb 24, 2014
Messages
115
Reaction score
13
First Language
French
Primarily Uses
Is it good or bad thinking to keep plugins private, because of knowing that there exist already at least one (probably better) plugin from another author, that serves the same purpose?
Is it a JavaScript related question, or simply one about etiquette? If it's a question about JavaScript, I don't understand it.
 

Users Who Are Viewing This Thread (Users: 1, Guests: 3)

Latest Threads

Latest Posts

Latest Profile Posts

Can't wait for the next Sonichu
Birdhouses are usually made of wood. Birds typically live in trees. Trees are wood. Birdhouses are made of birdhouses.
He just discovered cellphones...

(I don't know why am I drawing so much these days...)
In medieval times, a common way to eat food was upon edible plates, which were made of bread, called trenchers.

Forum statistics

Threads
93,668
Messages
914,416
Members
123,254
Latest member
Ragnamano
Top