JavaScript questions that don't deserve their own thread

Myst Desdemona

The Snark Knight
Veteran
Joined
Nov 18, 2015
Messages
72
Reaction score
15
First Language
English/Swedish
Thank you for your help :)

I did it a little different but it worked perfectly.

Here is how it is for now

<Learn Cost: 500 JP><Learn Cost Eval>user._paramPlus[0] += 300;user.forgetSkill(52);user.refresh();skill.learnCostJp = Math.floor(skill.learnCostJp * 1.2); </Learn Cost Eval>Thanks again.
 

kiriseo

Veteran
Veteran
Joined
Oct 27, 2015
Messages
245
Reaction score
83
First Language
German
Thank you for your help :)

I did it a little different but it worked perfectly.

Here is how it is for now

<Learn Cost: 500 JP><Learn Cost Eval>user._paramPlus[0] += 300;user.forgetSkill(52);user.refresh();skill.learnCostJp = Math.floor(skill.learnCostJp * 1.2); </Learn Cost Eval>Thanks again.
If you do it like this, the cost increases for the first learning too.

The window might still display 500JP, but you character will lose 600JP.
 

LeoHeart

Veteran
Veteran
Joined
Apr 14, 2012
Messages
80
Reaction score
53
First Language
English
Fixed!
 
Last edited by a moderator:

Mortalis

Veteran
Veteran
Joined
Jun 9, 2014
Messages
34
Reaction score
3
First Language
English
Primarily Uses
The only way I can think of, is with the help of variables or even switches.

I can't test it (currently not home) but you could try something like this with switches:

<Learn Cost: 500 JP> // Your starting cost<Learn Cost Eval>user._paramPlus[0] += 300;user.forgetSkill(52);if($gameSwitches.value(1)) { // This checks if Switch 1 is ONskill.learnCostJp = Math.floor(skill.learnCostJp * 0.1); // The JP cost of this skill increases by 10% if Switch 1 is ON} else {$gameSwitches.setValue(1, true) // If Switch 1 is OFF, switch to ON.}</Learn Cost Eval>/* * If you learn the skill for the first time, Switch 1 should be OFF, so it will get turned to ON and the cost doesn't change. * The second time you learn that skill, Switch 1 should be ON and the cost increases by 10%. * BUT the cost will increase for any character that learns that skill after one learned it for the first time. */or with variables:

<Learn Cost: 500 JP><Learn Cost Eval>user._paramPlus[0] += 300;user.forgetSkill(52);if($gameVariables.value(1) > 0) { skill.learnCostJp = Math.floor(skill.learnCostJp * 0.1); } else {$gameVariables.setValue(1, 1);}</Learn Cost Eval>/* * If you learn the skill for the first time, the Variable 1 should be zero, the cost doesn't change, * and the value of the Variable is set to one. * The next time someone learnes that skill, the Variable 1 should be greater than zero, and the cost * increases by 10%. * Again, the cost increases for everyone after the first time someone learned that skill. */Oh, and you don't need to use

user.refresh();'cause the script does this two lines later anyway BD

/EDIT:

Fixed some "obvious" syntax errors :o
The problem with this is if you ever quit the game, then reload your save, the costs displayed will be whatever the default was. It will still deduct the correct amount.
 

kiriseo

Veteran
Veteran
Joined
Oct 27, 2015
Messages
245
Reaction score
83
First Language
German
The problem with this is if you ever quit the game, then reload your save, the costs displayed will be whatever the default was. It will still deduct the correct amount.
Yeah I know. That was the first look at that problem.

Myst Desdemona and I have a version that works fine now.

I'm leaving that here, too.

Code:
<Learn Cost: 0 JP>   // This needs to be zero for the original JP Cost text to disappear.<Learn Custom Text>\i[188]JP Cost \v[20] </Learn Custom Text><Learn Require Eval>var cost = 0;if($gameVariables.value(user.actorId()) > 0) { cost = Math.floor(500 * 1.2 * ($gameVariables.value(user.actorId()) + 1) / 2 );$gameVariables.setValue(20, cost);} else {$gameVariables.setValue(20, 500); // write the starting JP cost as the second value in here.}value = user.jp() < cost ? false : true; // this line checks if the actor has enough JP to pay for it.</Learn Require Eval><Learn Cost Eval>user._paramPlus[0] += 300;user.forgetSkill(52);var actorVariableValue = $gameVariables.value(user.actorId());if(actorVariableValue > 0) { $gameVariables.setValue(user.actorId(), actorVariableValue + 1);} else {$gameVariables.setValue(user.actorId(), 1);}user.loseJp($gameVariables.value(20), classId);</Learn Cost Eval>
 

Mortalis

Veteran
Veteran
Joined
Jun 9, 2014
Messages
34
Reaction score
3
First Language
English
Primarily Uses
@kiriseo - I have changed the variable that you have set for 20 to a different one per stat, so each stat would be independant of each other, turns out you have it set for everything to be tied to a variable based on the actor. How would you change that so each stat can grow in cost independant? I've been messing with it for awhile but no go, I'm no programmer haha.
 

kiriseo

