JavaScript questions that don't deserve their own thread

● ARCHIVED · READ-ONLY
Started by Shaz 3413 posts Page 38 of 171 View original ↗
  1. With yanfly's grid-free doodads, is there a way to copy doodad data from one ap to another? I have a copy of a map for a cut scene but I'd rather not have to set each and every single doodad again XD thanks
  2. Hey, I'm having a strange issue I don't understand where hooking into a Game_Enemy's setup function is giving me errors even though I don't change anything.

    Code:
    var Game_Enemy_setup = Game_Enemy.prototype.setup;
    Game_Enemy.prototype.setup = function() {
      Game_Enemy_setup.call(this);
    };

    that gives me

    Code:
    TypeError: Cannot read property 'params' of undefined
        at Game_Enemy.paramBase (file:///D:/Games/playground/js/rpg_objects.js:4343:24)
        at Game_Enemy.Game_BattlerBase.param (file:///D:/Games/playground/js/rpg_objects.js:2449:22)
        at Game_Enemy.Object.defineProperties.mhp.get (file:///D:/Games/playground/js/rpg_objects.js:2131:42)
        at Game_Enemy.Game_BattlerBase.recoverAll (file:///D:/Games/playground/js/rpg_objects.js:2619:20)
        at Game_Enemy.setup (file:///D:/Games/playground/js/rpg_objects.js:4307:10)
        at Game_Enemy.setup (file:///D:/Games/playground/js/plugins/ART_AggroSystem.js:78:20)
        at Game_Enemy.initialize (file:///D:/Games/playground/js/rpg_objects.js:4291:10)
        at new Game_Enemy (file:///D:/Games/playground/js/rpg_objects.js:4283:21)
        at Game_Troop.<anonymous> (file:///D:/Games/playground/js/rpg_objects.js:5255:25)
        at Array.forEach (native)

    in the debugger.

    My goal is to initialize a new variable to work with in Game_Enemy, so any help with that would be appreciated.



    edit:
    ugh figured it out right as i posted, forgot to pass the arguments, if I could delete this post i would.
  3. Bit of a noobie question (maybe?)

    I'm trying to give my item descriptions more flavour text (think Dark Souls):
    This is what I've done
    7a6d31e70e.jpg

    I've rearranged the item menu to compensate for this as shown above, but now I need to work out how to put more text into the help window. In addition (But it's not required), I'd like to have a larger image displayed above the text representing said item. I've heard about using Notes to replace the item description space but I have no idea how to. Sorry if this is a more complicated question than this page warrants.

    UPDATE: I've figured out how to use the notes by myself, the only issue now is displaying the image.
  4. wait i realized the answer to my original question seconds after i posted this,
    Where's The Delete Button!!!

    please don't pay any attention to this post, the very fact that i had to ask is very embarassing
  5. Is it possible for the system to execute a plugin command/script call/common event every time the menu is accessed and closed?

    Besides having a global parallel event checking for when the menu is opened/closed to execute those actions.

    Edit: I tried this:
    Code:
    var _Scene_Map_callMenu = Scene_Map.prototype.callMenu;
    Scene_Map.prototype.callMenu = function() {
        _Scene_Map_callMenu.call(this);
        $gameTemp.reserveCommonEvent(215);
    };

    and it executes the common event each time I call the menu.
    (I just tested incrementing a variable so far)

    Are there any risks behind what I tried?

    Edit 2: Oh, it "reserves" the common event. As in, it executes immediately after leaving the menu. Not at the same time of entering the menu :/
  6. I'm not experienced with JavaScript - but I do have a general idea of how it works. I want to come up with a script for a specific weapon in my game.

    Basically, the idea is the weapon changes colors depending on the user's state, probably using Yanfly's Weapon Animation Plug in...

    The general idea is... something like...

    Code:
    if user.state = Enfire
    then <Weapon Image: Fire Sword>
    
    elseif user.state = Enblizzard
    then <Weapon Image: Ice Sword>
    
    else
    <Weapon Image: Steel Sword>

    Can something like this go in the Note section of the weapon, and if so - what's the syntax/structure I should be using? I get the logic of what I want to do, but don't really know how to tell the game what to do.

    Thanks in advance!
  7. Greetings all. I'm trying to make a state that forces the actor afflicted with it to auto-battle. This is fine on it's own, but I'm running into an issue where an auto-battling actor is capable of using skills that the player wouldn't normally be able to use. Is there a function I can call to get all sTypes an actor is capable of using?

    Eg: Actor1 started as a wizard, and had access to Black Magic, and learned some of those skills. At some point Actor1 became a Knight instead, and lost access to the Black Magic sType. If Actor1 becomes an auto-battle actor, he will suddenly be able to use black magic spells again, even though the player has no way to do that.

    If I could find a function to list sTypes an actor can use, I could filter the available skills by sType... I think. Any ideas?
  8. Can you change resolution during gameplay or does it have to be called beforehand? Trying to debug a plugin I'm making but if the answer's as simple as "you can't change resolution during gameplay" that'd be a big help.
  9. Question about windows:
    Is there a way to change the z order of the windows? For instance, the window I created using js stays in the front of the standard message system, so some part of the message window and the messages itselfs are cutted off. Is there a way to display the message system on the front of the other windows?
  10. How can I remove the 'Options' command from the main menu? I found a plugin using google, but I don't know if it's available for commercial use or not. Yeah, I'm being a bit paranoic.

    Thanks for reading!!!
  11. Having a bit of a confusing issue here. I've created a new instance of Window_Base into which I'm drawing a face graphic, and I put in the call to drawFace and everything and it's all hunky-dory. In the initialize method I call ImageManager.loadFace(filename) to load in the graphic prior to calling the refresh function.

    The problem is, when I iniitially call the scene, the window is blank. The face graphic doesn't show up until the second time it's accessed. It works fine if ImageManager.loadFace is called in the console prior to starting the scene, so what's causing it to not show up initially?

    Edit: Never mind, I figured it out. I had to call the window's refresh function in the start function of the scene so that the image would be loaded before it displayed.
  12. Hello. I was thinking about... very rude boss mechanics and I was wondering if this would be the correct if statement to use if I was, say, checking to see if someone was using a skill to heal someone:

    if (this.isSkill() && target.result().hpDamage < 0)

    EDIT: I hit post too soon!

    Additional information: this code would be in a state on an actor and if the check, uh, checks out then it forces an enemy to do an action.
  13. How can I get the character whose turn it is to not move up when I'm selecting a command?
  14. So I just recently started dabbling with javascript, and I'm trying to make my first plugin. I simply want to adjust the x,y,width, and height of the Select Item Window, and be able to use a plugin command to change those params in game. My issue is, that I don't quite understand how to alias this particular function (Nor really how to alias at all, except for the select few commands I've seen done in videos, etc).
    This is the code from MV:
    Spoiler
    Code:
    function Window_EventItem() {
        this.initialize.apply(this, arguments);
    }
    
    Window_EventItem.prototype = Object.create(Window_ItemList.prototype);
    Window_EventItem.prototype.constructor = Window_EventItem;
    
    Window_EventItem.prototype.initialize = function(messageWindow) {
        this._messageWindow = messageWindow;
        var width = Graphics.boxWidth;
        var height = this.windowHeight();
        Window_ItemList.prototype.initialize.call(this, 0, 0, width, height);
        this.openness = 0;
        this.deactivate();
        this.setHandler('ok',     this.onOk.bind(this));
        this.setHandler('cancel', this.onCancel.bind(this));
    };

    At first, I tried altering this line: Window_ItemList.prototype.initialize.call(this, 0, 0, width, height);
    But no changes showed in my game (probably cause I have no idea what I'm doing =] )

    I think I can replace 0, 0, width, height with variables for the plugin command functionality, but I guess I'm looking for some help on aliasing this particular function, and others like it.
  15. @GoodSelf - I'm not sure if this is what you are looking for.
    PHP:
    Window_EventItem.prototype.initAlias = Window_EventItem.prototype.initialize;
    Window_EventItem.prototype.initialize = function(messageWindow) {
      // do stuff
      this.initAlias.apply(this, arguments);
      // do stuff
    };
    Window_ItemList.prototype.initAlias = Window_ItemList.prototype.initialize;
    Window_ItemList.prototype.initialize = function(x, y, width, height) {
      // do stuff
      this.initAlias.apply(this,arguments);
    }

    Or better yet (because I now see what , alias Window_ItemList.prototype.initialize the same way.
  16. mogwai said:
    @GoodSelf - I'm not sure if this is what you are looking for.
    PHP:
    Window_EventItem.prototype.initAlias = Window_EventItem.prototype.initialize;
    Window_EventItem.prototype.initialize = function(messageWindow) {
      // do stuff
      this.initAlias.apply(this, arguments);
      // do stuff
    };

    It's like greek to me. I'll take a look at this code and do some research, thanks!
  17. I edited my post with a second alias, because after looking at your thing deeper, I wasn't sure which part was plugin and which part was rpg_windows.js

    But any function can be aliased like that unless it returns a thing, I think. Then just return its alias apply or call.
  18. Simple question I think. I want to load a picture/bust for each character instead of their face in the menu screen. Is this a difficult job or pretty straightforward?