JavaScript questions that don't deserve their own thread

Discussion in 'Javascript/Plugin Support' started by Shaz, Oct 23, 2015.

  1. DreamX

    DreamX Veteran Veteran

    Messages:
    816
    Likes Received:
    814
    First Language:
    English
    What do you mean by "the skill works"? This is a condition for a state.


    If you mean state:


    It's working for me. The state is applied when leader has the id 3, then removed when the leader does not have the id 3.


    Make sure that your <Passive State: x> notetag is ONLY on the actor with id 3 for this state.


    Here's the condition also with that other condition about learning a skill:


    <Custom Passive Condition>
    if ($gameParty.leader() && $gameParty.leader().actorId() === 3 && $gameParty.leader().isLearnedSkill(26)) {
    condition = true;
    }
    else {
    condition = false;
    }
    </Custom Passive Condition>


    Replace 26 with the skill id.
     
    Last edited by a moderator: Apr 27, 2016
    Reaxus likes this.
  2. Reaxus

    Reaxus Villager Member

    Messages:
    14
    Likes Received:
    1
    First Language:
    English
    OMG! now it's working!!!!! thanks a ton!!!
     
    DreamX likes this.
  3. slycode

    slycode Warper Member

    Messages:
    3
    Likes Received:
    0
    First Language:
    English
    Hello, I'm having trouble reading $gameVariables from a note tag and storing it into a variable to be used later.


    What I want to do is have a note tag like <VAR X> or something to that extent, then in the script, have it take the value and store it into another variable for later use. How do I parse it right?
     
  4. Chaos17

    Chaos17 Dreamer Veteran

    Messages:
    1,253
    Likes Received:
    420
    Location:
    France
    First Language:
    French
    Hi,


    I would like to know if there's a way to check the enemy party HP with a script call ?


    Because I would like to trigger a dialog when one of the enemy is low HP (so not a specific one) in a conditionnal branch.
     
  5. DreamX

    DreamX Veteran Veteran

    Messages:
    816
    Likes Received:
    814
    First Language:
    English
    Try


    $gameTroop.members().some(function(member) { return member.hpRate() <= .5});


    Replacing .5 with whatever you want.
     
    Chaos17 likes this.
  6. Chaos17

    Chaos17 Dreamer Veteran

    Messages:
    1,253
    Likes Received:
    420
    Location:
    France
    First Language:
    French
  7. DreamX

    DreamX Veteran Veteran

    Messages:
    816
    Likes Received:
    814
    First Language:
    English
    It's a condition, so it put in the script section of a conditional branch like you said.
     
  8. Chaos17

    Chaos17 Dreamer Veteran

    Messages:
    1,253
    Likes Received:
    420
    Location:
    France
    First Language:
    French
    @DreamX


    I did.


    But I think the problem is the battle condition itself.


    Even if I put turn 0, the condittional branch isn't triggered :(
     
    Last edited by a moderator: May 8, 2016
  9. DreamX

    DreamX Veteran Veteran

    Messages:
    816
    Likes Received:
    814
    First Language:
    English
    Try using turn end with turn as the span.
     
  10. Chaos17

    Chaos17 Dreamer Veteran

    Messages:
    1,253
    Likes Received:
    420
    Location:
    France
    First Language:
    French
    It works!


    Thank you :D
     
    Last edited by a moderator: May 8, 2016
    DreamX likes this.
  11. Milena

    Milena The woman of many questions Veteran

    Messages:
    1,282
    Likes Received:
    106
    Location:
    Ireland
    First Language:
    Irish
    Primarily Uses:
    N/A
    I have a problem. In my Game_Actor class I made two new things, being sizeX and sizeY. Now, I want to use those variables as the value of each different actors when they are created in battle:


    Spriteset_Battle.prototype.createActors = function() {
    this._actorSprites = [];
    for (var i = 0; i < $gameParty.maxBattleMembers(); i++) {
    this._actorSprites = new Sprite_Actor();
    this._actorSprites.scale.x = $gameParty.members()._sizeX;
    this._actorSprites.scale.y = $gameParty.members()._sizeY;
    this._battleField.addChild(this._actorSprites);
    }
    };


    This to be exact. When I console.logged it, there's an extra thing that is printed that says it is undefined. I wonder where that came from. This is the reason why the code does not work because it equates to an undefined variable afterwards. That's why you'd have to be specific instead of using the variable i.


    Any possible solution for this?
     
  12. DreamX

    DreamX Veteran Veteran

    Messages:
    816
    Likes Received:
    814
    First Language:
    English
    Unless you have a particular reason, there's no need to do it in that function. The actor sprite index does not necessarily correspond to the game party members index, anyway.

    Code:
        alias_Game_Actor_initMembers = Game_Actor.prototype.initMembers;
        Game_Actor.prototype.initMembers = function () {
            alias_Game_Actor_initMembers.call(this);
            this._sizeX = 1;
            this._sizeY = 1;
        };
    
        // alias the Sprite_Actor.prototype.updateBitmap function
        alias_Sprite_Actor_updateBitmap = Sprite_Actor.prototype.updateBitmap;
        Sprite_Actor.prototype.updateBitmap = function () {
            // call the original function we are aliasing
            alias_Sprite_Actor_updateBitmap.call(this);
            // check if we didn't already scale.
            if (!this._scaled) {
                // scale the sprite according to the scale variable of the actor.
                this._mainSprite.scale.x = this._battler._sizeX;
                this._mainSprite.scale.y = this._battler._sizeY;
                // mark that we scaled
                this._scaled = true;
            }
        };
     
    Last edited by a moderator: May 9, 2016
  13. Milena

    Milena The woman of many questions Veteran

    Messages:
    1,282
    Likes Received:
    106
    Location:
    Ireland
    First Language:
    Irish
    Primarily Uses:
    N/A
    Ahhh that helped, DreamX. Looks okay now! <3
     
    DreamX likes this.
  14. Rizzle

    Rizzle Villager Member

    Messages:
    8
    Likes Received:
    0
    First Language:
    English
    Hello, 


    I apologize if this has been answered already, but I'm having a slight annoyance with Yanfly's Message Core. It involves the plugin command "MessageWith 400" and how it seemly goes everywhere I don't want it. Even when I don't put it in an event, it shrinks the text box regardless. The problem even bleeds into the combat where the text windows shrink and cut off words. Is there a way to turn it off and I just do not see it?


    Please and thank you. 
     
  15. DreamX

    DreamX Veteran Veteran

    Messages:
    816
    Likes Received:
    814
    First Language:
    English
    Does it not work if you just call the plugin command again with the original message box size?
     
  16. Punamaagi

    Punamaagi Hero on their own terms Veteran

    Messages:
    191
    Likes Received:
    289
    Location:
    Southwest Finland
    First Language:
    Finnish
    Primarily Uses:
    RMMV
    Is there a way to prevent an event with Event Touch activating if the event is on the edge of a cliff and player happens to walk past it (i.e. check for collisions)? I'm trying to make visible enemy encounters, but it's a bit awkward when the player gets into a battle with a monster which shouldn't be able to reach them.
     
  17. Rizzle

    Rizzle Villager Member

    Messages:
    8
    Likes Received:
    0
    First Language:
    English
    I could try this, but I don't know what the default size is. Please, do you know?
     
  18. MrPurpleDreadlocks

    MrPurpleDreadlocks Veteran Veteran

    Messages:
    159
    Likes Received:
    19
    First Language:
    English
    Hi folks,


    I am curious about the funciton $gameScreen.startFlash(color, duration) used in battle.


    In the Animations tab there is a window to adjust the "SE and Flash Timing" see below:

    [​IMG]


    I was wondering where the function is that knows whether it is screen / target / hide target?


    For example, in Game_Screen.startFlash:


    Game_Screen.prototype.startFlash = function(color, duration) {
    this._flashColor = color.clone();
    this._flashDuration = duration;
    };


    is the function that does flash on the screen. but no parameters for the type (screen, target, hide) etc.


    Curious on this because I want to have character's flash on conditions.


    Thanks!
     
    Last edited by a moderator: May 14, 2016
  19. BloodletterQ

    BloodletterQ Chaotic Neutral Assassin Veteran

    Messages:
    1,452
    Likes Received:
    1,051
    Location:
    My head's in the clouds at least...
    First Language:
    English
    Primarily Uses:
    N/A
    I may have suggested it already, but there are countless questions about how to remove or skip stats and I'm suggesting to Shaz that perhaps there can links to certain answers in the original post?
     
    Last edited by a moderator: May 14, 2016
  20. Milena

    Milena The woman of many questions Veteran

    Messages:
    1,282
    Likes Received:
    106
    Location:
    Ireland
    First Language:
    Irish
    Primarily Uses:
    N/A
    I have a question about blt and numbers. I want to change the texts Lv and the HP MP numbers into an image. For example, if I use sprite, it becomes cluttered and since it gets created everytime, the sprite will just double up in the window. Is there a proper way to make the text LV into an image? How about the numbers?
     

Share This Page