JavaScript questions that don't deserve their own thread

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

  1. ramza

    ramza Lunatic Coder Veteran

    Messages:
    538
    Likes Received:
    294
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    I feel like this probably hasn't been asked before, but I can't check 26 pages of content to make sure...


    I'm trying to find a script method to have a battler call it's own guard motion. I found a performCollapse, and performFlinch, but no peformGuard. I want the battler to make it's guard motion for a bit and then change back, but can't seem to find a way to call a specific animation from the battler spritesheet.


    Any ideas?


    Thanks in advance.
     
    Sekunri likes this.
  2. Sekunri

    Sekunri Creator of Worlds Veteran

    Messages:
    132
    Likes Received:
    73
    Location:
    South Carolina, USA
    First Language:
    English
    Primarily Uses:
    RMMV
    I believe they're called Motions. You can find various commands for them within Game_Actor.


    What you are looking for is Game_Actor.prototype.performAction


    Inside you will find if (action.isGuard()) { this.requestMotion('guard') }
     
    ramza likes this.
  3. ramza

    ramza Lunatic Coder Veteran

    Messages:
    538
    Likes Received:
    294
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    That was exactly what I needed. Thank you muchly.
     
    Sekunri likes this.
  4. Sekunri

    Sekunri Creator of Worlds Veteran

    Messages:
    132
    Likes Received:
    73
    Location:
    South Carolina, USA
    First Language:
    English
    Primarily Uses:
    RMMV
    Does anyone happen to know how to call a skill animation on an actor in combat?
     
  5. ramza

    ramza Lunatic Coder Veteran

    Messages:
    538
    Likes Received:
    294
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    You should be able to do that by using this.startAnimation($dataSkills[X].animationId, [mirror], [waitframes]) called from the affected battler somehow. X being the Id of the skill you want the animation for. Using a script you could even pass the skillId to a variable and use that as well, if needed.
     
    Sekunri likes this.
  6. Hatjin

    Hatjin Villager Member

    Messages:
    7
    Likes Received:
    1
    First Language:
    Russian
    Is there a plugin on the similarity of this script:

    Code:
    class Game_Map
      def change_region_id(x, y, id)    
        mask = id << 8 | 0x00FF # (1, 2, 3)
        data[x, y, 3] |= 0xFF00  # (4)
        data[x, y, 3] &= mask    # (5)
      end
    end
     
  7. Sekunri

    Sekunri Creator of Worlds Veteran

    Messages:
    132
    Likes Received:
    73
    Location:
    South Carolina, USA
    First Language:
    English
    Primarily Uses:
    RMMV
    @ramza Thank you that was exactly what I needed. Been making some exciting leaps forward on my plugin now that the silly little roadblock has been passed.


    @Hatjin  Due to not everyone understanding Ruby it would also be in your best interest to give a small description of what the code above is supposed to do.


    Good luck to whoever takes this one up. If I knew what it was doing maybe I could remember... but alas its been a few years since I've really touched on Ruby. I'm sticking to JS.
     
  8. Hatjin

    Hatjin Villager Member

    Messages:
    7
    Likes Received:
    1
    First Language:
    Russian
    Oh, sorry. This script changes the region of the game. From Hime tutorial http://himeworks.com/2014/11/understanding-tile-regions/
     
    Sekunri likes this.
  9. waynee95

    waynee95 Lunatic Coder Veteran

    Messages:
    623
    Likes Received:
    509
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
  10. Hatjin

    Hatjin Villager Member

    Messages:
    7
    Likes Received:
    1
    First Language:
    Russian
  11. Kes

    Kes Global Moderators Global Mod

    Messages:
    20,612
    Likes Received:
    10,514
    First Language:
    English
    Primarily Uses:
    RMVXA
    Hatjin, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.


    If you want to add something, simply edit your earlier post.
     
  12. Hatjin

    Hatjin Villager Member

    Messages:
    7
    Likes Received:
    1
    First Language:
    Russian
    The message that was in front of my comments have been removed. It's not my fault.
     
  13. ramza

    ramza Lunatic Coder Veteran

    Messages:
    538
    Likes Received:
    294
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    Does anyone happen to know if it's possible to call a function to imitate a key press on the keyboard? My endgame here is to have a button you can click (or touch) that reacts as if you hit a specific control key (like 'ok' or 'cancel') but I'm not having much luck finding these functions if they exist at all.


    Any help is once again, appreciated. :)
     
  14. Prescott

    Prescott argggghhh Veteran

    Messages:
    445
    Likes Received:
    296
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    How can you remove the pixel offset entirely? I want all of my events to not be offset, but I still want bush tags to apply to them. That, and I kind of made a load of character graphics already and they're in the game... changing the filename would require me to change all of the events which would be absolute hell.


    @ramza so you're trying to have the game virtually press keys for the player? or are you looking to make it so that when the player interacts with an event it thinks it was a different button input than what it originally was? or is it more like you are looking to make it so that an event, maybe a switch, changes it's graphic or something similar when a certain key is pressed?
     
    Last edited by a moderator: Dec 8, 2016
  15. Shaz

    Shaz Veteran Veteran

    Messages:
    37,584
    Likes Received:
    11,300
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    Just save this as a new .js file in your plugins folder.  Name doesn't matter.  Then add it to your plugins list, anywhere.

    Code:
    Game_CharacterBase.prototype.shiftY = function() {
        return 0;
    };
     
    Last edited by a moderator: Dec 8, 2016
    Prescott likes this.
  16. Prescott

    Prescott argggghhh Veteran

    Messages:
    445
    Likes Received:
    296
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    Thanks @Shaz! If I already have characters that have ! in front of them, will they be shifted down further now or will they remain the same? If they are that's okay, I have way less of that than I do the other way around.
     
  17. Shaz

    Shaz Veteran Veteran

    Messages:
    37,584
    Likes Received:
    11,300
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    No, they won't be shifted down.
     
    Prescott likes this.
  18. ramza

    ramza Lunatic Coder Veteran

    Messages:
    538
    Likes Received:
    294
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    I'm trying to make it so that if the player were to click on something on screen (like a picture) that the game would interpret the click on the picture as if the keyboard had been used to press enter, or escape, or whatever else. Think like visual controls on screen, sort of.


    Or another use could be a somewhat interactive tutorial, in which the cursor in the menu moves on its own to show the player how to get to a certain menu, and perform a task, like the materia tutorial in final fantasy 7, for example.
     
    Last edited by a moderator: Dec 8, 2016
  19. Sekunri

    Sekunri Creator of Worlds Veteran

    Messages:
    132
    Likes Received:
    73
    Location:
    South Carolina, USA
    First Language:
    English
    Primarily Uses:
    RMMV
    Curious if anyone knows of a way to make an actor invisible during sideview battles. I'm probably thinking to hard on this honestly but I would prefer a script way to make the actor invisible. I do not wish to have no image and then replace it with an image during this scene if at all possible.
     
  20. ramza

    ramza Lunatic Coder Veteran

    Messages:
    538
    Likes Received:
    294
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    this.spriteOpacity(x,y) will cause the battler to become x opaque (0-255, 0 being invisible) in y frames.
     

Share This Page