Random quality with alchemy

BurningOrca

Veteran
Veteran
Joined
Apr 14, 2019
Messages
208
Reaction score
180
First Language
German
Primarily Uses
RMMV
I wish the color would be in the format #777777, but as ShadowDragon wrote Yanfly sadly made it the way that only the colors from img\system\window.png of your project will be supported.

As for adding additional skills. They are handled via traits.
Adding the following line to the rarity 4 case will add the skill with the database id 3 to every actors skills that equips this item:

item.traits.push({code: Game_BattlerBase.TRAIT_SKILL_ADD, dataId: 3, value:0});

There are different kind of traits and it is hard to explain them all here.

As for additional stats, these are the params of the items.
So adding a line like if( rarety === 4 ) item.params[3] += 10; at the end of the notetag will give you additional 10 defense.
The indexes are:
0 for max HP,
1 for max MP,
2 for Attack,
3 for Defense
4 for Magic Attack
5 for Magic Defense
6 for Agility
7 for Luck

Also thinks like adding a buff can only be achieved through effects and not via traits, but unless changed by some plugin equipment items can only have traits, while normal items and skills can only have effects.
 
Last edited:

omeg

Veteran
Veteran
Joined
Jul 13, 2019
Messages
72
Reaction score
10
First Language
french
Primarily Uses
RMMV
Ok thank BurningOrca ,but thats doesn't seem to work =s

I tried like you said and don't work ,i tried some other place for these 2 lines of code and don't work either.Do you see a mistake anywhere ?
<On Creation Eval>

if( $gameSwitches.value(1) === true )

{

var factor = 1.0;

var rarity = Math.floor((Math.randomInt(5) * Math.randomInt(5)) / 4);

var textColor = 0;

switch( rarity ) {

case 0: break;

case 1: factor = 1.2; textColor = 3; break;

case 2: factor = 1.4; textColor = 9; break;

case 3: item.traits.push({code: Game_BattlerBase.TRAIT_SKILL_ADD, dataId: 3, value:0});factor = 1.6; textColor = 30; break;

case 4: factor = 1.8; textColor = 17; break;

}

for( var i = 0; i < item.params.length; i++ )

{

item.params = Math.round(item.params * factor);

}

item.textColor = textColor;

}



</On Creation Eval>



<Synthesis Ingredients>

item 5

</Synthesis Ingredients>

if( rarety === 3 ) item.params[0] += 2000;
 

BurningOrca

Veteran
Veteran
Joined
Apr 14, 2019
Messages
208
Reaction score
180
First Language
German
Primarily Uses
RMMV
Two mistakes:
One was done by me, I accidentaly wrote if( rarety === 4 ) in my example, but the variable was actually named rarity. So this was my fault.
Second: The if has to be inside the <On Creation Eval> tag:

Code:
<On Creation Eval>
if( $gameSwitches.value(1) === true )
{
   var factor = 1.0;
   var rarity = Math.floor((Math.randomInt(5) * Math.randomInt(5)) / 4);
   var textColor = 0;
   switch( rarity ) {
      case 0: break;
      case 1: factor = 1.2; textColor = 3; break;
      case 2: factor = 1.4; textColor = 9; break;
      case 3: factor = 1.6; item.traits.push({code: Game_BattlerBase.TRAIT_SKILL_ADD, dataId: 3, value:0}); textColor = 30; break;
      case 4: factor = 1.8; textColor = 17; break;
   }
   for( var i = 0; i < item.params.length; i++ )
   {
      item.params[i] *= factor;
   }
   item.textColor = textColor;
   if( rarity=== 3 ) item.params[0] += 2000;
}
</On Creation Eval>
 

omeg

Veteran
Veteran
Joined
Jul 13, 2019
Messages
72
Reaction score
10
First Language
french
Primarily Uses
RMMV
Ok I see ,i copy paste this section into the weapon notetag but the add skill doesn't work(the +2000 hp is ok) ^^

Some plugin could prevent this line to work ?

It is possible to change the name if rarity =3,4,5 etc right?
Something like : if( rarity=== 3 ) item.name = "flouf" ?
 
Last edited:

BurningOrca

Veteran
Veteran
Joined
Apr 14, 2019
Messages
208
Reaction score
180
First Language
German
Primarily Uses
RMMV
Changing name works exactly like you described.

Hhmm I cant imagine that any plugin would do such things as prevent traits from working.
In my test project (with only YEP_CoreEngine, YEP_ItemCore and a crafting plugin) it works.
I now can only show you screenshots of my test project and how it did work:

1. My skills from the database, Skill with Id 3 is "Double Attack":
Skills.PNG

2. Harold does not have any skills:
Harold Skills before equip.PNG

3. I will equip a sword with rarity 3:
Equip Rarity 3 Sword.PNG
Now Equipped.PNG
4. Harold now knows "Double Attack"
Harold Skills after equip (2450 HP).PNG

If this really doesn't work in your project, then maybe your skill is of a skill type the character can't use.
In this case do the following:
1. Look into your database in the skills tab which type the skill has (in my case it is physical)
2. Look into your database in the types tab which id this type has (in my case it has the id 1)
3. Add the following line to the <On Creation Eval>-Notetag right after adding the skill:
item.traits.push({code: Game_BattlerBase.TRAIT_STYPE_ADD, dataId:1, value:0});
while replacing the 1 in the dataId section of this with your skill type id.

or the skill that you are trying to add does not have the id 3 in your database. In this case replace the 3 in the dataId section of the code
I have provided in my last post with the real id of your skill.

If one of these actions doesn't work either then I am sorry I can't help you.
 

Attachments

omeg

Veteran
Veteran
Joined
Jul 13, 2019
Messages
72
Reaction score
10
First Language
french
Primarily Uses
RMMV
Ok i find the problem,it was the skill itself... the skill category was not assigned(dunno why)so just changing id 3(no category) by 9(magic) make the thing works^^ Also for the name of the item ,works perfectly =)
You help me so much ty =) Do you credit or/and a copy of the game(will be release in december or january 2020)? =)
 

BurningOrca

Veteran
Veteran
Joined
Apr 14, 2019
Messages
208
Reaction score
180
First Language
German
Primarily Uses
RMMV
@omeg: No thank you, I don't want credits.
In winter I've so many games to play on my Nintendo Switch, I propably wont be able to play your game either, so a copy is also not required.
I really just like to help people if I can.
 

omeg

Veteran
Veteran
Joined
Jul 13, 2019
Messages
72
Reaction score
10
First Language
french
Primarily Uses
RMMV
Ok as you wish ,ty for all this help ^^
 

Njiua

Warper
Member
Joined
Sep 9, 2020
Messages
3
Reaction score
0
First Language
Dutch
Primarily Uses
RMMV
Great idea to use such a mini script inside the notes.

Wondering though would it be possible to change the name per item rarity..

Never mind.. Didn't notice page 2
 
Last edited:

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

Latest Threads

Latest Profile Posts

Its been almost 6 months since i've been here last and 5 years before that. the worst part is losing the game you were working on in a cpu fire.

Well time to go at it again.
my game is coming together im so happy
In this day and age, i might switch back to RMXP. I’ve lost faith in all the new plugins.
Wow it's been forever since I last logged in! I STILL want to make a game... I'll start it one day for sure!! It's a dream of mine.
This days I couldn't do anything... My mind is so confused and I couldn't work at all, I only wanted to play video games with my friends and that made all my projects delay a lot. Someone else feels this kind of thing sometimes? :/

Forum statistics

Threads
104,286
Messages
1,005,255
Members
135,795
Latest member
Shoutala
Top