Veteran
Veteran
Joined
Oct 27, 2015
Messages
245
Reaction score
83
First Language
German
@kiriseo - I have changed the variable that you have set for 20 to a different one per stat, so each stat would be independant of each other, turns out you have it set for everything to be tied to a variable based on the actor. How would you change that so each stat can grow in cost independant? I've been messing with it for awhile but no go, I'm no programmer haha.
$gameVariable #20 is a container for the cost.

But you have to change the counter used for every skill for the independant cost, too.

That variable is indeed tied to the actorId.

If you have more than one skill, you need to change every

$gameVariables.value(user.actorId())for every skill.

Maybe to something like

$gameVariables.value(user.actorId()+ 10)for the next skill.

Then it would use every 10th variable for an actor.

So actor one would have the $gameVariables #1 & #11,

actor two $gameVariable #2 & 12.

When you know, how many actors you're gonna have, you can use that to avoid unused variables between them as well.

So when you would've a maximum of seven actors, it would look like this for the second skill:

$gameVariables.value(user.actorId() + 7);and for the third skill

Code:
$gameVariables.value(user.actorId() + 14);
 
Last edited by a moderator:

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
Does anyone know how to get the size of all the Actors you have in your database and store the value in an array?
 

lolbriefcase

Warper
Member
Joined
Nov 14, 2015
Messages
4
Reaction score
2
First Language
English
I currently have it set-up in my battle system, where whenever it's an enemy's turn, the player as an option to use resources to have a sort of "interruption" command. The enemy could use an attack, and the player would see what attack the enemy would be doing, and who it is targeting then choose to "interrupt" or not, with a healing, or +defense up, etc.

The problem I have is:

1) The initial enemy attack does nothing but pick a target, and calls the interruption option event. I was thinking if the enemy does not interrupt, I could force action the REAL skill afterwards on the same target. I do not know of the correct functions to order the last acting unit (the enemy in this case) to force action X skill on the last target. Presumably I could do something like, force action X skill ID+/-1, and just have the fake targeting skill and real targeting skill side by side in ID for a one-script-fits-all solution.

2) If the player chooses to interrupt, the player can push the enemy's action back turns, or swap out the targeted party member and what not. I would probably need to store which target the enemy chose, and which attack it's going to use when it can. The player can also choose to interrupt this again if they would like, so it is likely I would just have the enemy always cast the fake targeting attack, and the real attack would only come from the force action from the above mentioned interruption option event. Again, I do not know of the correct relevant functions and variables to carry this out.
 
Last edited by a moderator:

Zanazaru

Veteran
Veteran
Joined
Aug 17, 2015
Messages
85
Reaction score
6
First Language
German
Any ideas on how adding an Exit-Button to a menu might work?

I mean for mobile instead of having to double-tap adding a cancel button? Similar to the buttons in a shop that let you change the amount you want to buy?
 

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
You might want to look at the Sprite_Button class for that. :)
 

lokirafael

Veteran
Veteran
Joined
Jun 25, 2012
Messages
153
Reaction score
80
First Language
Portuguese
Primarily Uses
RMMV
Hello,

It's possible the create a skill that checks if the target of the skill has a Tag? (Damage Formula)

Like = "Target Tag? yes : no

Reason: I'am trying to do hunting skill that do more damage in specific "Types" of enemies. My workaround was permanent passive, but alot of enemies with passiveis give me a Hellish lag.

Tyvm.
 

deathsia

Pegisister
Veteran
Joined
Feb 26, 2014
Messages
651
Reaction score
55
First Language
English
Primarily Uses
Forgive the noobish question but are plugins able to conflict with one another and crash the game just like scripts or will one simply override the other?
 

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
863
First Language
German
Primarily Uses
Plugins are scripts, just differently named. And yes, they can very much crash the game.
 

orcomarcio

Veteran
Veteran
Joined
Nov 26, 2015
Messages
106
Reaction score
20
First Language
Italian
Does anyone knows where's the entry point in the code?
 

Iavra

Veteran
Veteran
Joined
Apr 9, 2015
Messages
1,797
Reaction score
863
First Language
German
Primarily Uses
Plugins start at the top, if you mean that. If you mean the game as a whole, take a look at "main.js" in your js folder.
 

Bearsmith

Villager
Member
Joined
Nov 13, 2012
Messages
22
Reaction score
5
First Language
English
Is there any way I could disable the little "step forward" side view actors do when it's their turn? I only have one actor in my game (and he always attacks first), so it looks really silly when my guy steps forward at the start of his turn, then steps back and forward again before actually using the selected skill. 
 

Milena

The woman of many questions
Veteran
Joined
Jan 26, 2014
Messages
1,281
Reaction score
106
First Language
Irish
Primarily Uses
N/A
@moveSpeed = rand(50).next * 0.01 + 0.5How do you translate the .next command or the whole block of code in JavaScript? Above is an RGSS3 code.
 

Latest Threads

Latest Posts

Latest Profile Posts

Stream will be live shortly! I will be beginning a play-through of Resident Evil 4! Feel free to drop by!

1st iteration on castle interior in Tiled.
I've started up Pillars of Eternity. It's interesting how the game does a "select choice" cutscene using still image art for dramatic flair. I wonder if that might work for my RPGMaker project.
The self-righteous indignation of family when you expect them to pay back money you've leant to them never ceases to amaze me.
Gamedev for relaxing? yes or no?

Forum statistics

Threads
107,744
Messages
1,031,812
Members
139,883
Latest member
DeAngelis
Top