[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
791
Reaction score
346
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
791
Reaction score
346
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,787
Reaction score
5,209
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

GOBBLE GOBBLE! Happy thanksgiving.
Oh no. That moment when you try to fix something you modified in your game, like, a year ago but didn't want to fix then, and you now have no idea what you even did. Me right now, trying to figure out why my gold window is over stretched?
LittlePIGGY wrote on atreyoray's profile.
Where are you TT^TT
We need ARP_InGameManual for MZ
Oh my gosh. Thank you, Macy's! Thank you so much! You have made me very happy!

Forum statistics

Threads
105,552
Messages
1,014,573
Members
137,225
Latest member
Eryndor
Top