The official VisuStella notetag help thread

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
4,930
Reaction score
3,131
First Language
English
Primarily Uses
RMMV
Since i read, i can add passive states conditions.
I don't know what that has to do with the situation. This has nothing to do with turning a passive state on and off, unless you put this mark as a passive state on every single enemy in your game and code it as a damage reaction, which is probably the least efficient thing you could do.
Okay i see now what the problem is. You assume it from the MV base behavior, not MZ. They may be similar, but not at all. To confirm it, i tried your "Damage Formula" code in MV and in MZ, indeed as i guess, in MV your code works quite well, but in MZ It not work at any way.
I don't know why you think that I don't know what engine this thread is for - all of those functions are from MZ's code. I just made an MZ project, put that into the damage formula of my attack skill, and it works perfectly. If it doesn't work for you, you have copied it incorrectly or you have some other plugins or changes that are modifying the skill's behavior.

Again, I encourage you to start a new thread, because (as I said before) you need to post screenshots of your skills and states. All of this works just fine for me, so something is wrong on your end.

Either way, I'm done. Good luck with your game.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
5,035
Reaction score
4,644
First Language
English
Primarily Uses
RMMZ
@Choraß, I don't have an issue with you continuing to ask for support in here if you provide screenshots of your states/skills as ATT_Turan requested, but I strongly suggest you trust that the people helping you know what they're doing with the engine rather than assuming it isn't working because *they* aren't understanding it.
 

Choraß

Indie Dev
Veteran
Joined
Apr 13, 2015
Messages
93
Reaction score
31
First Language
German
Primarily Uses
RMMZ
I don't know what that has to do with the situation. This has nothing to do with turning a passive state on and off, unless you put this mark as a passive state on every single enemy in your game and code it as a damage reaction, which is probably the least efficient thing you could do.
Well since the idea was of a condition is based on a active passive. If Actor 01 is stated with state ID.032 - Magic Hand. That give this actor a attack state (mark) ID.033 - Magic Mark which apply it to the enemy, if was hit by the normal attack.

This magic mark state should be removed after any damage. ( Default option: which do in MV but not in MZ.)

So i thought, if it not work by default way to remove it, try a passive state condition.
I don't know why you think that I don't know what engine this thread is for - all of those functions are from MZ's code.
That i never said or think. Since you link me a MV thread of Damage Formula and i was test it in mv and mz, which confirm me, it work in mv but not in mz. I just mentioned, it may be a different behavior what not work in mz, since it's original from MV base and just emphasized I use the mz.

I just made an MZ project, put that into the damage formula of my attack skill, and it works perfectly. If it doesn't work for you, you have copied it incorrectly or you have some other plugins or changes that are modifying the skill's behavior.
So again, i tried again a brand new mz and mv project for testing. Same outcome.

The copied code from you, for the default attack skill i use:
JavaScript:
if (a.states().includes($dataStates[32])) {b.isStateAffected(33) ? b.removeState(33) : b.addState(33)}; a.atk * 4 - b.def * 2

I just made an MZ project, put that into the damage formula of my attack skill, and it works perfectly.
That's really weird, at my side not at all.


you have copied it incorrectly
you have some other plugins
or changes that are modifying the skill's behavior.
All of this works just fine for me, so something is wrong on your end.

Unfortunately it don't help me if you look the error continuing just on my side. As mentioned before 3x times was testing it on a fresh brand new project, with my outcome. Without testing to be sure, if it on me, i wouldn't say that.

Of course there may be something that i haven't noticed yet. (no one can be 100% sure or right.) But your mentioned examples of error cases are actually incorrect, since it was tested on a new project.

Again, I encourage you to start a new thread, because (as I said before) you need to post screenshots of your skills and states.
Seems so, ^^ thought it were a simple thing to achieve it via notetags. Didn't wanted to discuss it that extensively. :eswt:

