JavaScript questions that don't deserve their own thread

● ARCHIVED · READ-ONLY
Started by Shaz 3413 posts Page 154 of 171 View original ↗
  1. Probably a stupid question, but is it possible to get the length for variable?

    For example, if I set variable 1 to "Charge" could run a code to return "6"?

    I tried $gameVariables.Value(x).length but it didn't seem work. (obviously with X replacing the variable number)
  2. Lonewulf123 said:
    $gameVariables.Value(x).length
    lowercase v in value.
    also "charge" would be 6
  3. Robro33 said:
    lowercase v in value.
    also "charge" would be 6

    Yes, the 5 was a typo.

    Sorry.

    It works now though, thanks
  4. @ATT_Turan oohhhh. i'm sorry, i forgot there were differences in js syntax between engines :kaoswt:

    is there an mv alternative then?
  5. DecastarDaDumy said:
    @ATT_Turan oohhhh. i'm sorry, i forgot there were differences in js syntax between engines :kaoswt:

    is there an mv alternative then?
    It's not that there are differences in JavaScript syntax - the actual code for the two games is different in portions.

    Code:
    Window.prototype._updateCursor = function() {
        var cursorOpacity = this.contentsOpacity;
        this._windowCursorSprite.alpha = cursorOpacity / 255;
        this._windowCursorSprite.visible = this.isOpen();
    };
  6. Is there a script call or somefin to change a specific map's tileset during a cutscene? I have variations of tilesets with different palettes, and I wanted to change the tileset briefly during a cutscene.
  7. DrBuni said:
    Is there a script call or somefin to change a specific map's tileset during a cutscene? I have variations of tilesets with different palettes, and I wanted to change the tileset briefly during a cutscene.
    $gameMap.changeTileset(tilesetId);
    In general I recommend this spreadsheet for figuring out what script calls are needed to replicate an event command.

    Though if it's a cutscene, wouldn't it be easier to just use the "Change tileset" event command?
  8. Mac15001900 said:
    $gameMap.changeTileset(tilesetId);
    In general I recommend this spreadsheet for figuring out what script calls are needed to replicate an event command.

    Though if it's a cutscene, wouldn't it be easier to just use the "Change tileset" event command?
    Thank you so much! Yep, you are right, I forgot that command existed.
  9. ATT_Turan said:
    It's not that there are differences in JavaScript syntax - the actual code for the two games is different in portions.

    Code:
    Window.prototype._updateCursor = function() {
        var cursorOpacity = this.contentsOpacity;
        this._windowCursorSprite.alpha = cursorOpacity / 255;
        this._windowCursorSprite.visible = this.isOpen();
    };
    ohh. tysm. i don't have much js knowledge; the only thing i could code is lua and even that's just barely.
  10. Using yanflys plugins is there a way to make a skill that increases the number of hits based on how much tp they have for example if their tp is above 25 the skill hits 2 times if the their tp is above 50 skill hits 3 times basically an extra hit per 25 TP, is there a way to achieve this effect ?
  11. use the action sequences plugin to add more action effects if the user has the tp
  12. i wonder if there's a way to display the skill user's parameter in message boxes and skill descs. tried calling for actor 2's atk value and it doesn't seem to work ;w;
    1727759884676.png
  13. i use this plugin for that, but theres other plugins too that lets you run code to be eval'd within text boxes
  14. Robro33 said:
    i use this plugin for that, but theres other plugins too that lets you run code to be eval'd within text boxes
    Plus, for the given example, you only need to put the value into a variable then use the default escape code to display the variable.
  15. How do I get the value of the full incoming damage of an attack to an actor before the damage is dealt? I'm trying to make equipment that reduces the damage to 0 if the damage is less than 20% of an actor's Max HP.
  16. what are you trying to do?
    you can grab incoming damage with Turan's eval tags or visustella's battle core, but without knowing what youre trying to do with it theres no knowing if theyll do what you want
  17. Robro33 said:
    what are you trying to do?
    you can grab incoming damage with Turan's eval tags or visustella's battle core, but without knowing what youre trying to do with it theres no knowing if theyll do what you want
    I want to reduce the incoming damage to 0 if the damage is less than 20% of an actor's Max HP.

    What I'm trying right now is the notetag <JS Pre-Damage as Target> but I have no idea what object I have to get.
  18. huh. the VS battle core page doesnt mention it, but try using
    Code:
    if (value < target.mhp/5)
      value = 0;
    there should be a "value" variable that applies to the damage dealt
  19. Robro33 said:
    huh. the VS battle core page doesnt mention it, but try using
    Code:
    if (value < target.mhp/5)
      value = 0;
    there should be a "value" variable that applies to the damage dealt
    Didn't know it was this simple. Thanks for this!
  20. Hello everyone,

    im using VisuStella Battle Core and i wanted to include more damage mechanics in the common events related to every skill. Within a common event that is connceted to an enemy skill, i want to check is Switch 43 is true or not. For this i'd like to check if the target (an actor) hat a specific state (ID 39) and if yes, change Switch 43 to "on" before the damage appears. Im unsure if the enemy battler can even find a (single-)target out of my actors group during the "Pre-Apply" phase. Currently, the switch stays off no matter what and im looking for solutions.

    This is the notetag of the skill.
    Code:
    <Custom Action Sequence>
    
    <JS Pre-Apply>
     if (target.isStateAffected(39)) {
        $gameSwitches.setValue(43, true);
    } else {
        $gameSwitches.setValue(43, false);
       }
    </JS Pre-Apply>