Edgeklinge

Villager
Member
Joined
Oct 24, 2016
Messages
21
Reaction score
10
First Language
English
Primarily Uses
Right now, i'm using this

<On Creation Eval>
var skills = [3, 4, 5, 6]
var rdmId = skills[Math.floor(Math.random()*4)]
var trait = {code: 43, dataId: rdmId, value: 1}
item.traits.push(trait)
</On Creation Eval>

When the armor gets created, it'll pick a skill from 3,4,5,6 pool and assign it as an "add skill". But It is hard to deal with the description now since you'll never know which skill will be assign on that equipment.
So I want the description to show the skill name that is added when created.

I guess I should be using the same yanfly item core's <Info Eval> note tag, store the "skill that is assigned on the armor" as a variable and call it on description as for eg. "this armor adds /V[1] to the wearer"?
But I'm a noob at writing javascript myself, any help would be very appreciated :kaoswt:
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
3,178
Reaction score
1,876
First Language
English
Primarily Uses
RMMV
For the item's info field, put \V[X]

Then the notetag:

Code:
<Info Eval>
var skill=this.traits.filter(trait, trait.code==43);

if (skill.length>0)
    $gameVariables._data[X]="This longsword has been imbued with " + $dataSkills[skill[0].dataId].name;
else
    $gameVariables._data[X]="A longsword";
</Info Eval>

where X is the ID of a variable that isn't being used for anything else.
 

Edgeklinge

Villager
Member
Joined
Oct 24, 2016
Messages
21
Reaction score
10
First Language
English
Primarily Uses
For the item's info field, put \V[X]

Then the notetag:

Code:
<Info Eval>
var skill=this.traits.filter(trait, trait.code==43);

if (skill.length>0)
    $gameVariables._data[X]="This longsword has been imbued with " + $dataSkills[skill[0].dataId].name;
else
    $gameVariables._data[X]="A longsword";
</Info Eval>

where X is the ID of a variable that isn't being used for anything else.
For some reason, it just keep showing the number "0" on any info box. Is there anything I'm likely to miss before doing this?

Edited: so I tried to do some big brain stuff by just adding these

Code:
if (trait = 3)
    $gameVariables._data[1] = "Double Attack"
else if (trait = 4)
    $gameVariables._data[1] = "Wild Swing"
else if (trait = 5)
    $gameVariables._data[1] = "Triple Attack"
else
    $gameVariables._data[1] = "Sneak"

to the above code and the added skill name is finally showing on info box. BUT the problem is THEY ARE ALL THE SAME! So i guess it's because items being independent and they all using the same one variable? Is there any other way to work around this? lmao
 
Last edited:

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
3,178
Reaction score
1,876
First Language
English
Primarily Uses
RMMV
I tried to do some big brain stuff by just adding these to the above code and the added skill name is finally showing on info box. BUT the problem is THEY ARE ALL THE SAME! So i guess it's because items being independent and they all using the same one variable?
Well...no, it's because the stuff you added is not correct JavaScript code. You're taking a variable called trait (where did you declare it? What is it initialized to?) and then setting it equal to 3. So all of that code is pointless, because the first conditional will always make it be 3.

If you need help with something working, go back to what I originally gave you and post a screenshot of your item with the notetags. When you don't correctly know what you're doing with computer code, it never makes sense to guess.
 

Edgeklinge

Villager
Member
Joined
Oct 24, 2016
Messages
21
Reaction score
10
First Language
English
Primarily Uses
You're taking a variable called trait (where did you declare it? What is it initialized to?)
It is declared as an added skill in above <On Creation Eval> codes tho, at least that's how i thought lol xD I also tried with skill and rdmId but they were all the same but nvm now
If you need help with something working, go back to what I originally gave you and post a screenshot of your item with the notetags. When you don't correctly know what you're doing with computer code, it never makes sense to guess.
Screenshot_5.png

Screenshot_4.png
This is what happened tho. It's only showing 0 :kaocry:
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
3,178
Reaction score
1,876
First Language
English
Primarily Uses
RMMV
It is declared as an added skill in above <On Creation Eval> codes tho, at least that's how i thought...I also tried with skill and rdmId
Yeah, all of those are temporary variables declared inside of the code for that notetag. They're not somehow permanently stored on the item.
This is what happened tho. It's only showing 0 :kaocry:
That's weird...because even if the code in the Info Eval weren't working as expected, the portion in the else statement should give it that default description. There should be no circumstance where the game variable is left as 0.

If no one else has a thought, I'll try to troubleshoot a bit later this evening.

Edit: So I'm not sure why this isn't working. In the notetag I gave you, replace this with item and that part of the code will be correct...but the Info Eval still doesn't function like it should.

I can replicate in a new project that the eval isn't happening before the item info gets displayed - go ahead and check it. Look at the item, then scroll to a different one and go back, it should've changed.

But I'm not sure why...looking at the plugin code, in the item info refresh on line 1898 it's checking the eval before drawing the info text, and in the window intialization on line 1885 it's calling the refresh. So maybe I'm just really tired from the past few days, but I don't see why this isn't getting executed before the first time the text is displayed.

Maybe @caethyril or @Trihan can offer some insight.
 
Last edited:

Latest Threads

Latest Profile Posts

SF_People3_3 added!
index.php

ScreenShot_1_3_2022_1_32_12.png
I feel QSprite for MV is underrated. I basically am able to use my chibi sideview battlers I drew on the maps and have all the motions available. this'll help a lot with cutscenes.
I've figured out how to reasonably tall-ify chibi sprites on my editor. I like that making tall sprites gives me control on expressing how tall characters seem on the field relative to each other as well as better differentiate adult sprites from child sprites.
doing some wacky experimental stuff in MV right now :kaoluv: I cannot wait to drop what I've been working on
Doing RPG Maker News for this week. (January 14th - 20th, 2022)

Forum statistics

Threads
118,554
Messages
1,116,925
Members
155,594
Latest member
000dsdsc
Top