[SOLVED] Yanfly Blue Magic to MZ

Status
Not open for further replies.

miyanke

Veteran
Veteran
Joined
Dec 2, 2015
Messages
73
Reaction score
12
First Language
Spanish
Primarily Uses
RMMZ
Hello everyone,
I'm looking for a Blue Magic and old Yanfly "module" was perfect for my idea.

I have tried it using the Battle Core VisuStella MZ but it doesn't work:
Code:
<JS Post-Damage>
if (target.isActor() && target._classId === 5) {
  if (!target.isLearnedSkill(item.id)) {
    target.learnSkill(item.id);
    var text = target.name() + ' ha aprendido '
    text = text + item.name + '!';
    $gameMessage.add(text);
  }
}</JS Post-Damage>

I've checked and the "script calls" are correct, so what's wrong? Any idea?
 

Maliki79

Veteran
Veteran
Joined
Mar 13, 2012
Messages
811
Reaction score
353
First Language
English
Primarily Uses
N/A
I don't see item defined.
As a test, try changing item.id to a skills ID number directly and see if that works.
 

miyanke

Veteran
Veteran
Joined
Dec 2, 2015
Messages
73
Reaction score
12
First Language
Spanish
Primarily Uses
RMMZ
I don't see item defined.
As a test, try changing item.id to a skills ID number directly and see if that works.
Hi Maliki,
I think item.id is refered to the skill itself, but it has sense to write it down as it is, so i changed it to this, but it still not working:
<JS Post-Damage>
if (target.isActor() && target._classId === 5) {

if (!target.isLearnedSkill(22)) {

target.learnSkill(22);

var text = target.name() + ' ha aprendido '

text = text + item.name + '!';

$gameMessage.add(text);

}

}</JS Post-Damage>
Could it work changing "target" to b?
 

Maliki79

Veteran
Veteran
Joined
Mar 13, 2012
Messages
811
Reaction score
353
First Language
English
Primarily Uses
N/A
Just checked the code a bit.
Leave it as target.
Instead, try this code:
JavaScript:
<JS Post-Damage>
console.log(item);
console.log(skill);
if (target.isActor() && target._classId === 5) {
  if (!target.isLearnedSkill(22)) {
    target.learnSkill(22);
    var text = target.name() + ' has learned '
    text = text + item.name + '!';
    $gameMessage.add(text);
  }
}
</JS Post-Damage>

Then check the console and see what it says.
If you changed the item reference to a number and it still doesn't work, you either made a mistake with the classId or put this code in the wrong place.
 

miyanke

Veteran
Veteran
Joined
Dec 2, 2015
Messages
73
Reaction score
12
First Language
Spanish
Primarily Uses
RMMZ
Fixed!
I tried to look at the console, but I don't know where or what I am looking at, so couldn't say you about it.

The game was just simply ignoring the code, with no showing text or "learning" at all.

Originally this code were in <Post-Damage Eval>, so I thought the more similar in VS was <JS Post-Damage>, but there was something strange in all of this: "the attack doesn't make damage" it was just an state, so I found <post-Apply> and IT WORKS.

Here is the code for anyone who wants to use it:
JavaScript:
<JS Post-Apply>
if (target.isActor() && target._classId === 5) {
  if (!target.isLearnedSkill(item.id)) {
    target.learnSkill(item.id);
    var text = target.name() + ' ha aprendido '
    text = text + item.name + '!';
    $gameMessage.add(text);
  }
}</JS Post-Apply>

Thank you Maliki79 for your effort and ideas ^_^
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
8,034
Reaction score
5,335
First Language
Dutch
Primarily Uses
RMXP

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Latest Threads

Latest Posts

Latest Profile Posts

Looking back at some sketches, and game design documents on my PC dated summer of 2015. I started development with the release of MZ, but in 2015, I felt a strong desire to make a game out of the blue. I remember feeling sad for no apparent reason, and all these ideas rushed into my head. Now that I think about it, since that day, everything has become easier to do on my PC . . . it’s very creepy.
Everything's going to be alright! We're all in this together. <3
Aaaaannd published my game's tech demo. :D

Feel free to download and play it. And give feedback!
Hey everyone, we know that the edit bar is missing. We're working on it. You can talk about it in the announcement here: https://forums.rpgmakerweb.com/index.php?threads/forum-errors-missing-edit-bar-etc.132715/
So, explain why we can no longer use BBC code or smilies in our posts? This sparks much sadness...

Forum statistics

Threads
107,794
Messages
1,032,257
Members
139,941
Latest member
Finley
Top