The official VisuStella notetag help thread

● ARCHIVED · READ-ONLY
Started by Trihan 1458 posts Page 56 of 73 View original ↗
  1. AndreaMZ said:
    I am trying to have a skill(Shield Bash) that is only enabled/useable if the actor with the skill has a Shield equipped. I checked the script call list and what I came up with is:
    I'm not sure what you looked at there, but that's the wrong script call in several ways.

    1 - It's only checking actor ID 10, when you want it to check the actor who is looking at the skill in their list.

    2 - It's only checking if that actor has armor ID 6 equipped, not just "a shield".

    As the documentation for that notetag says,
    1714099930088.png

    And checking for something to be equipped in a slot references the equips() array. Exactly what you do depends on how you've set up your equipment slots; but, referencing the default list:
    1714100069162.png

    and we subtract one because lists in JavaScript start from index 0. So seeing if there's anything in the shield slot is
    Code:
    enabled = user.equips()[1];

    AndreaMZ said:
    On a related side note, where do yall classify Shields? as a weapon or armor?
    That's entirely up to you. In the actual world, the primary purpose of shields was not to try to hit people, but to defend yourself. Thus, they are categorized as a piece of armor.

    You do whatever you feel like, but if you're going to say they're weapons you might consider using a different word than "shield" so you don't confuse players.

    AndreaMZ said:
    and does a Shield slot need to be in both Armor and Equipment on the 'Types' section of the database?
    Only one of those things (Equipment Types) has anything to do with slots.

    The words in Armor Types determine whether or not an actor can equip that specific item according to their Traits.

    Everyone has all slots.
  2. Question: does having tons of <JS></JS> in the notes, as in a list, each doing one separate check affects performance?

    I find it easier to organize it like this cuz I also tend to ruin things when I add a lot of conditionals/checks into one huge string. Just something I'm curious about.
  3. ATT_Turan said:
    I'm not sure what you looked at there, but that's the wrong script call in several ways.

    1 - It's only checking actor ID 10, when you want it to check the actor who is looking at the skill in their list.

    2 - It's only checking if that actor has armor ID 6 equipped, not just "a shield".

    As the documentation for that notetag says,
    View attachment 303117
    I googled RPG Maker MZ Script calls and used the following



    Under the Actor tab down to "is item equipped". Thank you for explaining it. I will give this a try when I am home this evening from work.

    Any chance you can help with my other post regarding a conditional Crit rating based on a passive state being active? Its about 3-4 posts ago I believe.

    Again, Many thanks for the help =)
  4. AndreaMZ said:
    Under the Actor tab down to "is item equipped".
    Right - as I said in my first reply, that's checking if a specific item is equipped. You don't want that, you want to know if anything is in the shield slot.

    AndreaMZ said:
    Any chance you can help with my other post regarding a conditional Crit rating
    AndreaMZ said:
    Code:
    <JS Critical Rate>
     rate = if (a.states().includes($dataStates[222])) {
    700} else {0}
    </JS Critical Rate>
    There are two things wrong with that.

    For one thing, a rate of 700 doesn't mean anything. A rate is a percentage, so 1 means guaranteed to happen and 0 means it will never happen. I'm not sure what 700 is supposed to mean, but if it's 70%, that would be .7.

    For another thing, your JavaScript syntax is wrong - that's why the code is erroring out and the notetag isn't doing anything.

    A conditional statement does not produce a value, you can't put it on the right-hand side of an operator. You would do either this:
    Code:
    if (a.states().includes($dataStates[222]))
        rate = .7;
    else
        rate = 0;

    Or you could use a ternary operator, which does produce a value.
    Code:
    rate = a.states().includes($dataStates[222]) ? .7 : 0;
  5. ATT_Turan said:
    and we subtract one because lists in JavaScript start from index 0. So seeing if there's anything in the shield slot is
    enabled = user.equips()[1];
    Just got home to give this a run and it is not working for me. Attempting to attach screen snips of what I am working with. Never done that before
    Screen Snips
    1714175333002.png


    1714175385760.png
    1714175445567.png

    1714175484634.png
    1714175529973.png
  6. AndreaMZ said:
    Just got home to give this a run and it is not working for me
    did you save your project before changing the note tag and running that test?
  7. Robro33 said:
    did you save your project before changing the note tag and running that test?
    I did, but I was not using playtest, I was using Battle Test. It works properly when using Playtest, New Game. Just not in Battle Test.

    Thanks all.
  8. AndreaMZ said:
    I did, but I was not using playtest, I was using Battle Test. It works properly when using Playtest, New Game. Just not in Battle Test.
    Once you start adding plugins, Battle Test is not reliable. You should get into the habit of always using the full play test to check things.

    Good luck with your project.
  9. Hello,
    I've been searching for a few hours and I can't get an (VS) Action Sequence to work.
    The very short version is that I'm looking for a way to make a conditional statement to call if an attack hits or not. Here is an example of what I have now...

    Context; this is a basic attack that plays an animation if it hits, doesn't if it misses.
    1714344370294.png

    Almost every solution I have found either doesn't work for my project, the thread fades with time, or the solution (or workaround) is kept private.
    I have attempted many different script calls for the If statement including;
    > BattleManager._target.result().missed && target.result().evaded
    > if !target.result().missed && !target.result().evaded
    > if target.result().missed && target.result().evaded
    > !BattleManager._targets[0].result().missed && !BattleManager._targets[0].result().evaded
    > BattleManager._action.subject().opponentsUnit().members()[BattleManager._action._targetIndex]

    But nothing seems to work. Everything else in the action sequence works perfectly. I'm not sure if I have the wrong script for the condition, or if my ordering is wrong? Any help would be greatly appreciated!
  10. Leaferson Kenraise said:
    > BattleManager._target.result().missed && target.result().evaded
    This won't work because there's no such property as BattleManager._target and see below for the second half:

    Leaferson Kenraise said:
    > if !target.result().missed && !target.result().evaded
    > if target.result().missed && target.result().evaded
    These won't work - my understanding is VS action sequences do not provide a global target variable. I thought they provided a $target variable, but that might be incorrect.

    Leaferson Kenraise said:
    > !BattleManager._targets[0].result().missed && !BattleManager._targets[0].result().evaded
    This ought to work, if it's asking what you want. The ! is NOT, so this is saying if the action did not miss and was not evaded - e.g. it hit.

    Leaferson Kenraise said:
    > BattleManager._action.subject().opponentsUnit().members()[BattleManager._action._targetIndex]
    This...is a very convoluted partial thing :oops:

    All that it's doing is producing the battler, it's not actually checking anything to do with the action hitting or not. And it's going a really roundabout way instead of just BattleManager._targets[0]

    I think that one bit of code that I mentioned above should be working correctly. But if not, it wouldn't be hard to use a variable; at the beginning of the action sequence, record the target's HP. Then check after action effect whether their current HP matches the stored value or not.

    That should work fine, unless there's some condition where the action would hit for 0 damage and you still want your other stuff to resolve.
  11. EDIT: I have it solved without the HP trick!

    There is a setting in VS Battle Core that turns a switch ON when you miss under Mechanics Settings. I set this to 14 and named it MISS.
    1714352948009.png
    Screenshot provided by Visustella's site
    After altering this setting, I went to change the Action Sequence to a Switch condition.
    1714353059621.png

    Worked like a charm!

    --------- EDIT DONE ---------

    Thank you very much for the information, I really appreciate the explanations!

    ATT_Turan said:
    This ought to work, if it's asking what you want. The ! is NOT, so this is saying if the action did not miss and was not evaded - e.g. it hit.
    I'm not sure as to why this is not working myself, I've now tried both with and without the ! just in case, but it seems to always register as a hit, even when I get the dodge animation and the damage popup stating it's a miss- yet I still get the animation (I also added a ding sound effect for testing purposes to let me know the branch says it's a "miss")

    Recording the HP is actually a brilliant work around, I hadn't thought of that. This might actually work with my damage formula since I've made my formula always guarantee at least 1 damage.

    Thank you so much for your assistance!
  12. Please excuse me if this is not the correct place, but I am looking to see if I am missing something with regards to VisuStella Character Creation System.

    I want to have it so that when you pick you Class, it flips a switch
    I want to also have it happen that way with Race
    This way, the pictures available are limited to that of the Race and Class combo so as not to have the face/body of a Dark Elf but you picked Dwarf, for example

    Is that in there already and I am missing it?
  13. Looking at the video and documentation, you choose the portrait at the same time as class, which is before race. So you can't make the former dependent on the latter two.

    There's the Graphic Set Entry that can be chosen later, but looking at the plugin parameters those don't appear to have any conditions that can be used.

    It looks like to do what you want, you'd have to combine it all in the initial choice, e.g. Orc Fighter, Dwarf Fighter, etc.
  14. I may have to have a "Dwarf Representative" to trigger the Dwarf switch.
    Not ideal, but pretty simple. I appreciate your quick response and help.
  15. Hello again,

    I am working on a skill called Whirlwind, basically I want it do deal damage when used consecutively up to 3 times then it'll reset. I am using a short duration on the state to determine if it is consecutive or not. My problem is that the first attack of whirlwind is at 0. I am pretty sure it is because the counter is not yet identified as anything. I would like to see if anyone can help me in getting it identified at the start of the turn or something so that the first use of whirlwind will do minimum damage then increase with two more uses before resetting.

    Damage formula is:

    (1000 * a._whirlwind) + 100

    For the skill I tried the Post start action in hopes of identifying the counter:


    <JS Post-Start Action>
    (user._whirlwind || 1);
    </JS Post-Start Action>

    <JS Post-End Action>
    user.addState(279)
    if (user._whirlwind > 3) {
    user.removeState(279)}
    </JS Post-End Action>

    For the state, applied to self, it is:

    <JS On Add State>
    origin._whirlwind ??= 0;
    origin._whirlwind++;
    </JS On Add State>

    <JS On Erase State>
    delete user._whirlwind;
    </JS On Erase State>

    <JS Pre-Damage As User>
    user._whirlwind ??= 0;
    const stacks = Math.min(3, user._whirlwind);
    $gameTemp.requestAnimation([target], 39);
    user.setStateDisplay(279, (stacks))
    </JS Pre-Damage As User>

    Sorry for the poor JS in advance
  16. AndreaMZ said:
    Sorry for the poor JS in advance
    dw, we all start somewhere



    going down the list
    AndreaMZ said:
    <JS Post-Start Action>
    (user._whirlwind || 1);
    </JS Post-Start Action>
    this doesnt do anything. if you wanted the skill to set whirlwind to 1 if it doesnt exist to make sure it has a value, you need to assign it
    Code:
    user._whirlwind = user._whirlwind || 1;

    AndreaMZ said:
    <JS On Add State>
    origin._whirlwind ??= 0;
    origin._whirlwind++;
    </JS On Add State>
    theres no need for the first line there if using the skill is the only way to get the state, as the skill would already set it to 1 (if corrected) before the state would be applied. And if it isnt the only way to get the state, then id recommend adding the state within the post-start and having the state be responsible for initializing and incrementing whirlwind instead.

    AndreaMZ said:
    <JS Pre-Damage As User>
    user._whirlwind ??= 0;
    const stacks = Math.min(3, user._whirlwind);
    $gameTemp.requestAnimation([target], 39);
    user.setStateDisplay(279, (stacks))
    </JS Pre-Damage As User>
    same as above for setting whirlwind. you cant get to that point without it already having a value since the only way you could have gotten it would have set it, but also:
    if the only skill that gives the state deletes the state at the end if whirlwind is above 3, then then you dont need to cap it to 3 with Math.min() as it would never be able to go above it.
    id move the set state display to the application since thats the only time whirlwind changes.
    calling the animation that way would cause any action play it (atleast i think. i dont use VS). if the whirlwind skill was only used once, then attack was used next, that animation would be played during attack. any reason its not the skill's animation?

    im assuming "minimum damage" is 1100 and not 100, since you (tried to?) set whirlwind at 1 at the start of the skill. try these
    Code:
    for the skill
    <JS Post-Start Action>
    user.addState(279);
    </JS Post-Start Action>
    
    <JS Post-End Action>
    if (user._whirlwind >= 3)
      user.removeState(279);
    </JS Post-End Action>
    
    For the state
    
    <JS On Add State>
    user._whirlwind = (user._whirlwind + 1) || 1;
    user.setStateDisplay(279, user._whirlwind)
    </JS On Add State>
    
    <JS On Erase State>
    delete user._whirlwind;
    </JS On Erase State>
  17. Robro33 said:
    dw, we all start somewhere


    going down the list
    Magnifico!!, thank you so much. It is working perfectly! And I learned a few things that I can apply to some previously completed classes that have messy code lol.

    I'll be back, pretty sure I will need help with weapon checking my dual wield Blademaster. Going to try my ideas first. Thanks again!
  18. Forgive me if this is already posted somewhere, I searched for recoil or self damage but didn't come up with any suitable answers. I want a skill to deal % mHP damage to the user after damage dealt. I have most of the Visustella plugins.

    EDIT: So I put <JS Pre-End Action> and I managed to get the recoil damage working. Using <JS Post-Damage> or <JS Post-Apply> seems to apply the recoil every hit (my skill hits 5 times). Pre-End Action applies just the once but doesn't display a damage number while the other two do display a damage number but apply the damage for every hit. Is there JS for displaying damage number or is there a way to only apply recoil once?
  19. Emperor3D said:
    Forgive me if this is already posted somewhere, I searched for recoil or self damage but didn't come up with any suitable answers. I want a skill to deal % mHP damage to the user after damage dealt. I have most of the Visustella plugins.

    i dont know if mz changed the damage popup function to be in line with the animation one not being called from the battler like in mv, but this is the idea

    Code:
    <JS Post-Damage>
    user.gainHp(-Math.ceil(user.mhp*.3));
    user.startDamagePopup();
    </JS Post-Damage>
  20. Robro33 said:
    i dont know if mz changed the damage popup function to be in line with the animation one not being called from the battler line in mv, but this is the idea

    Code:
    <JS Post-Damage>
    user.gainHp(-Math.ceil(user.mhp*.3));
    user.startDamagePopup();
    </JS Post-Damage>
    Thank you, this was what I needed. :)