JavaScript questions that don't deserve their own thread

Dicleon

Villager
Member
Joined
Apr 3, 2016
Messages
20
Reaction score
3
First Language
French
Primarily Uses
Ok that could help me a lot, Thanks ! But my big problem is : i don't know how to activate the state only when i change target.
If you found something i'll be glad to see it ! Because i try everything ! Thanks again !

EDIT 1: Yeah, that's what I though.
The bomb system looks good, i'll maybe do something like that.
Thanks again !

EDIT 2 : I did something else, when you hit target, the skill give you 1 counter, and after 3 counter, the skill damage 2 enemies for a big amount of damage !

<Custom Confirm Effect>
if (this.isSkill(473) && target.isActor() !== user.isActor()) {
user.addStateCounter(stateId, 1);
user.clampStateCounter(stateId, 0, 3);
if (user.getStateCounter(stateId) >= 3) {
user.removeStateCounter(stateId);
var elementId = 1;
var damage = user.atk * 2.6 - target.def;
if (target.result().critical) {
damage = this.applyCritical(damage);
}
var members = this.opponentsUnit().aliveMembers();
target.startAnimation(130);
var extraTargets = 1;
while (extraTargets--) {
var member = members[Math.floor(Math.random() * members.length)];
if (member) {
member.startAnimation(130);
member.gainHp(-Math.ceil(damage * member.elementRate(elementId)));
member.startDamagePopup();
member.clearResult();
members.splice(members.indexOf(member), 1);
if (member.isDead()) {
member.performCollapse();
}
}
}
}
}
</Custom Confirm Effect>

If anyone need something like this ! (put in state and add <Equip State: x> from yanfly auto passives states.)
Regards !
Very nice i could see myself do something in that way!
 

Enviona

Villager
Member
Joined
Apr 8, 2020
Messages
5
Reaction score
0
First Language
English
Primarily Uses
RMMV
Not exactly sure what is wrong here.
This is not a plugin request, or ask, however, I am using a plugin that should be mentioned for context.
I am using YEP_CommonEventMenu to create a custom menu where the player will be able to track their reputation with various factions.
I could do this all through eventing, however, that feels like it would be rather messy, so I wanted to do a script call for it.

What I can't understand is why this refuses to work:
$gameMessage.setBackground(2);
$gameMessage.setPositionType(2);
var fac1 = $gameVariables.value(21);
var facRank1 = "Neutral";
var facRank2 = "Friendly";
var facRank3 = "Honoured";
var facRank4 = "Revered";
var facRank5 = "Exalted";

if ($gameVariables.value(21) < 20) {
$gameMessage.add("Faction 1: " + fac1 + " - " + facRank1 + ".\n");
} else if ($gameVariables.value(21) => 20 && <40) {
$gameMessage.add("Faction 1: " + fac1 + " - " + facRank2 + ".\n");
} else if ($gameVariables.value(21) => 40 && <60) {
$gameMessage.add("Faction 1: " + fac1 + " - " + facRank3 + ".\n");
} else if ($gameVariables.value(21) => 60 && <80) {
$gameMessage.add("Faction 1: " + fac1 + " - " + facRank4 + ".\n");
} else {
$gameMessage.add("Faction 1: " + fac1 + " - " + facRank5 + ".\n");
}

(I have a condensed version to fit into the 12-line requirements of the editor)

What it should be doing is creating a message box that will display the Value of Variable 21 and give it a ranking, dependant on the value.

Instead, it does nothing and the console gives me less than helpful information.
When used in my current project, it references random plugins that I am using.
So I tried it in a fresh project and it said "unexpected token else" which, I can't figure out why that would be wrong, but hey, what do I know, right?

So, here I am. Beyond confused as to why this isn't doing what it should be o_O
If anyone could help shed some light on this, that would be appreciated.
 
Last edited:

Diluiksapu

Villager
Member
Joined
Mar 4, 2020
Messages
15
Reaction score
1
First Language
French
Primarily Uses
RMMV
Not exactly sure what is wrong here.
This is not a plugin request, or ask, however, I am using a plugin that should be mentioned for context.
I am using YEP_CommonEventMenu to create a custom menu where the player will be able to track their reputation with various factions.
I could do this all through eventing, however, that feels like it would be rather messy, so I wanted to do a script call for it.