Either way, I'm done. Good luck with your game.
Alright, anyway again thanks for trying to help, it much appreciated.


Edit:
@Choraß, I don't have an issue with you continuing to ask for support in here if you provide screenshots of your states/skills as ATT_Turan requested
Thanks, good to know. Hm it was more a test around of a passive for now. Not really into on the battle system yet. (No priority)

I strongly suggest you trust that the people helping you know what they're doing with the engine rather than assuming it isn't working because *they* aren't understanding it.
It's not about trust or not trust. Just can react and try to explain it, based at my outcome. I also not assuming that "it isn't working because *they* aren't understanding it." Again, just can react and explain at my outcome. It have nothing to do about any personal aspects, because it's out of place here.
 
Last edited:

Choraß

Indie Dev
Veteran
Joined
Apr 13, 2015
Messages
93
Reaction score
31
First Language
German
Primarily Uses
RMMZ
Hi @NaosoX, yeah i do but couldn't make it to work, what i trying to achieve. That's why i come here to ask for aid.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
5,035
Reaction score
4,644
First Language
English
Primarily Uses
RMMZ
Hi @NaosoX, yeah i do but couldn't make it to work, what i trying to achieve. That's why i come here to ask for aid.
Seriously, post the screenshots. I don't think we can help you further without seeing exactly how you've implemented this.
 

Choraß

Indie Dev
Veteran
Joined
Apr 13, 2015
Messages
93
Reaction score
31
First Language
German
Primarily Uses
RMMZ
Seriously, post the screenshots. I don't think we can help you further without seeing exactly how you've implemented this.
2.
That's actually a mark passive, if the wielder of this passive attack (normal attack) a enemy that will add a second (mark) state to him, which reduce his magic defense. The mark remains until the enemy get any damage, after it was applied.

JavaScript:
if (a.states().includes($dataStates[32])) {b.isStateAffected(33) ? b.removeState(33) : b.addState(33)}; a.atk * 4 - b.def * 2
Snip-P1.PNGSnip-P2.PNGSnip-P3.PNGSnip-P4.PNG

Also tried different several setups. Like: without damage formula code, without default "remove by damage", or without default add "attack state".

Since the default "remove by damage" didn't work for me, i was hope get to work by a notetag condition. And yes, if a second actor without that passive attacks the enemy with the mark, it will be removed by damage. But not by the actor with the passive, because it just apply it again after damage. In MV it works, mark will be removed at the same setup.

Like the order is:

Option: Remove by Damage.
VX Ace & MV: Add state - Damage - finish.
MZ: Damage - Add state - finish.
 
Last edited:

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
5,035
Reaction score
4,644
First Language
English
Primarily Uses
RMMZ
Skills can't add passive states. You need to set them up on an actor, class, enemy or in the global parameters. That's the whole point of them being passive; they're always on.
 

Choraß

Indie Dev
Veteran
Joined
Apr 13, 2015
Messages
93
Reaction score
31
First Language
German
Primarily Uses
RMMZ
Skills can't add passive states. You need to set them up on an actor, class, enemy or in the global parameters. That's the whole point of them being passive; they're always on.
I know it of course. Please read the note at the notetag of the second pic. Just test it on a new project without any extra plugins. The skill to add this state is just for simulate purpose.

The question or topic was: How i remove the state (mark) again after enemy get any damage, even with that active "attack state". Because in vx ace and mv it works on same setup. The state will be removed and not applied again, if it already there. Which i could simply achieve by the default "remove by damage" option.
 
Last edited:

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
5,035
Reaction score
4,644
First Language
English
Primarily Uses
RMMZ
Aha. There actually is a very subtle change between MV and MZ that I didn't catch when I was documenting the modifications to the core code:

MV:

JavaScript:
Game_Battler.prototype.isStateAddable = function(stateId) {
    return (this.isAlive() && $dataStates[stateId] &&
            !this.isStateResist(stateId) &&
            !this._result.isStateRemoved(stateId) &&
            !this.isStateRestrict(stateId));
};

