JavaScript questions that don't deserve their own thread

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

  1. Rigor Mortex

    Rigor Mortex Mankind's Mirror Veteran

    Messages:
    58
    Likes Received:
    3
    Location:
    Dark World
    First Language:
    English
    In MV, how can I set up a skill that randomly hits X number of times, but can't hit the same target more than Y number of times, and ends the skill as soon as the latter limit is reached? Examples:
    1. Skill A: Randomly attacks 10 times, but can't target a given enemy more than 4 times. Against a Troop of one enemy, or a Party of one, it would hit the sole unit four times, and then end without the other six hits coming into play.
    2. Skill B: Randomly attacks 8 times, but can't target a given enemy more than 2 times. Against a Troop or Party of four, provided they were all alive, each unit would take two hits.
    I should note I have most of Yanfly's Plugins, and not much else atm. On that note, I actually tried changing the numbers in the "Chain Lightning" Tip/Trick they'd posted, first, believing that would be sufficient, but it didn't work at all.
     
  2. Restart

    Restart Veteran Veteran

    Messages:
    260
    Likes Received:
    170
    First Language:
    English
    Primarily Uses:
    RMMV
    It'd be considerably easier to only track hits - you can do that just by sticking a counter into the damage formula, wrapped in an if statement that checks which character is attacking.

    If you want to be more elaborate, easiest way is to use yanfly's action sequence pack to increment the counter in the first phase of your basic attack, before it hits or misses.
     
  3. Bryling

    Bryling Warper Member

    Messages:
    3
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMXP
    Thanks, Restart. I'll try that.
     
  4. Bryling

    Bryling Warper Member

    Messages:
    3
    Likes Received:
    0
    First Language:
    English
    Primarily Uses:
    RMXP
    Sorry, I have another question. It's about a plugin: NeMV Tags. I can figure out the basics, but I'm completely stumped on this. I'm trying to have a weapon inflict 20% more damage when used on a enemy tagged "monster". I'm not really sure how I would do this though. Anyone familiar with the plugin and knows how it's done?
     
  5. Myst88

    Myst88 Veteran Veteran

    Messages:
    95
    Likes Received:
    181
    Location:
    Wales
    First Language:
    English
    Hope this is the right thread for this. Don't think it needs its own thread... I just bought Atelier Irina's new plugin. It's a recruiting board that allows me to hire party members. Only problem I'm facing is that it allows me to buy them all at once, it's not taking the party limit into account. There is a bit in the Lunatic mode that allows the user to customise the recruiting process.

    <Custom Recruit Enable>
    JavaScript Code
    JavaScript Code
    enable = JavaScript Code
    </Custom Recruit Enable>
    - Replace the JavaScript Code inside the notetags with JavaScript.
    This code will determine custom enable requirements for the recruit list.
    - 'actor' variable will refer to the actor being recruited.
    - 'enable' variable is a true/false that determines if recruiting is enabled


    So basically my question is, is there a code to make it possible to only enable a actor to be recruited if the party limit has not been reached? (Basically if i have 4 party members I will have to get rid of one to be able to recruit more?
     
  6. Ossra

    Ossra Formerly Exhydra Veteran

    Messages:
    913
    Likes Received:
    654
    First Language:
    English
    Primarily Uses:
    RMMV
    @Myst88 Hmm, well, I do not have access to the plugin to check, so the following is a bit of a guess on my part :

    Code:
    <Custom Recruit Enable>
    enable = $gameParty.size() < 4;
    </Custom Recruit Enable>
     
  7. ramza

    ramza Lunatic Coder Veteran

    Messages:
    558
    Likes Received:
    308
    Location:
    Nova Scotia, Canada
    First Language:
    English
    Primarily Uses:
    RMMV
    Code:
    <Custom Recruit Enable>
       if ($gameParty.members().length >= 4){
       enable = false
       } else {
       enable = true
       }
    </Custom Recruit Enable>
     
    That should do it.
     
    Myst88 likes this.
  8. Myst88

    Myst88 Veteran Veteran

    Messages:
    95
    Likes Received:
    181
    Location:
    Wales
    First Language:
    English
    @ramza Perfect. Thank you so much!
     
  9. Okk

    Okk Veteran Veteran

    Messages:
    46
    Likes Received:
    9
    First Language:
    English
    Does anybody know a script call for Yanfly's In-Battle Status?
    I'd like to call it from somewhere other than the party menu.
     
  10. Poryg

    Poryg Dark Lord of the Castle of Javascreeps Veteran

    Messages:
    4,014
    Likes Received:
    10,161
    Location:
    Czech Republic
    First Language:
    Czech
    Primarily Uses:
    RMMV
    @Okk it's the last line of

    Code:
    Window_PartyCommand.prototype.makeInBattleStatusCommand = function() {
      if (!$gameSystem.isShowInBattleStatus()) return;
      var index = this.findSymbol('escape');
      var text = Yanfly.Param.IBSCmdName;
      this.addCommandAt(index, text, 'inBattleStatus', true);
    };
    if you're searching for a way to add command. If you want to merely call the window, it's more complicated than that as you need to hide everything and then show that window.

    But you show the window using
    Code:
    SceneManager._scene.commandInBattleStatus();
     
  11. Okk

    Okk Veteran Veteran

    Messages:
    46
    Likes Received:
    9
    First Language:
    English
    I'm having some trouble. I managed to add a Status command to the actor command menu in battle, but it doesn't actually do anything. Maybe it's an issue with the privacy of Yanfly's command symbol? I don't really know javascript well enough to be sure.
    I also tried calling it in a common event, and you were right about that being more complicated; it called the status window, but never went back to the command menu, effectively soft locking the game.
     
  12. Poryg

    Poryg Dark Lord of the Castle of Javascreeps Veteran

    Messages:
    4,014
    Likes Received:
    10,161
    Location:
    Czech Republic
    First Language:
    Czech
    Primarily Uses:
    RMMV
    No, I forgot to attach the setHandler.

    The last two lines show the attachment of the handler.

    Code:
    Yanfly.IBS.Scene_Battle_createPartyCommandWindow =
      Scene_Battle.prototype.createPartyCommandWindow;
    Scene_Battle.prototype.createPartyCommandWindow = function() {
      Yanfly.IBS.Scene_Battle_createPartyCommandWindow.call(this);
      var win = this._partyCommandWindow;
      win.setHandler('inBattleStatus', this.commandInBattleStatus.bind(this));
    };
    
    I've also made some MV Javascript tutorial series if you're interested in knowing more.
     
  13. Okk

    Okk Veteran Veteran

    Messages:
    46
    Likes Received:
    9
    First Language:
    English
    No luck, just a bunch of undefined errors. This is a more complicated problem than I thought.
    And apparently you can't actually program anything without knowing the "Syntax" or whatever.
     
  14. ZankokuNoYami

    ZankokuNoYami Veteran Veteran

    Messages:
    55
    Likes Received:
    15
    First Language:
    English
    Primarily Uses:
    N/A
    Hoping this is the right place. I don't know if it deserves it's own thread. Not sure where just a 'general discussion' section is, but this sounded like it?

    Alright. So I am importing my maps from XP to MV. Naturally, huge hurdle. However, I have been told about things like TileD. Which would ultimately lead into parallax mapping, right?

    What is THE best plugin for having multiple parallax levels? Something that wont conflict with other scripts like MOG's Weather (since that seems to have multiple weather layers).

    When looking it up, I only found old threads. One from 2015 saying to not use Bind Pictures to Map due to huge memory issues. I also had read that RMMV had memory leaking issues to begin with... but in 2016, a thread mentioned an update 1.3.2 that fixed the memory leak issue.

    I am essentially planning to do a lot of things. And I want my game to run as smoothly as possible without eating up memory or costing FPS.

    Any plugin ideas would be greatly appreciated!
     
  15. Almightypebble

    Almightypebble Veteran Veteran

    Messages:
    58
    Likes Received:
    1
    First Language:
    Bulgarian
    Primarily Uses:
    RMMV
    Hey, guys!

    So I'm using SRD's Battle Status Customizer, and I'm showing some text through it, like: `Health[${actor.hp}/${actor.mhp}]`
    I'm wondering how can I make it so that the ${actor.xx} values are a different color, since text codes don't seem to work there.
    I tried with \C[x] but it doesn't work. Since it says in the description that it should be a javascript evaluation,
    I'm guessing I should use a script for the color change as well? I just don't know what the script would be.

    Cheers!
     
  16. Ossra

    Ossra Formerly Exhydra Veteran

    Messages:
    913
    Likes Received:
    654
    First Language:
    English
    Primarily Uses:
    RMMV
    @Almightypebble Hmm, if it is evaluating the script, then try the following :

    Code:
    // 'colorId' points to the colors on the windowskin
    this.changeTextColor(colorId);
    
    // Then after your code, reset the color ...
    this.resetTextColor();
     
    Almightypebble likes this.
  17. Almightypebble

    Almightypebble Veteran Veteran

    Messages:
    58
    Likes Received:
    1
    First Language:
    Bulgarian
    Primarily Uses:
    RMMV
    @Ossra
    Ah, if I try that it just returns the new color eval as undefined.
    So if I use:
    `Health[${this.changeTextColor(10)}${actor.hp}]`
    it shows up as:
    Health[undefined100]
     
  18. Ossra

    Ossra Formerly Exhydra Veteran

    Messages:
    913
    Likes Received:
    654
    First Language:
    English
    Primarily Uses:
    RMMV
    @Almightypebble Ah, yeah, actually looking at the code, what I suggested will not work. I do not think there is a way to do so without modifying the plugin.
     
  19. BurningOrca

    BurningOrca Veteran Veteran

    Messages:
    103
    Likes Received:
    83
    First Language:
    German
    Primarily Uses:
    RMMV
    Is it good or bad thinking to keep plugins private, because of knowing that there exist already at least one (probably better) plugin from another author, that serves the same purpose?
     
  20. Anarcho-paladin

    Anarcho-paladin Veteran Veteran

    Messages:
    115
    Likes Received:
    13
    First Language:
    French
    Is it a JavaScript related question, or simply one about etiquette? If it's a question about JavaScript, I don't understand it.
     

Share This Page