JavaScript questions that don't deserve their own thread

● ARCHIVED · READ-ONLY
Started by Shaz 3413 posts Page 137 of 171 View original ↗
  1. Arthran said:
    The "problem" that person is describing applies to MV too. Though personally I consider being allowed to use our own code editors to be a good thing, rather than a problem.
    Oh. Ok.
  2. @SpyroFan67 What on Earth is the point of writing a random reply to a post from 8 years ago?

    171stStreetGames said:
    So I'm using this RMMV Blackjack Plugin:
    Per the first post in this thread, it's really not for help with plugins. But it's a pretty straightforward fix, so...

    I believe if you comment out (put // at the beginning of the line) line 179, that should get rid of the black background and you can try using image layer plugins beneath it or something like that.

    Getting more help with altering it really should have its own thread in Plugin Support, but as its an unfinished plugin from 5 years ago, you might be better off just looking for something else that's a bit more fully-featured.
  3. ATT_Turan said:
    @SpyroFan67 What on Earth is the point of writing a random reply to a post from 8 years ago?


    Per the first post in this thread, it's really not for help with plugins. But it's a pretty straightforward fix, so...

    I believe if you comment out (put // at the beginning of the line) line 179, that should get rid of the black background and you can try using image layer plugins beneath it or something like that.

    Getting more help with altering it really should have its own thread in Plugin Support, but as its an unfinished plugin from 5 years ago, you might be better off just looking for something else that's a bit more fully-featured.
    When I try to post in that area it just doesn't post. Nothing at all happens. I tried that before coming here.

    As far as finding something else, this is really the only actual Blackjack Plugin I've ever been able to find. So I've just been kinda trying to figure out how to change that one thing. Because otherwise it's totally functional.

    And commenting out that line didn't seem to get rid of the black, unfortunately.
  4. 171stStreetGames said:
    When I try to post in that area it just doesn't post. Nothing at all happens. I tried that before coming here.
    Right - you might have noticed from a slew of status posts (and something earlier today in this thread) that there's a bug with the New Post function of the forums.

    171stStreetGames said:
    As far as finding something else, this is really the only actual Blackjack Plugin I've ever been able to find.
    Most of what I've seen has been to do it via events.

    171stStreetGames said:
    And commenting out that line didn't seem to get rid of the black, unfortunately.
    Hrm. I dunno, I thought the default behavior for a scene was to display whatever is on the map behind it, and I don't see anything in the plugin to change that.

    But I may well be mistaken. Perhaps someone else will have a better answer for you.
  5. ATT_Turan said:
    Hrm. I dunno, I thought the default behavior for a scene was to display whatever is on the map behind it, and I don't see anything in the plugin to change that.
    That's what I thought, too! I was so confused. Somehow the black background seems intentionally put there, but there doesn't seem to be anything making it so.
  6. Hello, its me again with a new question about js variables:

    im trying to make a grab skill that binds an actor and cant do anything but struggle and gives the enemy an unique status too (already done that)

    In my case the enemy gets a "Grabbing" status and the actor gets "Trapped" Status if the skills succesfully lands. but if one of those states gets removed by any means, the other will also be removed but those state are linked so no other grab state from other enemy or actor gets removed.

    my plan is to get the ID from both actor and enemy's troop position and save it in an specific Variable each (since my game only have 4 playable heroes, ill need to use 8 different Variables)

    Im using YEP_SkillCore and YEP_BuffsStateCore to make this work

    here is the code inside the skill note that the enemy will be using i have so far to get both IDs

    Code:
    <After Eval>
    var enemy = $gameTroop.members()[0].enemyId();
    
    if(target.isActor()) {
    
       let id = target.actorId();
    
       $gameVariables.setValue(id + 1, target.actorId());
       $gameVariables.setValue(id + 5, enemy1);
    
    }
    
    </After Eval>

    sadly $gameTroop.members()[0].enemyId() give me the ID of the enemy and not the ID of the position of that enemy in the troop. this is a problem if there are many of the same enemy in the same troop

    whats the correct eval to get that ID?

    thanks for your time and merry christmas everyone :)
  7. SnakeBD said:
    Hello, its me again with a new question about js variables:

    im trying to make a grab skill that binds an actor and cant do anything but struggle and gives the enemy an unique status too (already done that)

    In my case the enemy gets a "Grabbing" status and the actor gets "Trapped" Status if the skills succesfully lands. but if one of those states gets removed by any means, the other will also be removed but those state are linked so no other grab state from other enemy or actor gets removed.

    my plan is to get the ID from both actor and enemy's troop position and save it in an specific Variable each (since my game only have 4 playable heroes, ill need to use 8 different Variables)

    Im using YEP_SkillCore and YEP_BuffsStateCore to make this work

    here is the code inside the skill note that the enemy will be using i have so far to get both IDs

    Code:
    <After Eval>
    var enemy = $gameTroop.members()[0].enemyId();
    
    if(target.isActor()) {
    
       let id = target.actorId();
    
       $gameVariables.setValue(id + 1, target.actorId());
       $gameVariables.setValue(id + 5, enemy1);
    
    }
    
    </After Eval>

    sadly $gameTroop.members()[0].enemyId() give me the ID of the enemy and not the ID of the position of that enemy in the troop. this is a problem if there are many of the same enemy in the same troop

    whats the correct eval to get that ID?

    thanks for your time and merry christmas everyone :)
    Try target.index() and user.index()
  8. in addition to what gensun said, just a note. After Eval effects happen regardless of the skill's success. I dont know how you have the rest of the effect set up, but if thats relevant, youll need to add some check to make sure the skill hit or make it a post damage eval (assuming it does some damage)
  9. It works, thanks
    Robro33 said:
    in addition to what gensun said, just a note. After Eval effects happen regardless of the skill's success. I dont know how you have the rest of the effect set up, but if thats relevant, youll need to add some check to make sure the skill hit or make it a post damage eval (assuming it does some damage)

    Ill take that in cosideration



    Ill be back here soon!
  10. SnakeBD said:
    In my case the enemy gets a "Grabbing" status and the actor gets "Trapped" Status if the skills succesfully lands. but if one of those states gets removed by any means, the other will also be removed but those state are linked so no other grab state from other enemy or actor gets removed.

    my plan is to get the ID from both actor and enemy's troop position and save it in an specific Variable each
    In addition to the correction @Gensun gave you, this approach is a bit more complicated than it needs to be.

    Is there an actual reason for the two states (Grabbing and Trapped) to be different?

    I'm going to give you some code and presume they can simply be the same. But if there's some reason you need them to be two distinct states, you'd just copy the notetags where appropriate.

    Code:
    <After Eval>
    // Give the state (replace the ID as appropriate)
    user.addState(69);
    // Add a reference to the other battler they're grabbing
    user.grabbing = target;
    
    target.addState(69);
    target.grabbing = user;
    </After Eval>

    Then, in your Grabbing state, put:
    Code:
    <Custom Remove Effect>
    user.grabbing.removeState(69);
    delete user.grabbing;
    </Custom Remove Effect>

    No need for tracking indices or using global variables.
  11. ATT_Turan said:
    Is there an actual reason for the two states (Grabbing and Trapped) to be different?

    2 reasons:

    1- the Trapped state will seal everything from the user but the struggle ability while the Grabber will still have access to some skills and normal attacks targetting the Trapped user

    2- The Grabbing state can be removed by dealing damage to that enemy; the Trapped state cannot be removed that way
  12. SnakeBD said:
    2 reasons:
    Fair enough. So you'd put the two different appropriate state IDs in the After Eval, then give each state the Custom Remove Effect that references the opposite state ID.
  13. Edit: disregard
  14. ATT_Turan said:
    @Lonewulf123 Per the first post of this thread, it's not for support with specific plugins.

    You'd do better in a dedicated thread for this, such as:
    The official VisuStella notetag help thread
    Well that was my fault for mentioning visustella, but it doesn’t really need to be tied to it.

    I was just wondering if there was a specific snippet in general that could accomplish such a thing.

    I’ll move it.
  15. Hello, it me again with one simple question about my Grabbing and Trapped states

    @ATT_Turan code works like a charm, thank you

    but now i dont know the right eval to force the Grabbing enemy (target.grabbing = user) to only attack their trapped actor (user.grabbing = target)

    i now have YEP Battle A.I. Core for testing if it help

    sorry if i sound like a total noob and thanks again for you time

  16. you can try something like this in your enemies state
    Code:
    <Custom Action Start Effect>
    if (user.currentAction().isForOpponent())
      user.currentAction().setTarget(user.grabbing.index());
    </Custom Action Start Effect>
  17. ATT_Turan said:
    @Lonewulf123 Per the first post of this thread, it's not for support with specific plugins.

    You'd do better in a dedicated thread for this, such as:
    The official VisuStella notetag help thread

    Found a solution for this.

    for anyone who wants the snippet, this will create a state that prevents other states with timers for expiring. Put in a JS file and drop in your game. I have mine in a small Javascript file that has tiny edits.

    JavaScript:
    Game_BattlerBase.prototype.updateStateTurns = function() {
        for (const stateId of this._states) {
            if (!this.isStateAffected(X)){
            if (this._stateTurns[stateId] > 0) {
                this._stateTurns[stateId]--;
            }
        }
        }
    //Replace "X" with your state
    };
  18. Hello, it me again.

    thanks to all of you, my grabbing mechanic is working wonderful, just one problem:

    in the case 2 enemies tries to grab the same character at the same time, i added an eval to make sure the 2nd one always miss. It works but not the way i want

    the damage of the 2nd grab misses but the States for both still applies and i dont know why

    this is the full code of the grab skill

    Code:
    <Pre-Damage Eval>
       if(target.isStateAffected(17)) {
          target.result().evaded = true
       }
    </Pre-Damage Eval>
    
    
    <Post-Damage Eval>
    var enemy = user.index();
    user.addState(16);
    
    user.grabbing = target;
    target.addState(17);
    target.grabbing = user;
    </Post-Damage Eval>

    thanks for your time
  19. SnakeBD said:
    in the case 2 enemies tries to grab the same character at the same time, i added an eval to make sure the 2nd one always miss.
    If you own the Yanfly plugins, you should use the Target/Selection plugins so a battler simply can't be targeted if they're in a grapple.

    SnakeBD said:
    the damage of the 2nd grab misses but the States for both still applies and i dont know why
    Because you're using the Pre-Damage Eval.

    Per the Buffs & States instructions, that notetag only gets evaluated if the action hits. Thus, you trying to say it didn't hit while it's in the process of hitting is going to result in weird things happening.