MZ:

JavaScript:
Game_Battler.prototype.isStateAddable = function(stateId) {
    return (
        this.isAlive() &&
        $dataStates[stateId] &&
        !this.isStateResist(stateId) &&
        !this.isStateRestrict(stateId)
    );
};

It no longer checks for !this._result.isStateRemoved. Because this is part of the MV code, it won't re-add a state that's already being removed during the attack that adds it. With it not being there in MZ, it removes the state and then immediately reapplies it.

This means using the damage formula to remove the state won't work either, because states are applied after damage is, and although the code you were using does work, because of the lack of that restriction the code just adds the state again right after you remove it. You'll need to use a <JS Post-Damage As Target> notetag for this, probably.
 

Choraß

Indie Dev
Veteran
Joined
Apr 13, 2015
Messages
93
Reaction score
31
First Language
German
Primarily Uses
RMMZ
Aha. There actually is a very subtle change between MV and MZ
This means using the damage formula to remove the state won't work either, because states are applied after damage is
Thanks for take a closer look, to confirm my guess and my testing results, than just say i'm wrong or something is wrong on my side. Then i don't understand why at @ATT_Turan side it was working.

This already helps me, even if it just clarification.
Because i was re-check a lot and testing with new and new projects actually 6x times now. To find anything what is wrong or different.

Do you have a solution for this, how i remove it, as in vx ace and mv before? This state should really not applied again, if it already is, during the "add attack state" effect.
 
Last edited:

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
5,035
Reaction score
4,644
First Language
English
Primarily Uses
RMMZ
It's a tricky one. Any logic I can come up with that would remove the state on taking damage will apply to the end of the turn it's inflicted just as readily as the turn after. I'll have a think.
 

Choraß

Indie Dev
Veteran
Joined
Apr 13, 2015
Messages
93
Reaction score
31
First Language
German
Primarily Uses
RMMZ
I'm sorry if i kinda spam this thread, really didn't wanted to discuss it that extensively. :eswt:

It's a tricky one. Any logic I can come up with that would remove the state on taking damage
I'll have a think.
Uh damn, don't want cause you any headache, if it complicated. it really don't have a priority for now, it was more besides "Let's check if my custom states works same on mz"

Anyway i'm glad, i have clarification now about it.
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
5,035
Reaction score
4,644
First Language
English
Primarily Uses
RMMZ
I have an idea that might work, I'll need to test it after dinner.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
4,930
Reaction score
3,131
First Language
English
Primarily Uses
RMMV
This means using the damage formula to remove the state won't work either, because states are applied after damage is, and although the code you were using does work, because of the lack of that restriction the code just adds the state again right after you remove it.
Edit: I see what you're talking about, it's the interaction with the state having the remove from damage tag. My understanding from what Choraß said way back was the the mark should only be removed when the actor with the passive hit them again - so just remove the checkmark on remove from damage and it works completely as expected.
 
Last edited:

Austrian

Veteran
Veteran
Joined
Jan 17, 2016
Messages
46
Reaction score
22
First Language
English
Primarily Uses
RMMZ
Yeah, I've tried this many times over in many different ways. No matter what, whenever the enemy or player misses an attack, the game registers it as both a hit and miss. Since I also use Visustella's weakness pop-up plugin you can see the resist popup appear along with the damage. I also posted the skill tab and copied and paste my code in the notes. Perhaps I am missing something?

missed attack.jpgskill tab.jpg

Code:
<All AI Conditions>
Target Not State 21
</All AI Conditions>

<JS Pre-Damage>
//Get user damage
let str = Math.floor((user.atk - 10)/2);
let dmg = Math.floor((Math.random() * 4) + 1) + 2;
dmg += str;
$gameVariables.setValue(126, dmg);

//Roll the dices & add strMod
let die = Math.floor((Math.random() * 20) + 1);
die += str;

