JavaScript questions that don't deserve their own thread

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,935
Reaction score
13,574
First Language
English
Primarily Uses
RMMV
That is a Control Variables event command, not a script call.  Sorry about that - something I had read in a previous post made me think you wanted to use the event command.


If you want to do it all inside a script, do this:


$gameVariables.setValue(15, $gameVariables.value(15) + 'X')


It will be faster/better than calling a common event, if everything else is happening via script.
 
Last edited by a moderator:

Zeriab

Huggins!
Veteran
Joined
Mar 20, 2012
Messages
1,264
Reaction score
1,407
First Language
English
Primarily Uses
RMXP
The following forces an action in battle:



$gameParty.members()[0].forceAction(1, 1);
BattleManager.forceAction($gameParty.members()[0]);
BattleManager.processForcedAction();


But what can I call to then end the player's turn and go to the enemy's turn?


(I have a button for Attack which on pressed forces the attack action.)
I'd recommend mapping out how the battle system flows, and look how to change and restructure it to support your ideas.


I know it's a lot more work than a simple patch that may work. On the long run, however, it'll lead to a more robust and manageable battle-system. Patchwork battle systems really become a huge PITA to maintain.


*hugs*


 - Zeriab
 

Crystal Noel

Veteran
Veteran
Joined
Jun 17, 2012
Messages
113
Reaction score
32
First Language
English
Primarily Uses
I'm trying to make a plugin that grants the player additional stats to use in damage formulas. Everything works fine except for one tiny little issue. The formulas aren't working. Right now, all the stats are set to calculate using the formula "base + ((this.level * mod) / 128)", where base and mod are values set in the settings.


Again for all stats base is set at 20 and mod is set at 60. By using the formula the answer (using a calculator) is 20.46875 (floored to get 20). However, MV is somehow calculating the value to be 200.46875, which makes no mathematical sense whatsoever. To check, I also tried the formula ((this.level * mod) / 128) + base" which gave me an answer of 0.46875. What am I doing wrong?


Just for reference here's the code itself:


Game_BattlerBase.prototype.xstatEval = function(statId) {
var formula = Crystal.XStats[statId][1];
var base = Crystal.XStats[statId][2];
var mod = Crystal.XStats[statId][3];
return eval(formula);
};


Edit: Nevermind. I accidently set base and mod to strings instead of numbers and it threw off the game. Feel free to ignore this question.
 
Last edited by a moderator:

Johan Liebert

Villager
Member
Joined
Apr 6, 2016
Messages
12
Reaction score
1
First Language
French
Primarily Uses
Hello everyone,


I would like to know how i can store in a variable the common event used for a skill.
 

Songsmith

Veteran
Veteran
Joined
Jun 17, 2016
Messages
64
Reaction score
3
First Language
English
Primarily Uses
N/A
How could I set a picture to fadeout in the middle of a script?



So this is my code


if($gameVariables.value(16) == 1){$gameScreen.showPicture(10, "Note1", 1, 782, 435, 30, 30, 255, 0);}


but it's in the middle of a nested conditional, so I don't think a wait command will work (I want the player to still be able to do actions the whole time.)
I want the picture to appear, remain for about a second and then fade out over the course of another second. How could I do this?

EDIT: Solved. I used the movePicture script call and changed the transparency.
 
Last edited by a moderator:

Songsmith

Veteran
Veteran
Joined
Jun 17, 2016
Messages
64
Reaction score
3
First Language
English
Primarily Uses
N/A
Apologies for the double post. 


With this code:


$gameMessage.add("Hey");


$gameMessage.add("How is it");


$gameMessage.add("Going?");


the game displays it all in one message box as Hey How is it Going?


How can I get it (within the same script call) to display it as 3 separate message boxes?
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
704
Reaction score
429
First Language
English
Primarily Uses
RMMV
Does anyone know if it's possible for a note tag on a skill to reference the skill Id of the skill the note tag is on?


I'm trying to set up a custom Mp cost which uses the default MpCost of the skill in the formula, but can't find a way to reference this value from inside the note box. The less changes I have to make when copy-pasting it to every skill not box, the better, so if I could find a way to reference the cost without using $dataSkills[ID].mpCost it would be ideal, as otherwise I have to change that ID number for ever skill.


Thanks.


edit: I derped, I can use 'cost' to get this value without the skillId of the skill being used.
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,935
Reaction score
13,574
First Language
English
Primarily Uses
RMMV
@Songsmith you need to add a wait so the message can be displayed before adding the next line.  However, how you do that depends on the context of your script.
 

Songsmith

