tylla

Warper
Member
Joined
Jan 16, 2022
Messages
2
Reaction score
2
First Language
English
Primarily Uses
RMMV
I would like to make a skill that, when used by an enemy on a given actor, adds an armor to the player's inventory - but only if the player doesn't already have that armor, as it's supposed to be unique. I have a feeling that the Yanfly Skill Core is the proper plugin for this, but I don't know exactly what code should go in the notetag. Any help would be greatly appreciated.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
36,693
Reaction score
9,863
First Language
German
Primarily Uses
RMMV
no need - this can be done with a common event attached to the skill.

the only drawback is that if that skill is used in the last turn of combat it will not happen due to combat ending before the common event is processed. you really need a plugin if that is a problem.
 

JohnDoeNews

Steam mod (MV/MZ)
Veteran
Joined
Apr 25, 2017
Messages
1,038
Reaction score
823
First Language
Dutch
Primarily Uses
RMMV
I would like to make a skill that, when used by an enemy on a given actor, adds an armor to the player's inventory - but only if the player doesn't already have that armor, as it's supposed to be unique. I have a feeling that the Yanfly Skill Core is the proper plugin for this, but I don't know exactly what code should go in the notetag. Any help would be greatly appreciated.
If you have more yanfly plugins, then with the ItemCore plugin you can make the item unique by default, making it impossible to obtain a second copy. (Simply by baking the max 1)

Then make the damage formula:
Code:
$gameParty.gainItem($dataArmors[X], Y) ; Z

Replace X, Y and Z with:
X: Armor ID
Y: Amount (in this case 1)
Z: Your damage formula

I didn't test this, but it should work.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
36,693
Reaction score
9,863
First Language
German
Primarily Uses
RMMV
Then make the damage formula:
bad idea

there are two problems with this when using the damage formula:

1) the item will always be added, it completely ignores the test if the actor has the armor.

2) the item can be gained multiple times even if the skill is not used
the damage formula is always executed when the engine tries to find the best skill to use on special occasions, but only the damage itself is negated for the tests.
that is one of the disadvantages on using damage eval for other purposes than damage: the other purposes will happen even if the engine only tries to simulate the damage.
 

Arctica

Veteran
Veteran
Joined
Jul 19, 2021
Messages
186
Reaction score
302
First Language
English
Primarily Uses
RMMZ
Problem 1: Could it not first check if there is already 1 armor and then just skip it if it is?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
36,693
Reaction score
9,863
First Language
German
Primarily Uses
RMMV
@Arctica theoretically yes
but that check is a bit long in javascript, and the damage formula in the editor has a limited length.

it can be done that way (and would partially solve the second problem as well), but only if that is a single case. If the OP wants to use this in several variants instead of as a single easter egg or special story case, then it becomes difficult handling things that way.
 

Frostorm

[]D[][]V[][]D
Veteran
Joined
Feb 22, 2016
Messages
2,788
Reaction score
2,224
First Language
English
Primarily Uses
RMMV
Then make the damage formula:
bad idea
I've posted this before but one of the reasons it's a bad idea is this:
It's basically what @Andar said.

Personally, I would use the <Custom Execution> notetag instead. Put in w/e conditionals you want etc... There's also the <Before Eval> and <After Eval> notetags as well. I assume you have Yanfly plugins, cuz that's where those notetags are from.
 

JohnDoeNews

Steam mod (MV/MZ)
Veteran
Joined
Apr 25, 2017
Messages
1,038
Reaction score
823
First Language
Dutch
Primarily Uses
RMMV
Problem 1: Could it not first check if there is already 1 armor and then just skip it if it is?
That problem shouldn't exist if the itemcore is used and the max for that item is set to 1. My solution was meant to be used in combination with the itemcore plugin.


bad idea

there are two problems with this when using the damage formula:

1) the item will always be added, it completely ignores the test if the actor has the armor.

2) the item can be gained multiple times even if the skill is not used
the damage formula is always executed when the engine tries to find the best skill to use on special occasions, but only the damage itself is negated for the tests.
that is one of the disadvantages on using damage eval for other purposes than damage: the other purposes will happen even if the engine only tries to simulate the damage.
I wouldn't know about problem 2, I'd have to put that at the test... But problem 1 should be prevented if the itemcore is used to make it an unique item.

---

I guess the skillcore can indeed be used to add the item, and still use the itemcore to make it a unique weapon. Then the damage formula wouldn't be needed at all. Well... Other than doing damage. :p
 

Latest Threads

Latest Posts

Latest Profile Posts

Coin Locker title screen:
Still in progress...

Screenshot_134.png
the girls.png
So, these are all the girls of the party =3 (beside the protagonist if you play as a female.)
Now, I just have one more character sheet of the guys left and I'm done with their presentations =3
Can you recognize where this area is from? :kaocry:
Mq9QM3h.png
For those with up to 9 elements of magic; how do you structure your database. By element? Or by what is offensive vs supportive spells?
would anyone here be interested in rough concept art for the main protagonist of my game that might get changed later? :kaoswt2:

Forum statistics

Threads
124,442
Messages
1,163,676
Members
163,256
Latest member
onbetltd
Top