JavaScript questions that don't deserve their own thread

● ARCHIVED · READ-ONLY
Started by Shaz 3413 posts Page 13 of 171 View original ↗
  1. kiriseo said:
    -snip-
    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.
  2. Myst Desdemona said:
    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.
  3. Fixed!
  4. kiriseo said:
    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.
  5. Mortalis said:
    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>
  6. @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.
  7. Mortalis said:
    @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);
  8. Does anyone know how to get the size of all the Actors you have in your database and store the value in an array?
  9. 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.
  10. 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?
  11. You might want to look at the Sprite_Button class for that. :)
  12. @Milena: Thanks that helped a lot :D
  13. 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.
  14. 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?
  15. Plugins are scripts, just differently named. And yes, they can very much crash the game.
  16. Does anyone knows where's the entry point in the code?
  17. 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.
  18. yeah forgot about that file thx lol
  19. 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. 
  20. @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.