[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
810
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
810
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,011
Reaction score
5,325
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

Based on this screenshot alone, which one would you sell, and which to equip?
Some random sketch-letons.

I have a strong urge to make a tutorial video of all the random things I've learned since starting on my game. little helpful tips and stuff that may help people.
Do you guys think it's better to have all members in your team from the beginning (then you can pick who battles) or you gain team members as the story goes?
PL: Patch polonizujący do RPG Makera 2003 prawie gotowy! Mamy przetłumaczoną bazę danych (projekt), polskie fonty, wiadomości walki i jakieś 90% edytora.
Do przetłumacznia pozostało te 10% edytora i plik pomocy. Niedługo więcej informacji!

Forum statistics

Threads
107,479
Messages
1,029,970
Members
139,606
Latest member
Aerilate
Top