What I can't understand is why this refuses to work:
$gameMessage.setBackground(2);
$gameMessage.setPositionType(2);
var fac1 = $gameVariables.value(21);
var facRank1 = "Neutral";
var facRank2 = "Friendly";
var facRank3 = "Honoured";
var facRank4 = "Revered";
var facRank5 = "Exalted";

if ($gameVariables.value(21) < 20) {
$gameMessage.add("Faction 1: " + fac1 + " - " + facRank1 + ".\n");
} else if ($gameVariables.value(21) => 20 && <40) {
$gameMessage.add("Faction 1: " + fac1 + " - " + facRank2 + ".\n");
} else if ($gameVariables.value(21) => 40 && <60) {
$gameMessage.add("Faction 1: " + fac1 + " - " + facRank3 + ".\n");
} else if ($gameVariables.value(21) => 60 && <80) {
$gameMessage.add("Faction 1: " + fac1 + " - " + facRank4 + ".\n");
} else {
$gameMessage.add("Faction 1: " + fac1 + " - " + facRank5 + ".\n");
}

(I have a condensed version to fit into the 12-line requirements of the editor)

What it should be doing is creating a message box that will display the Value of Variable 21 and give it a ranking, dependant on the value.

Instead, it does nothing and the console gives me less than helpful information.
When used in my current project, it references random plugins that I am using.
So I tried it in a fresh project and it said "unexpected token else" which, I can't figure out why that would be wrong, but hey, what do I know, right?

So, here I am. Beyond confused as to why this isn't doing what it should be o_O
If anyone could help shed some light on this, that would be appreciated.

Their is a beautifull Faction System from KISS "https://forums.rpgmakerweb.com/index.php?threads/kiss-faction-system.72511/"

If that's can help you !
 

Enviona

Villager
Member
Joined
Apr 8, 2020
Messages
5
Reaction score
0
First Language
English
Primarily Uses
RMMV
Their is a beautifull Faction System from KISS "https://forums.rpgmakerweb.com/index.php?threads/kiss-faction-system.72511/"

If that's can help you !
I appreciate the reply and the suggestion!
I did see that, previously. However, the 50+/50- is a bit of a knee cap for me - My values in my code are only placeholders and I would need to be able to go much, much higher than 50.
If all else fails, I will probably go to it, as it does seem to fit all my other needs.
 

Diluiksapu

Villager
Member
Joined
Mar 4, 2020
Messages
15
Reaction score
1
First Language
French
Primarily Uses
RMMV
I appreciate the reply and the suggestion!
I did see that, previously. However, the 50+/50- is a bit of a knee cap for me - My values in my code are only placeholders and I would need to be able to go much, much higher than 50.
If all else fails, I will probably go to it, as it does seem to fit all my other needs.
Well, you can change it from yourself.

Open the JS file,

At the lane ==> 267

