JavaScript questions that don't deserve their own thread

lithkast

Quirky mini boss
Veteran
Joined
May 12, 2014
Messages
105
Reaction score
49
First Language
english
Primarily Uses
Quick question.

Is there a way to check the number of weapons my character has equipped in the damage formula?  Essentially, I want to lower the damage for Dual Wielding characters, but only if they have two weapons equipped.  If a Dual Wield character only has one weapon equipped, I want them to deal normal damage.

Essentially I want to know if I can check to see if a weapon is equipped in the off hand.  
 

Kurotsuke

Villager
Member
Joined
Nov 30, 2013
Messages
16
Reaction score
0
First Language
english
Hello. Just a quick question.. I have set  a number in an array so.. $gameVariables.setValue(10, [1]); then I wanted to add another value in the array.. my question is how can I add value to the array? thats all thank you :)
 

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,282
Reaction score
106
First Language
Irish
Primarily Uses
N/A
What is the proper experience rate? I want to make a gauge in the window but I don't know what is the proper rate for experience. I tried 

actor.currentExp() / actor.nextRequiredExp()but it doesn't go well.

Anyone?
 

Liquidize

Caffeine Overload
Developer
Joined
Nov 1, 2015
Messages
466
Reaction score
456
First Language
English
Primarily Uses
RMMV
What is the proper experience rate? I want to make a gauge in the window but I don't know what is the proper rate for experience. I tried 

actor.currentExp() / actor.nextRequiredExp()but it doesn't go well.

Anyone?
actor.nextRequireExp() doesn't return the total amount required, only the amount needed to get to the level from the current amount. So say you need 50 exp to get to level 2, and you have 11 exp. That function will return 39. What you  need is the total amount (50 in my example). Try using actor.nextLevelExp()
 

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,282
Reaction score
106
First Language
Irish
Primarily Uses
N/A
It works now, thanks a lot.
 

Luxanna

Veteran
Veteran
Joined
Nov 8, 2015
Messages
67
Reaction score
23
First Language
English
Primarily Uses
How would I check which scene is active at the moment?

SceneManager._scene returns a format like this: Scene_Title { ... some stuff ... }

But there's no "name" property or something similar within the curly brackets, so I can't compare those...

Using SceneManager._scene === Scene_Title returns false even if the current scene is indeed Scene_Title...
 

Liquidize

Caffeine Overload
Developer
Joined
Nov 1, 2015
Messages
466
Reaction score
456
First Language
English
Primarily Uses
RMMV

ragnorak6608

Veteran
Veteran
Joined
May 25, 2014
Messages
54
Reaction score
1
First Language
English
If i wanted to assign the event ID for the current event to a variable how would I reference it in a script call?

Code:
$gameVariables.setValue(n,???)
 

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
857
First Language
German
Primarily Uses
If the script is executed from a "Script..." event command, you can use

Code:
this.eventId();
This is because "this" is an instance of Game_Interpreter. Otherwise, it wouldn't be possible to identify the current event.
 

ragnorak6608

Veteran
Veteran
Joined
May 25, 2014
Messages
54
Reaction score
1
First Language
English
If the script is executed from a "Script..." event command, you can use

this.eventId();This is because "this" is an instance of Game_Interpreter. Otherwise, it wouldn't be possible to identify the current event.
Thank you, this will help a bunch.
 

YvetteJene

Veteran
Veteran
Joined
Dec 31, 2015
Messages
15
Reaction score
13
First Language
English
I would like to call some information, (the price,) of any item from the items.json file and put that information into a variable. Is this possible with scriptcalling or does it require a plugin?

Something like $gameVariable[1] = item[1].price ?

I'd also like to know if I can choose which item's price I call based on the value of a second variable.

Like, $gameVariables[1] = item[$gameVariables[2]].price.

I know these don't make much sense, but I hope someone understands! :(

EDIT -- I tinkered around a bit more and figured out that I can do it like this:

Control Variables: #10 = Scriptcall [ $dataItems[$gameVariables.value(1)].price; ]

Hope that someone else finds it useful.
 
Last edited by a moderator:

Pine Towers

Knight Hospitaller
Veteran
Joined
Nov 11, 2015
Messages
466
Reaction score
223
First Language
Portuguese
Primarily Uses
RMMV
Hello guys!

So, as most of the non-programmers and enthusiasts with RPG Maker MV, my Project's JS folder is exploding with plugins since there are so many wonderful ones around and more yet to come. This left me with questions:

