JavaScript questions that don't deserve their own thread

● ARCHIVED · READ-ONLY
Started by Shaz 3413 posts Page 68 of 171 View original ↗
  1. Riazey said:
    Is it possible to retrieve the event ID at x position?
    Yes, although you'll also need to input a y position. The x position is an entire column and there could be many events in that column. Here's the code:
    Code:
    $gameMap.eventIdXy(x, y);
  2. Ah nice! I saw that floating around but was unsure if it was to get the id at xy or the xy or an eventid! Thanks!
  3. Hello! I'm using Yanfly's Victory Aftermath plug-in, and I've got a little problem I'd appreciate some help with. I've got it set to show when a character learns a skill on level-up, but the learned skill message is running over the character's name.

    Example
    whyyounamesobigmanny.png

    I know I can reduce the text size in the plug-in parameters, but I have to make it pretty small to get everything in there without renaming the skill. Instead, what I'd rather do, is move the message down into the blank space below the "Gained EXP" message. This seems like it should be simple enough, but I don't know enough about JS to spot where I should be moving things about, hence coming here instead.
  4. Javascript-noob question: Can "big numbers" in the codes cause any issues/slowdowns? I often prefer to use numbers to specify the properties of most windows (especially on the menus), so I might end up with numbers like 200 or 446. The big numbers I see in the main plugins are very rarely related to windows, so that's why I'm kinda unsure.
    As an example, I'm using these:
    Code:
    Window_ActorCommand.prototype.windowWidth = function() {
        return 130;
    };
    
    Window_ActorCommand.prototype.windowHeight = function() {
        return 162;
    };
    -
    Also, is this safe maths? (please don't ask why):
    Code:
    Window_SkillStatus.prototype.initialize = function(x, y, width, height) {
        Window_Base.prototype.initialize.call(this, x + 20, y, width - 20, height * 2);
        this._actor = null;
    };
  5. How do you check wich turn it is in battle?
  6. I am actually having a issue with SV actors sprites.
    I came across when a actor is in the stepback phase (after their action going back to where they started at), I dunno if this a default thing or not, but they get stuck in those frames and and I did turn off all of my plug-ins and let it all be default and it will still do it.
    what should I be looking for that would cause this and how to to fix it?

    Plug-ins I have that relate to battle mechanics in anyway:
    YEP_EngineCore
    YEP_BattleEngineCore
    YEP_X_BattleSysSTB
  7. I had a quick question on Yanfly's wonderful Quest Journal plugin. Do quests appear in the quest journal in the order you encounter and receive them, or in the order you list them manually in the plugin itself instead? I ask because if I decided late in my development to make a new quest early on in my game, it would be silly to have it listed as Quest 99 in the journal when it should be Quest 1 or 2, for instance.

    I'm looking to move to that quest system since the other doesn't seem to be supported anymore, so I don't want to encounter any more issues with it that I stumble around trying to figure out.
  8. HotAndColdAF said:
    Hello! I'm using Yanfly's Victory Aftermath plug-in, and I've got a little problem I'd appreciate some help with. I've got it set to show when a character learns a skill on level-up, but the learned skill message is running over the character's name.

    Example
    View attachment 137415

    I know I can reduce the text size in the plug-in parameters, but I have to make it pretty small to get everything in there without renaming the skill. Instead, what I'd rather do, is move the message down into the blank space below the "Gained EXP" message. This seems like it should be simple enough, but I don't know enough about JS to spot where I should be moving things about, hence coming here instead.

    Hi! I'm having the same problem, did you find a solution?
  9. Is there a script call that checks the current active actor?
    Like in battle, when characters take turns I'd like to know if its possible to reference the current active character whose turn it is?
    I'm using SRDude's hud maker and I'd like to make it so an element shows the character's name, level and class only when its that character's turn.
  10. Does anyone know if there is a script call command(or plugin) to scale a battler and/or enemy? I'm intending to scale them during battle.
  11. Using http://sumrndm.site/hud-maker/ to make a battle ui.

    I know very little about javascripting so unsure if this is difficult or not.

    Simply put, this ''${$gameParty.leader().name()}'' makes the name appear on screen.

    Is there a similar code to make Class appear?
    Tried changing name with class/showclass but i get error ''class is not a function''.

    Nvm, making a post :p
  12. Hello all,
    in my game i made a diablo like random loot system using yanfly item core's "on item creation" tag and it works perfectly.

    The problem i'm having is that the shopkeepers can actually sell boosted item at the base item price, i would just like the vendor to sell the original not boosted item.
    Basically is there a way to "turn off" the on item creation effects when in a shop using a script line. because if not i will have to manually change all the notes of every item to include one more condition and that'll take a lonnnng time.
  13. Using Yanfly suite of plugins, but specifically Buffs and States Core

    Trying to make it so a critical hit has a chance to apply three different states when the user is affected by a particular state. Here is what I have in the state's notebox:

    Code:
    <Custom Establish Effect>
    var chance = Math.random();
    var chance2 = Math.random();
    var chance3 = Math.random();
    if (this.isPhysical() && target.result().hpDamage > 0 && target.result().critical) {
      if (target.isAlive() && chance <= 1.0) {
        target.addState(24);
        if (target.isAlive() && chance2 <= 1.0 {
            target.addState(25);
            if (target.isAlive() && chance3 <= 1.0) {
                target.addState(29);
            }
        }
      }
    }
    </Custom Establish Effect>

    Using 1.0 so it always returns true. Maybe I messed something up that I'm not seeing?


    Edit: Fixed it by doing the below.

    Code:
    <Custom Establish Effect>
    var chance = Math.random();
    var chance2 = Math.random();
    var chance3 = Math.random();
    if (this.isPhysical() && target.result().hpDamage > 0 && target.result().critical) {
      if (target.isAlive() && (chance <= 1.0)) {
        target.addState(24);
        if (target.isAlive() && (chance2 <= 1.0)) {
            target.addState(25);
            if (target.isAlive() && (chance3 <= 1.0)) {
                target.addState(29);
            }
        }
      }
    }
    </Custom Establish Effect>
  14. Phil32 said:
    I had a quick question on Yanfly's wonderful Quest Journal plugin. Do quests appear in the quest journal in the order you encounter and receive them, or in the order you list them manually in the plugin itself instead? I ask because if I decided late in my development to make a new quest early on in my game, it would be silly to have it listed as Quest 99 in the journal when it should be Quest 1 or 2, for instance.

    I'm looking to move to that quest system since the other doesn't seem to be supported anymore, so I don't want to encounter any more issues with it that I stumble around trying to figure out.

    I'm using it myself and you can definitely change the order, the one that matter is the plugin order but you can just copy your quest and paste them a bit below leaving space for the quest in question, althouth to be honest i completely removed quest id (just removed the nunber of the quest in the plugin so while it exist the player doesn't see it in game) in action the quest will appear in order once completed but if you are using the quest submenu it will only show the quest active in that subcategory.

    Edit : Fixed my problem by using a simple if($gameSwitches.value(x)==false){} where x is the switch that 1 activate when the show scene open, this if englobe the rest of the code.
  15. Hi guys,

    i need a bit of help for my damage formula !

    I would like to create something like :

    Inflict damage. Inflict damage on the initiale target if the spell is launch on another target.
    The damage are more important if the spell as been cast twice on the first target.

    i Got this for now :

    c = a._Target = a._Target || {}; if (c.last === b){ c.bonus = 0; c.counter++; } else { c.bonus = c.counter || 0; c.counter = 0; c.last = b; }; (a.atk*1.2 + (a.atk*1.2) * c.bonus) - b.def ;

    But the damage is done always on the same target, and i don't know how to/if it's possible to
    Damage on target A when you hit target B with that skill.

    I have yanfly plugins if someone have a better idea i'll be glad to take it !

    Thanks guys !
  16. Correct me if i'm wrong you want a skill that "tag" the first character attacked with it and when used on another ennemy the first also take damage? If that's the case i'm pretty sure you could use a state inflicted by the skill (the tag) and inside the status create a effect that when someone take damage from that skill all affected take damage, maybe i didn't understand it right though.
  17. Dicleon said:
    Correct me if i'm wrong you want a skill that "tag" the first character attacked with it and when used on another ennemy the first also take damage? If that's the case i'm pretty sure you could use a state inflicted by the skill (the tag) and inside the status create a effect that when someone take damage from that skill all affected take damage, maybe i didn't understand it right though.


    Yeah i can do something like that, but when you attack another character, the "tag" on the first one have to disapear, and if you hit twice in a row the first target, the tag need 2 counters on that state, so i'm not sure how to do that


    exemple : Hit target A = 100 damage. (Apply 1 counter)
    Hit target A again = 100 damage again. (Apply second counter)
    Hit target B = 100 damage ==> B (Apply 0 counter on B ) AND 200 damage ==> A (Remove the counter on A)
    Hit target B again = 100 damage again (Apply 1 counter on B ) BUT 0 damage ==> A (No more counter.)
  18. Diluiksapu said:
    Yeah i can do something like that, but when you attack another character, the "tag" on the first one have to disapear, and if you hit twice in a row the first target, the tag need 2 counters on that state, so i'm not sure how to do that


    exemple : Hit target A = 100 damage. (Apply 1 counter)
    Hit target A again = 100 damage again. (Apply second counter)
    Hit target B = 100 damage ==> B (Apply 0 counter on B ) AND 200 damage ==> A (Remove the counter on A)
    Hit target B again = 100 damage again (Apply 1 counter on B ) BUT 0 damage ==> A (No more counter.)

    It seems like quite the skill but maybe I can still help for state with counter I use the amazing
    http://stitchgaming.com/2016/04/nemv-state-resources/ (complitely compatible with yanfly) Oh I think I might see how to do your skill I will try a bit in the editor and will edit if i get it working!

    Edit 1: tried some stuff and the only issue is one I have had for a lonnng time myself, in rpg maker it's really difficult to trigger an effect on another character than the target or user, unless you use a secondary spell with target all that trigger the desired effect through a comon event (the common event would be inside the skill) but then the common event only let you select last attacked (it's hard to explain but it doesn't work how you would like to) or a specific ennemy (the first, second) which isn't what we want. Since i have tried that a lot i would say tweak the skills idea what I did with mine was that I made a bomb state that explode after 3 turns but the character also has an instant skill that target all ennemies and detonate the bomb all at once you could even make the bomb stacks to deal higher damage... At least that's how I tweaked it if you have another idea please do tell.
  19. Dicleon said:
    It seems like quite the skill but maybe I can still help for state with counter I use the amazing
    http://stitchgaming.com/2016/04/nemv-state-resources/ (complitely compatible with yanfly) Oh I think I might see how to do your skill I will try a bit in the editor and will edit if i get it working!


    Ok that could help me a lot, Thanks ! But my big problem is : i don't know how to activate the state only when i change target.
    If you found something i'll be glad to see it ! Because i try everything ! Thanks again !

    EDIT 1: Yeah, that's what I though.
    The bomb system looks good, i'll maybe do something like that.
    Thanks again !

    EDIT 2 : I did something else, when you hit target, the skill give you 1 counter, and after 3 counter, the skill damage 2 enemies for a big amount of damage !

    <Custom Confirm Effect>
    if (this.isSkill(473) && target.isActor() !== user.isActor()) {
    user.addStateCounter(stateId, 1);
    user.clampStateCounter(stateId, 0, 3);
    if (user.getStateCounter(stateId) >= 3) {
    user.removeStateCounter(stateId);
    var elementId = 1;
    var damage = user.atk * 2.6 - target.def;
    if (target.result().critical) {
    damage = this.applyCritical(damage);
    }
    var members = this.opponentsUnit().aliveMembers();
    target.startAnimation(130);
    var extraTargets = 1;
    while (extraTargets--) {
    var member = members[Math.floor(Math.random() * members.length)];
    if (member) {
    member.startAnimation(130);
    member.gainHp(-Math.ceil(damage * member.elementRate(elementId)));
    member.startDamagePopup();
    member.clearResult();
    members.splice(members.indexOf(member), 1);
    if (member.isDead()) {
    member.performCollapse();
    }
    }
    }
    }
    }
    </Custom Confirm Effect>

    If anyone need something like this ! (put in state and add <Equip State: x> from yanfly auto passives states.)
    Regards !
  20. Diluiksapu said:
    Ok that could help me a lot, Thanks ! But my big problem is : i don't know how to activate the state only when i change target.
    If you found something i'll be glad to see it ! Because i try everything ! Thanks again !

    EDIT 1: Yeah, that's what I though.
    The bomb system looks good, i'll maybe do something like that.
    Thanks again !

    EDIT 2 : I did something else, when you hit target, the skill give you 1 counter, and after 3 counter, the skill damage 2 enemies for a big amount of damage !

    <Custom Confirm Effect>
    if (this.isSkill(473) && target.isActor() !== user.isActor()) {
    user.addStateCounter(stateId, 1);
    user.clampStateCounter(stateId, 0, 3);
    if (user.getStateCounter(stateId) >= 3) {
    user.removeStateCounter(stateId);
    var elementId = 1;
    var damage = user.atk * 2.6 - target.def;
    if (target.result().critical) {
    damage = this.applyCritical(damage);
    }
    var members = this.opponentsUnit().aliveMembers();
    target.startAnimation(130);
    var extraTargets = 1;
    while (extraTargets--) {
    var member = members[Math.floor(Math.random() * members.length)];
    if (member) {
    member.startAnimation(130);
    member.gainHp(-Math.ceil(damage * member.elementRate(elementId)));
    member.startDamagePopup();
    member.clearResult();
    members.splice(members.indexOf(member), 1);
    if (member.isDead()) {
    member.performCollapse();
    }
    }
    }
    }
    }
    </Custom Confirm Effect>

    If anyone need something like this ! (put in state and add <Equip State: x> from yanfly auto passives states.)
    Regards !

    Very nice i could see myself do something in that way!