//Set the hitDie
$gameVariables.setValue(122, die);

//if attack miss
if(target.mp > $gameVariables.value(122)){
target.result().missed = true;
} else {
value = $gameVariables.value(126);
}
</JS Pre-Damage>
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
4,930
Reaction score
3,131
First Language
English
Primarily Uses
RMMV
You have the Hit Type set to Certain Hit - it can't miss.
 

Austrian

Veteran
Veteran
Joined
Jan 17, 2016
Messages
46
Reaction score
22
First Language
English
Primarily Uses
RMMZ
Yeah, I know, but I get the same outcome even if I set it to physical attacks. I am trying to let a random variable determine if the hit is successful or not. If I set the class or enemy traits hit chance to 0 attacks always miss, if I set it to 100% or a certain hit, I get this issue.

However, I tried testing this without battle core and a new game and just set up my hit chance variable to occur at the beginning of each turn and everything works fine even if I set the type to certain hit. If the variable number is lower than the target's mp, it'll miss the target with the target taking no dmg.

Trihan suggested using the <JS Pre-Damage> tag but I still get the same result.
 

Choraß

Indie Dev
Veteran
Joined
Apr 13, 2015
Messages
93
Reaction score
31
First Language
German
Primarily Uses
RMMZ
Edit: I see what you're talking about, it's the interaction with the state having the remove from damage tag.
Yeah that was the important clue, that MV and MZ are different there. This clarification helps me already.

My understanding from what Choraß said way back was the the mark should only be removed when the actor with the passive hit them again
Like the order is:

Option: Remove by Damage.
VX Ace & MV: Add state - Damage - finish.
MZ: Damage - Add state - finish.
That's the point, since the "remove by damage" work different and unexpected in MZ, which i kinda figure out before by testing and @Trihan confirmed it by a closer code investigation.

So i was looking for a workaround ( The idea was to make the state (mark) recognizes, if a enemey already is affected of that mark, if yes then to remove it, by any damage and not to apply again. ) So i see the misunderstanding there.

so just remove the checkmark on remove from damage and it works completely as expected.
It does, but the different "remove by damage" behavior matters. It should also removed by any damage outcome, for game balance purpose.


MV:

JavaScript:
Game_Battler.prototype.isStateAddable = function(stateId) {
return (this.isAlive() && $dataStates[stateId] &&
!this.isStateResist(stateId) &&
!this._result.isStateRemoved(stateId) &&
!this.isStateRestrict(stateId));
};
I just copied the snippet code into a plugin and use it. It works fine for me now, as expected from MV behavior. So really thanks again @Trihan for take a closer look into it. So i don't know if it a bug, i guess it's more a design decision ? :LZSskeptic:

Anyway that snippet code helps and solved this problem to me.
I hope i wasn't that offtopic here.
 
Last edited:

YoItsChris

Warper
Member
Joined
Mar 21, 2018
Messages
3
Reaction score
0
First Language
Norwegian
Primarily Uses
RMMV
Hello, I have been trying to implement the giant slayer from the yep tips and tricks, but to no avail. Does anyone know how to?
Here's the original code:
JavaScript:
<Damage Formula>
// This is the damage formula used for the skill.
value = a.atk * 2;
// Get the HP difference between the target and attacker.
var difference = b.hp - a.hp;
// Check if the HP difference is greater than 0.
if (difference > 0) {
  // Get the value per 50 HP difference and round down.
  difference = Math.floor(difference / 50);
  // Add 10% bonus rate per difference.
  var rate = 1.00 + 0.10 * difference;
  // Set a maximum bonus rate of 150%.
  rate = Math.min(1.50, rate);
  // Apply the bonus rate to the calculated base damage.
  value *= rate;
}
</Damage Formula>
 

Latest Threads

Forum statistics

Threads
124,349
Messages
1,162,938
Members
163,146
Latest member
harish-m98
Top