1. When too much is too much? At which plugin count you should back off and rethink?

2. Is it better (performance-wise) to have 60 plugins each with 500 lines of coding or one single plugin with 30000 lines of codings?

3. Is is wrong, by ethical means, to merge plugins, even with the original creators being given credit at the help file, and for personal use (not reproducing the modified franken-plugin at the forum) only?
 

Liquidize

Caffeine Overload
Developer
Joined
Nov 1, 2015
Messages
466
Reaction score
456
First Language
English
Primarily Uses
RMMV
1. When too much is too much? At which plugin count you should back off and rethink?

2. Is it better (performance-wise) to have 60 plugins each with 500 lines of coding or one single plugin with 30000 lines of codings?

3. Is is wrong, by ethical means, to merge plugins, even with the original creators being given credit at the help file, and for personal use (not reproducing the modified franken-plugin at the forum) only?
1. This is more dependent on what the plugins are doing then the amount you have, but this is also something you need to think about from a design perspective, do you need all the plugin bloat? As some plugins are definitely not going to work well with others.

2. See #1, mainly the first part about what the plugins are doing. Some things code wise are faster than other things, and if the plugin is doing a lot of slow things it doesn't matter how many lines it has. A plugin with 30000 lines could be faster than a plugin with 500 lines, if the plugin with 500 lines is doing a lot of performance heavy things.

3. By ethical means it really depends on what the terms of use of the plugin is, some plugins may have really strict terms of use where you are not allowed to reproduce/modify it, and doing what you describe may fall under that category.
 

forteller

Veteran
Veteran
Joined
Dec 2, 2013
Messages
105
Reaction score
19
First Language
English
Primarily Uses
So in MV is there a way a can check if a skill is a certain element during the damage steps?
 

Liquidize

Caffeine Overload
Developer
Joined
Nov 1, 2015
Messages
466
Reaction score
456
First Language
English
Primarily Uses
RMMV
So in MV is there a way a can check if a skill is a certain element during the damage steps?
If you mean for the damage formula box, the variable "item" is exposed, which holds information regarding the item or skill. So you can do something like:

item.damage.elementId * 2
in the formula box to make the damage 2x the item's element id.  "item.damage.elementId" (without quotes) is the value of the item/skills element id though.

If however you mean for a conditional statement, you will need/should use a more advanced damage evaluation plugin. I believe Yanfly has one made.
 

ragnorak6608

Veteran
Veteran
Joined
May 25, 2014
Messages
54
Reaction score
1
First Language
English
Is there a way to directly manipulate an enemy's stats using scripts and variables?

for example:

enemy's attack stat = (variable 67 + variable 32)/ variable 43
 

Liquidize

Caffeine Overload
Developer
Joined
Nov 1, 2015
Messages
466
Reaction score
456
First Language
English
Primarily Uses
RMMV
Is there a way to directly manipulate an enemy's stats using scripts and variables?

for example:

enemy's attack stat = (variable 67 + variable 32)/ variable 43
This would require a plugin to change their stats depending on when in the battle you wanted it to apply.
 

Liquidize

Caffeine Overload
Developer
Joined
Nov 1, 2015
Messages
466
Reaction score
456
First Language
English
Primarily Uses
RMMV
Using your example in the above post, you could do something like this in a script call event (with the page settings as Battle and Turn 0):

(function(){$gameTroop.members().forEach(function(member){member.enemy().params[2] = ($gameVariables.value(67) + $gameVariables.value(32))/$gameVariables.value(43);});})();
It would set all enemies attack to the formula you provided when the battle starts, but again a plugin would be better, as this script call would need to be in every troop event. 
 

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

Latest Threads

Latest Posts

Latest Profile Posts

I am feeling better about my update schedule, I feel like I am actually getting consistent work done even if it isn’t big updates.
It's a joy to work on a well-made map. I am not regretting this commission in the least!
I'm currently being attacked by the RPG Maker Hydra: fixing one problem only to have two more rise to take its place.
Hey you! Yeah YOU! Whatcha doin' not backing up your projects? You a masochist or sumthin'? GO BACK UP YOUR PROJECTS! Sheeesh... Didn't think I'd hafta spell it out for yas.

Forum statistics

Threads
94,290
Messages
919,708
Members
124,031
Latest member
Lavdiasmylove
Top