[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
803
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
803
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,867
Reaction score
5,240
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 Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.

Forum statistics

Threads
106,036
Messages
1,018,461
Members
137,821
Latest member
Capterson
Top