Veteran
Veteran
Joined
Jun 17, 2016
Messages
64
Reaction score
3
First Language
English
Primarily Uses
N/A
@Songsmith you need to add a wait so the message can be displayed before adding the next line.  However, how you do that depends on the context of your script.


I tried adding a wait script call (gotten from the master script call list on this site) and got a "gameInterpreter is not defined"  error message. 


These messages are are inside of a nested conditional in a script call.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,935
Reaction score
13,574
First Language
English
Primarily Uses
RMMV
That's right - I said how you do it depends on your context.  There is no such thing as gameInterpreter.


If you're doing it inside a script call, is there a reason you can't just do it with event commands?
 
Last edited by a moderator:

Songsmith

Veteran
Veteran
Joined
Jun 17, 2016
Messages
64
Reaction score
3
First Language
English
Primarily Uses
N/A
Kind of, yes, because it's in an "if" statement that checks for keyboard input that isn't natively supported.


i managed to solve my current issue by just having it turn on a switch and then running regular text event commands when that switch is turned on.


but I'd still like to know if there is another way to solve this.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,935
Reaction score
13,574
First Language
English
Primarily Uses
RMMV
If you're just saying "if key X pressed, do this stuff" you don't need a script call to do it.  The Conditional Branch command has a script entry area where you can do the test, and then you can add the messages as Show Text commands.
 

Songsmith

Veteran
Veteran
Joined
Jun 17, 2016
Messages
64
Reaction score
3
First Language
English
Primarily Uses
N/A
If you're just saying "if key X pressed, do this stuff" you don't need a script call to do it.  The Conditional Branch command has a script entry area where you can do the test, and then you can add the messages as Show Text commands.
I didn't know that! Thank you.
 

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
Is there a way to modify the battle scene so that the enemy's attack will be executed together with the player's turn? For example, I finished selecting my turn and when it executes, the enemy's do too.
 
Joined
Jun 24, 2016
Messages
1
Reaction score
0
First Language
French
Primarily Uses
The question may have been asked already but is there official (or unofficial) support for ES6's Javascript in RPG Maker MV ?
 
Last edited by a moderator:

Lakaroth

Veteran
Veteran
Joined
Dec 9, 2014
Messages
272
Reaction score
130
First Language
English
Primarily Uses
Hi there, just a little question.


I have create an HUD with pictures and i want make it trasparent when character is under it, it's on the top right corner in some map the character can walk under that.


How can i do that?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,935
Reaction score
13,574
First Language
English
Primarily Uses
RMMV
You'd need to do a couple of tests to see the player's screen x and screen y values, and if the screen x is greater than your hud's x and the screen y is less than your hud's y (at the bottom), adjust the transparency.  You might have to play around with the numbers a bit, as I'm not sure if screen x and y is based on the sprite's top left corner or bottom middle position.
 

konohananiji

Villager
Member
Joined
May 5, 2016
Messages
9
Reaction score
2
First Language
English
Primarily Uses
I think I've seen this somewhere, but I've spent the whole day searching the internet and the Script Call list, but I still can't find it.


I need a script call to check which actor the player / party leader is.


I need it to make a conditional branch, but all I can find is the condition and the script for 'if actor x is in party'.


My problem with this is at there are moments in the game where the two actors I want to use would both be in the party, but I still want it to show the first branch if the first actor is the leader.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,935
Reaction score
13,574
First Language
English
Primarily Uses
RMMV
Control Variables > Game Data > Party Member #1's Actor Id


will put the leader's actor id into a variable, then you just use the variable in the conditional branch.


Don't need to do any scripting for this at all :)
 

3alea

Villager
Member
Joined
Jun 25, 2016
Messages
5
Reaction score
0
First Language
Spanish
Primarily Uses
Hello, I want to ask a question. Maybe it´s answered ort is easy to know:


When you dye the screen of the game, entering in a battle, the screen is still dyed, and I would want to remove it in the battle.


What do I have to do? A common event putting a conditional where if any enemy appears, the screen comes back to normal? Or is there a plugin?
 

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

Latest Threads

Latest Profile Posts

trying to wrap up the boat/ship/castaway tilesets with a great galleon - no promises
Mail from campus: we will have the lessons this semester not remote, if possible. All my my profs: Remote it is.
https://gyazo.com/5a19cfce090a2585b3c0fcb7c699b92c Just finished a stealth system, its not metal gear solid level though, maybe elder scrolls level, it just works.
I ain't dead btw, just trying to keep up with university :)

Forum statistics

Threads
103,102
Messages
997,310
Members
134,569
Latest member
Aleus
Top