Game_System.prototype.getFactionRanges = function(){
this.fantastic = [];
for(var i = 50; i > 30; i--){
this.fantastic.push(i);
}
Just change the number to fit your game, same for Great, neutral ... That's for the maximum value.

And to fit the Gauge to your game, ==> Lane 441

var fp = ($gameSystem.getFaction(faction).FactionPoints + 50)/100

Adjust to your game, my game have 1000 faction points, and i did :

var fp = ($gameSystem.getFaction(faction).FactionPoints)/1000

If that can help you !
 

Enviona

Villager
Member
Joined
Apr 8, 2020
Messages
5
Reaction score
0
First Language
English
Primarily Uses
RMMV
Well, you can change it from yourself.

Open the JS file,

At the lane ==> 267

Game_System.prototype.getFactionRanges = function(){
this.fantastic = [];
for(var i = 50; i > 30; i--){
this.fantastic.push(i);
}
Just change the number to fit your game, same for Great, neutral ... That's for the maximum value.

And to fit the Gauge to your game, ==> Lane 441

var fp = ($gameSystem.getFaction(faction).FactionPoints + 50)/100

Adjust to your game, my game have 1000 faction points, and i did :

var fp = ($gameSystem.getFaction(faction).FactionPoints)/1000

If that can help you !
That is fantastic, actually! Thank-you :)
 

meribiaa

Villager
Member
Joined
Apr 28, 2020
Messages
8
Reaction score
5
First Language
English
Primarily Uses
RMMV
Edit: So I slept on it, did some searching, and switched over to DrDhoom's Parallax Utils and it's up and working. :kaopride:

So I dove deep into RPG Maker MV the past couple days and have been reading a lot of threads here, watching tutorials, etc., but my brain is fried and I need help with a looping map.

I have map set to scroll horizontally and a ground layer and parralax layer set up with the OrangeOverlays plugin. But when I test the game, the overlay stays in place instead of looping.

Do I need a new plugin, or did I miss something in this one?

Thanks for your help!
 
Last edited:

Featherbrain

Veteran
Veteran
Joined
Jan 12, 2020
Messages
50
Reaction score
39
First Language
English
Primarily Uses
RMMV
What's the script call to get the number of enemies in a troop that are affected by a certain State?
 

6Dragoon

Warper
Member
Joined
Apr 21, 2020
Messages
2
Reaction score
0
First Language
english
Primarily Uses
RMMV
I tried to create a "show choices" using a script but it does not seem to work?

$gameMap._interpreter.setupChoices([["Hello","World"],-1,0]);
$gameMessage.setChoiceCallback(function(n) {
if(n === 1){$gameMessage.add("hello");}
if(n === 2){$gameMessage.add("world");}
});
 

Enviona

Villager
Member
Joined
Apr 8, 2020
Messages
5
Reaction score
0
First Language
English
Primarily Uses
RMMV
I tried to create a "show choices" using a script but it does not seem to work?
When you say it doesn't work, what do you mean?
I just plugged this into an event on a blank file I use for testing and it worked perfectly fine.
 

6Dragoon

Warper
Member
Joined
Apr 21, 2020
Messages
2
Reaction score
0
First Language
english
Primarily Uses
RMMV
When you say it doesn't work, what do you mean?
I just plugged this into an event on a blank file I use for testing and it worked perfectly fine.
Really? I mean, it was supposed to show two choices and shows a message when a player picked one (?)------but all it does is just show the two choices? Or maybe not? I just don't know lol
 

BloodletterQ

Chaotic Neutral Assassin
Veteran
Joined
Aug 15, 2012
Messages
1,532
Reaction score
1,175
First Language
English
Primarily Uses
N/A
So anybody have the issue in Yanfly's STB with the Turn Order where an enemy icon just disappears? Seems more likely to happen if you're holding down a key.
 

Featherbrain

Veteran
Veteran
Joined
Jan 12, 2020
Messages
50
Reaction score
39
First Language
English
Primarily Uses
RMMV
Using Yanfly's Animated Sideview battlers plugin.
Flying enemy X is set to "float" with <float> tag from above plugin.
Troop Y contains two of the same flying enemy: X1 and X2.

I'm trying to use troop events to check if one of the enemies has a certain HP percentage, and, if so, disable the "float" on that particular enemy (so it is on the ground, not floating).

This script call is the closest I've gotten to figuring out how to disable the "float" on the enemy.

Code:
$gameTroop._enemies[0].enemy().sideviewFloating = false;
It's supposed to affect the first enemy in the troop (X1), however, it seems to affect EVERY enemy in the troop (X1 and X2). In other words it globally disables the floating for the enemy class rather than the specific enemy that it's supposed to affect. This effect persists even after the battle ends if the same troop is summoned again.

What am I doing wrong here? How would one disable the floating on one specific enemy within the troop and only for the duration of the battle?

(Also I realize this can be accomplished by simply duplicating the enemy, setting one to float and one not to float, and transforming the enemy at the appropriate time, but a script call would be more elegant.)
 

Boonty

Veteran
Veteran
Joined
Oct 10, 2018
Messages
95
Reaction score
40
First Language
French
Primarily Uses
RMMV
Hey guys. I would like to add a script which stocks the hp rates sum of all active battle members into a game variable.

I know that I need to use a boucle with "for" but my knowledge in Javascript did not allow me to write a proper script.
Could you rescue me ?
 

Vault_Dweller_91

New California Republic Mailman
Member
Joined
Aug 25, 2019
Messages
7
Reaction score
3
First Language
English
Primarily Uses
RMMV
Hello! Not sure if this deserves it's own thread or not, but I was following the tutorial for making an Ammo System using a js plugin provided by the Youtube Tutorial:


Link to Plugin itself: https://forums.rpgmakerweb.com/index.php?threads/ammunition-system-add-on-crafting-system.48316/

Just when I thought I did everything correctly, I was met with this:

Error Splash Screen.png

I'm running RPG Maker MV 1.6.2

Please help. And if this does deserve its own thread, please let me know.

EDIT:

I have resolved the issue! Thank you!
 
Last edited:

Random Panda

Veteran
Veteran
Joined
May 3, 2016
Messages
78
Reaction score
12
First Language
English
Primarily Uses
RMMV
Is there a script call that checks the current active actor?
Like in battle, when characters take turns I'd like to know if its possible to reference the current active character whose turn it is?
I'm using SRDude's hud maker and I'd like to make it so an element shows the character's name, level and class only when its that character's turn.
Hey Almightypebble,

Did you ever find an answer to this? I'm struggling with a similar problem.
 

Aryn

Veteran
Veteran
Joined
Jun 24, 2017
Messages
33
Reaction score
10
First Language
English
Primarily Uses
RMMV
Hi guys! I want to use GALV's event spawn timer with Yanfly's more Self switches.


So far, I have this code in a parallel event:


this.doTimer(this.setSelfSwitchValue(32, 7, 138, true));


//upon the expiration of the time using galv's doTimer in map 32, self switch 138 should turn true in event 7 using yanfly's more self switches.


The problem is, this.setSelfSwitch executes despite the fact that I have not yet started the timer. It bypasses the condition that a timer has to be first started and must expire to run. Both are running in a parallel process independently of each other. The question is, how do I script the code to execute successively rather than independently?


EDIT: I have figured it out, sorry for the trouble.


if //using the script in the conditional flow control tab


this.respawnTime(32,7) == 0 && this.getSelfSwitchValue(32, 7, 126) == true;


//script call


this.setSelfSwitchValue(32, 7, 138, true)


Though, I'm still interested to see if there is a more efficient way of doing the above codes.
I'm piggy-backing on this question, because the original code is close to what I'm wrestling with. I think this should be fairly simple, but I can't get Galv's Spawn Timers to take a variable instead of a straight number. I don't see any reason that should be the case. Is there?

E.g.,
Code:
this.setSpawn(8,3,$gameVariables.value(1));
V[1] shows as set to 60 after the code runs, but the timer doesn't start. Thank you in advance!
 

Skurge

" (GASP) What's going on!? "
Veteran
Joined
Jul 12, 2015
Messages
1,195
Reaction score
268
First Language
English
Primarily Uses
N/A
How do I get Yanfly action sequence pack note tags to animate weapons?
 

Ganucci

Villager
Member
Joined
Apr 26, 2020
Messages
29
Reaction score
3
First Language
English
Primarily Uses
RMMV
Is there a script call to have an actor and/or event step forward a certain number of spaces based on a variable?

For example:
Variable 1 = A random number between 1 and 100
I'd like Actor 1 to step to the right \v[1] amount of times.

Is there a script call for this? I know with Galv's Move Route Extras you can have an Actor "jump" x amount of spaces, but I'm looking for a script call or plugin that has an Actor "step forward" x amount of spaces.
 

Aryn

Veteran
Veteran
Joined
Jun 24, 2017
Messages
33
Reaction score
10
First Language
English
Primarily Uses
RMMV
Is there a script call to have an actor and/or event step forward a certain number of spaces based on a variable?

For example:
Variable 1 = A random number between 1 and 100
I'd like Actor 1 to step to the right \v[1] amount of times.

Is there a script call for this? I know with Galv's Move Route Extras you can have an Actor "jump" x amount of spaces, but I'm looking for a script call or plugin that has an Actor "step forward" x amount of spaces.
This is a bit round about, but could you use Yanfly's Move Core command "MOVE TO: EVENT"? You could move a blank event using variables (Set Event Location with variables) and then have the other event move to it.
 

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

Latest Threads

Latest Profile Posts



I've been experimenting with improved memory management again, which allowed me to include items to increase player path length. These are both 44 grid spaces long, and stable. :LZSexcite:
I FINALLY DID IT! 5 years making my very first game and I just officially released it on STEAM..... OMG..... I can say I finished a game! The feelings!!!!!
Stream will be live shortly! I am going to be playing some Among Us! Feel free to drop by!
Ami
tv program always get the ratings (it's the reason why drama series has 1000+ episode),also full and nonsense of censorship (weird blur, a scene getting cut because the unconvenient viewer,but it unconvenient to me either. you never see what the original is)

i know the reason is to take cover the viewer from the negative thing,but i just laughing and mocking of them that they're always suck :guffaw:
Star Chart Idea - Just something I am working on.

Forum statistics

Threads
104,460
Messages
1,006,442
Members
135,966
Latest member
Kleik
Top