I cannot get this script to work, what's wrong with it?

Title how am I supposed to apply it?

JavaScript:
// Replace "Game_Actor" with the class name of your actors
Game_Actor.prototype.makeAttackDamageValue = function(item, target) {
    var baseDamage = this.attackDamageRoll(item);
    var magicAttack = this.mdf;
    var attack = this.atk + magicAttack;
    var defense = target.def;
    var damage = Math.max(baseDamage + attack - defense, 0);
    return damage;
};
Your question can't really be answered as presented - what's the context? What are you trying to do?

You're not replacing/editing an existing function in MZ's engine, so what's the purpose of this brand new function? Where are you calling it?

Why is it a method of Game_Actor and not Game_Action?

Where's the attackDamageRoll function that it references?

What do you expect it to do, and what is it doing instead?

There's not anything blatantly wrong with your code, except for a lot of unnecessary variables (your function could be, like, one line).

Traditionally magic attack would be represented by mat, not mdf, but I dunno if you're using the parameters differently.
Your question can't really be answered as presented - what's the context? What are you trying to do?

You're not replacing/editing an existing function in MZ's engine, so what's the purpose of this brand new function? Where are you calling it?

Why is it a method of Game_Actor and not Game_Action?

Where's the attackDamageRoll function that it references?

What do you expect it to do, and what is it doing instead?

There's not anything blatantly wrong with your code, except for a lot of unnecessary variables (your function could be, like, one line).

Traditionally magic attack would be represented by mat, not mdf, but I dunno if you're using the parameters differently.
I was trying to generate a passive state that would give the holder a bonus on his physical attack equal to its mat, and I since I had no clue I wondered if the AI could help write the code. It obviously failed miserably lol
I was trying to generate a passive state that would give the holder a bonus on his physical attack equal to its mat, and I since I had no clue I wondered if the AI could help write the code. It obviously failed miserably lol
Ordinarily I would try to help you puzzle this out, but I'm seeing this happening a lot now and I'm putting my foot down on no longer putting in any effort to help it along. Don't use AI to generate code if you're incapable of fixing what comes out; all you're doing is creating something you know won't work and putting the onus on us to make it do something useful. I'm not a fan of that.
Agreed - I don't know where this mini-fad of AI-generated code came from, but I've seen maybe a half a dozen postings of it here and zero of them had usable code.

It's like using AI art in your game if you can't tell whether the resulting picture is of a guy's face or a piano 😛

I was trying to generate a passive state that would give the holder a bonus on his physical attack equal to its mat
I understand you're not a coder, and that's fine, but it's not like you've done zero things - you've gotten plenty of other notetags with code in them for you to reference, and you have Yanfly's Tips to look at and all.

Using VS Battle Core, give the state the notetag
Code:
<JS Pre-Damage As User>
if (this.isDamage() && this.isPhysical())
    value+=user.mat;
</JS Pre-Damage As User>

Good luck with your project.
I don't know where this mini-fad of AI-generated code came from
I think it's because AI claims to understand Javascript and in fact, when I asked if it could understand the language of RPG Maker MZ, it actually said "Yes, even better if you give me the version!" so I guess I got a little carried away.

As your message showed, it was much simpler. I take it the AI doesn't understand Notetags LOL

Thank you, project is coming along slowly but nicely, and while I'm grateful I don't have to do EVERYTHING from scratch, it's still hard. even more so taking into account the non-gaming life.
I think it's because AI claims to understand Javascript and in fact, when I asked if it could understand the language of RPG Maker MZ, it actually said "Yes, even better if you give me the version!" so I guess I got a little carried away.

As your message showed, it was much simpler. I take it the AI doesn't understand Notetags LOL

Thank you, project is coming along slowly but nicely, and while I'm grateful I don't have to do EVERYTHING from scratch, it's still hard. even more so taking into account the non-gaming life.
The thing is, when you do this you're not really using AI. You don't really understand what it's giving you, so you're just kind of throwing it at us and asking us to fix it. And to do that, we'd have been as well just writing it for you in the first place, so it somewhat makes the role the AI played in proceedings redundant.
I just wanted to hop on the AI bandwagon to see if it's all it's cracked up to be - so far, mostly unimpressed with the idea it can completely substitute people.
I just wanted to hop on the AI bandwagon to see if it's all it's cracked up to be - so far, mostly unimpressed with the idea it can completely substitute people.
Then why weren't you up front about that in the original post? 😛
Then why weren't you up front about that in the original post? 😛
No one asked 😮
on a different note @ATT_Turan , I DID get emails for this topic, like, 12 hours later

Original thread: https://forums.rpgmakerweb.com/threads/i-cannot-get-this-script-to-work-whats-wrong-with-it.154395/