[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
797
Reaction score
350
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
797
Reaction score
350
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
7,829
Reaction score
5,221
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.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

grief... lol... I keep seeing request for MZ versions of MV plugins. this is why I haven't moved over and just MZ for my MV project.
Egg-sitting minigame is coming along nicely. Are you a bad enough dino to keep all these raptor eggs warm?

I forgot to post the animated version of the previous map I was working on. I'm still arguing with myself on if I like the stark blue ground better than the undergrowth ground used on the waterfall map. Hmm...
now that fmod is free for indie(<200k revenue), it would be interesting to see someone add fmod support for rpg maker
Can't say I can't promise progress on a project just yet. But I can say I had fun databasing tonight. :)

Forum statistics

Threads
105,802
Messages
1,016,574
Members
137,496
Latest member
sulthorne
Top