JavaScript questions that don't deserve their own thread

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

  1. Motochi

    Motochi Villager Member

    Messages:
    10
    Likes Received:
    7
    First Language:
    English
    Primarily Uses:
    RMXP
    Lol i doubt that people even know what "Alistair's Mana Barrier" is, when you just asked like that
     
    Engr. Adiktuzmiko likes this.
  2. Blazatryx

    Blazatryx Warper Member

    Messages:
    3
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    I'm playing around with Olivia's Octopack system. I'm trying to move the enemy's name/HP/weakness/shield icons from underneath the monster sprites so I can position them better. I figured out how to move them in the JavaScript files, but it seems like I can only move them them a certain amount of distance away from the sprites before they start getting cut off. As you can see here (), I've moved the stats to the left of the screen, but when I try moving the enemy names up, it's getting cut off. If I were to try to move them any further to the left from the sprites, they'd start to get cut off too, so I had to move the monster sprites to that position.

    Ideally I would want to place them in one of the corners, in the same way the actor stats are listed. Is this at all possible? Worth noting that I'm very much a JavaScript newbie. I can just about read and understand what some functions do (thanks to some time messing with Game Maker Studio) but writing them from scratch is above my knowledge level right now.
     
  3. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,640
    Likes Received:
    2,969
    Location:
    Philippines
    First Language:
    Tagalog
    @BloodletterQ - please define what is "Alistair's Mana Barrier". Explain in full what it does and how it is to be used.

    @Blazatryx since it involves a specific plugin, better ask in the thread of the plugin itself or in a new thread. Anyway, its most probably because the Sprite Object in which the window is drawn is made only to begin at the character's position, so when you tried to move the window outwards, it then becomes out of the bounds of its sprite object. You should find in that script where it creates the sprite object where the window is drawn and adjust that one too. But yeah please post a new thread for it because it involves a specific plugin.
     
  4. Boonty

    Boonty Veteran Veteran

    Messages:
    48
    Likes Received:
    20
    First Language:
    French
    Primarily Uses:
    RMMV
    Hey guys, could you help me out ?

    I want to permanenlty change the stateRate of one of my heroes to make him immune with javascript formula. I am quite lame so I tried this :

    But it didn't work. What it the correct formula ?
     
  5. Blazatryx

    Blazatryx Warper Member

    Messages:
    3
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    I'm trying to make a state that reacts differently depending on if an actor's skill is targeting one enemy or multiple enemies. For instance:

    if (skill targets one enemy)
    add an extra action for the player
    if (skill targets multiple enemies)
    add an extra action and increase next turn's attack power by x1.5

    I'm just struggling to find the code I would need for the if conditions. Is it possible?
     
  6. Silva

    Silva Scoobityboo Veteran

    Messages:
    325
    Likes Received:
    163
    First Language:
    English
    Primarily Uses:
    RMMV
    Because state rate is derived from traits you can't just set it as a number. I'd advise finding a dynamic traits plugin and adding a 0% stateRate trait to the actor using that - I've used Shaz's in the past but there are others out there.

    I would approach this using

    Code:
    [1, 3].contains(skill.scope) //for 1 enemy
    [2, 4, 5, 6].contains(skill.scope) //for multiple enemies
    You'll need to replace "skill" with a reference to the database skill, what you use though depends largely on how and when you're actually executing this code. Are you using a plugin (if so, which one) or writing one?
     
    Boonty likes this.
  7. Boonty

    Boonty Veteran Veteran

    Messages:
    48
    Likes Received:
    20
    First Language:
    French
    Primarily Uses:
    RMMV
    @Silva

    Thanks for your answer. I effectively solved my problem with Galv Dynamic Traits plugin.
     
    Silva likes this.
  8. misnina

    misnina Warper Member

    Messages:
    1
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMMV
    EDIT: Use your IDE that checks for your errors even if it takes longer to run kids! Cause it was me just making really small mistakes my lightweight editor didn't catch before it didn't compile at all.

    Original: I'm missing some kind of super basic thing and I don't know what it is. This is my first plugin and the game fails to recognize it beyond the help text. I put in some stuff to make it error everywhere and it did nothing. I'm convinced it's just not reading it, and I've compared it to other scripts, started fresh projects, and nothing will happen when I do the plugin command.

    So here's the code, sans the errors I was trying to make happen.
     
    Last edited: Nov 16, 2019
  9. JosephSeraph

    JosephSeraph White Mage Restaff

    Messages:
    881
    Likes Received:
    736
    Location:
    Santos, Brasil
    First Language:
    Portuguese
    Just a random question I don't think it's worth making a thread over: I have a feeling Yanfly's Battle Engine Core doesn't allow us to have Cast Animations on front view mode + Battle Status Window? Are Cast Animations locked to sideview only? I've tried a few different setups to no avail.
    Does anyone have any info on this?
     
  10. Poryg

    Poryg Dark Lord of the Castle of Javascreeps Veteran

    Messages:
    4,014
    Likes Received:
    10,163
    Location:
    Czech Republic
    First Language:
    Czech
    Primarily Uses:
    RMMV
    I think so. Cast animations don't make too much sense in front view anyway, since there's not really a viable way to make them appear without it looking awkward.
     
  11. Ossra

    Ossra Formerly Exhydra Veteran

    Messages:
    913
    Likes Received:
    655
    First Language:
    English
    Primarily Uses:
    RMMV
    @JosephSeraph Yeap, the cast animations added by YEP Battle Engine Core are side view only.

    Code:
    // Line 2725 YEP_BattleEngineCore
    if (!$gameSystem.isSideView() && this._subject.isActor()) return true;
     
  12. JosephSeraph

    JosephSeraph White Mage Restaff

    Messages:
    881
    Likes Received:
    736
    Location:
    Santos, Brasil
    First Language:
    Portuguese
    Awesome, thanks for being so quick to reply and so on point. Of course I tried to pull the smarties and just erase "!$gameSystem.isSideView() &&" from the code; that did predictably not work, although it surprisingly also didn't break the game.

    I'd argue cast animations are more important in frontview than they are in sideview in terms of communicating who is acting, because sideview at least does let the current actor step forward and pose. On frontview, the casting animation should display on the character's face when using Battle Status Window, which is how I believe it behaved on Ace; it's understandable that it doesn't now though since Battle Core and Battle Status are no longer the same thing.

    Still, I find it to be quite disorienting to have no way to tell who acted, especially when using an ATB / charge time system, for example.
    Slapping Victor Sant's cast animations on top seems to kinda work...

    Also, and I think this is probably common knowledge, but Flashes don't work on the faceset sprites either (and that's likely just because they're not the actual target of the animations, rather the animations are probably playing on an invisible object / battler)

    Speaking of flashes, a simple flash would go a long way in making which actor moved more easy to read. But yeah, that might become something more like a plugin request and not this thread. Woop!
     
  13. Poryg

    Poryg Dark Lord of the Castle of Javascreeps Veteran

    Messages:
    4,014
    Likes Received:
    10,163
    Location:
    Czech Republic
    First Language:
    Czech
    Primarily Uses:
    RMMV
    There's always the battle log ;)
     
    Silva likes this.
  14. Oracle-Raven

    Oracle-Raven Villager Member

    Messages:
    8
    Likes Received:
    2
    First Language:
    French (Canada)
    I'm sure the answer is obvious, but I've searched and didn't find anything.
    By default, RPG Maker MV lists the base parameters in the following order:
    HP, MP, Attack, Defense, Magic Attack, Magic Defense, Agility, Luck
    But how can I reorder them like this instead?
    HP, MP, Defense, Magic Defense, Attack, Agility, Magic Attack, Luck

    I've started a new project for testing purposes, and I'm using Yanfly's YEP_CoreEngine v1.31, YEP_BaseParamControl v1.04, YEP_X_ClassBaseParam v1.05, and YEP_StatusMenuCore v1.04
     
  15. Silva

    Silva Scoobityboo Veteran

    Messages:
    325
    Likes Received:
    163
    First Language:
    English
    Primarily Uses:
    RMMV
    It largely depends on where you want to re-order them.

    If you mean in the editor, you can't.
    If you mean how things like $gameActors.actor(1).param(1) works, you'll need to rewrite how all the functions used within this function retrieve their values.
    If you mean how they're displayed in menus you'll need to rewrite how the window draws its content.

    You'll need to be more specific about what you want before we can give you a proper explanation on how/if you can do this.
     
    Oracle-Raven likes this.
  16. Oracle-Raven

    Oracle-Raven Villager Member

    Messages:
    8
    Likes Received:
    2
    First Language:
    French (Canada)
    Yep, that part is what I meant, sorry if I wasn't clear enough. Basically what the player sees when they open the Status menu or Equip menu.
    Any pointers about what I should modify or be trying to look for?
     
  17. Silva

    Silva Scoobityboo Veteran

    Messages:
    325
    Likes Received:
    163
    First Language:
    English
    Primarily Uses:
    RMMV
    For the equip window you'll have to rewrite the function Window_EquipStatus.prototype.refresh. The default is this:

    Code:
    Window_EquipStatus.prototype.refresh = function() {
        this.contents.clear();
        if (this._actor) {
            this.drawActorName(this._actor, this.textPadding(), 0);
            for (var i = 0; i < 6; i++) {
                this.drawItem(0, this.lineHeight() * (1 + i), 2 + i);
            }
        }
    };
    What this is doing is drawing every parameter from numbers 2-7 in order. The line we're interested in is "this.drawItem(....". If you refer to the function Window_EquipStatus.prototype.drawItem you can see what each of the parameters actually are. You have 2 solutions for solving this, you can either remove the for loop and write out the drawItem functions individually, or you can create an array to hold the order the params will be written in. For simplicity I'll show you the latter.

    Code:
    Window_EquipStatus.prototype.refresh = function() {
        this.contents.clear();
        if (this._actor) {
            this.drawActorName(this._actor, this.textPadding(), 0);
            var order = [2, 4, 3, 6, 5, 7];   //create an array with the order we want parameters to show in
            for (var i = 0; i < 6; i++) {
                this.drawItem(0, this.lineHeight() * (1 + i), order[i]); //retrieve the appropriate value from the above array
            }
        }
    };
    Note - I've just used a random order for the parameters, you'll need to shuffle them around inside the array to suit your needs.

    I would advise saving the above code snippet as a .js file using a text editor and adding it to your game as a plugin as opposed to messing with the existing code. This will overwrite the function but means you can easily revert the change if there's any mistakes by removing the plugin.

    This approach can be used for adjusting within the status windows too. As you're using Yanfly's StatusMenuCore you'll need to look for the function that's drawing the parameters within that plugin's code and overwrite that in a similar manner.
     
    Oracle-Raven likes this.
  18. Oracle-Raven

    Oracle-Raven Villager Member

    Messages:
    8
    Likes Received:
    2
    First Language:
    French (Canada)
    Thank you very much Silva! This is exactly what I needed!
    It is very much appreciated! :kaocry:
     
    Silva likes this.
  19. Indinera

    Indinera Indie Dev Veteran

    Messages:
    1,765
    Likes Received:
    719
    Location:
    Europe
    First Language:
    French
    What part to edit to alter the default selling price of items and equipment?
     
  20. Papillon

    Papillon Veteran Veteran

    Messages:
    41
    Likes Received:
    5
    First Language:
    English
    Primarily Uses:
    RMMV
    Probably going about this wrong, but is there any way to delay a SceneManager.pop(); call?
    I'm trying to make an animation that occurs when a menu is closed but it's skipped over when I call the pop command.
     

Share This Page