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.
JavaScript questions that don't deserve their own thread
● ARCHIVED · READ-ONLY
-
-
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 ! -
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. -
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 ! -
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 :) -
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! -
What's the script call to get the number of enemies in a troop that are affected by a certain State?
-
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");}
}); -
When you say it doesn't work, what do you mean?I tried to create a "show choices" using a script but it does not seem to work?
I just plugged this into an event on a blank file I use for testing and it worked perfectly fine. -
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 -
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.
-
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.) -
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 ? -
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:
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! -
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. -
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! -
How do I get Yanfly action sequence pack note tags to animate weapons?
-
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. -
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. -
EDIT: for syntax to distinguish string/not stringI'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!
If anyone is interested, I solved this today by adding a few lines to the Game_Interpreter part of the plugin code. I'm pretty new to javascript, so there's probably a more efficient way, but this works. This addition allows you to pass a "v#" string in the argument and it will change "time" to the value of the variable (e.g., this.setSpawn(0,0,"v2") will make a timer on this event for however many seconds as the value of $game.Variables.value(2)):
Code:Game_Interpreter.prototype.setSpawn = function(mapId,eventId,time) { if (mapId <= 0) mapId = this._mapId; if (eventId <= 0) eventId = this._eventId; $gameSystem.eventTimers[mapId] = $gameSystem.eventTimers[mapId] || {}; //time by string variable if includes "v" var x = typeof time if (x == "string") { var arr1 = time.split("") if (arr1[0] == "v") { time = Number(time.replace("v","")) time = $gameVariables.value(time) } } $gameSystem.eventTimers[mapId][eventId] = $gameSystem.playtime() + time;