petpous

Villager
Member
Joined
Apr 25, 2021
Messages
23
Reaction score
1
First Language
English
Primarily Uses
RMMV
So I need some way of identifying which upgrades are on which armour/ weapon
So far I have this in the notetag

<Upgrade Armor Type: 0>

<Upgrade Effect>

Base Name: 1

Eval: $gameTemp.reserveCommonEvent(124)

</Upgrade Effect>

The common event should check whether the name of each armour has been changed to 1 but for some reason, the name doesn't get changed in the database by the plugin, it is very odd. It is visually changed but the database doesn't know
JavaScript:
$dataArmors[2].name === "1"
Then I'm having a variable change to the armour name which has the changed name
JavaScript:
$gameParty.isAnyMemberEquipped($dataArmors[$gameVariables.value(90)])
Therefore I can do this and check whether the armour with the upgrade has been equipped or not
The reason I'm doing this is that the upgrade for the item turns on a switch to run a base troop event which adds the effect when something specific happens in battle (for example the player guards) but if you unequipped the armour the game doesn't know to remove the effect and turn off the switch
 

ShadowDragon

Realist
Veteran
Joined
Oct 8, 2018
Messages
4,008
Reaction score
1,523
First Language
Dutch
Primarily Uses
RMMV
can you show the common event of 124 what should run?
and what it adds or not?

if it's a conditional branch, does it have an else handler?
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
1,138
Reaction score
623
First Language
English
Primarily Uses
RMMV
You seem to misunderstand how some parts of the RPG Maker engine work.

The database is entirely set within the editor before the game launches - nothing you do while the game is playing will modify database entries.

That's why Yanfly's item system creates what he calls "independent items," these are tracked individually so they can have their name, stats, etc. modified while the game is running.

Yanfly even describes this in the documentation for his Item Core:
Item Core said:
Checking to see if an item exists in the party's inventory will differ if
the item can be independent. Instead, the condition can be fulfilled if
there is an item, even when upgraded, that has the selected item as the base
item. This means your Long Sword (+1) will fulfill the condition of having
the target Long Sword item in the event editor.

I don't know how proficient you are at JavaScript: Yanfly does not list in the documentation how the independent items or their names are stored, so you would have to read through the plugin to see how it works.

If that's beyond your knowledge, I'll take a look for you later this evening.

This evening...:
So when you set the base name via an upgrade, it goes into item.baseItemName. So you could loop through the party and check each of their...whatever slot this armor goes in, and see if that baseItemName is 1.

However, I would recommend an easier approach using Yanfly's Buffs & States and Passive States plugins.

1) Create a state in your database (we'll call it SwitchState, doesn't matter).

2) On the item that can receive this upgrade, put in its Upgrade Effect notetag:
Code:
Eval: item.passiveStates.push(X);
where X is the ID of SwitchState. At this point, it doesn't matter whether you keep the base name change, it is not necessary for this effect.

3) In the notetag of SwitchState, put:
Code:
<Custom Apply Effect>
$gameSwitches.setValue(X, true);
</Custom Apply Effect>
<Custom Remove Effect>
$gameSwitches.setValue(X, false);
</Custom Remove Effect>
where X is the number of the switch you want to use.

That way, it will simply automatically happen when the armor is equipped and removed once the upgrade is applied, no need to manually check.
 
Last edited:

petpous

Villager
Member
Joined
Apr 25, 2021
Messages
23
Reaction score
1
First Language
English
Primarily Uses
RMMV
I'm sorry for continuing this thread and I'm sorry if I misunderstood something but I couldn't get it to work how you said. So I have both the buffs and states plugin and the auto passive states turned on.screenshot5.PNG
So this is my upgrade item and I wrote the push passive states in there and switch state is 16
Screenshot6.PNG
This is the switch state 16 which turns on switch 248 which triggers the effect I want to be applied
(which is a common event which I made which checks when the player is guarding then when they are hit gives and boost)
screenshot7.PNG Here I have applied the upgrade to the armour
Screenshot8.PNG
Screenshot9.PNG
But the switch didn't turn on?
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
938
Reaction score
585
First Language
English
Primarily Uses
RMMV
I'm sorry for continuing this thread and I'm sorry if I misunderstood something but I couldn't get it to work how you said. So I have both the buffs and states plugin and the auto passive states turned on.View attachment 189081
So this is my upgrade item and I wrote the push passive states in there and switch state is 16
View attachment 189082
This is the switch state 16 which turns on switch 248 which triggers the effect I want to be applied
(which is a common event which I made which checks when the player is guarding then when they are hit gives and boost)
View attachment 189083 Here I have applied the upgrade to the armour
View attachment 189084
View attachment 189085
But the switch didn't turn on?
Passive states don't run the apply effect. This is because they are never applied to the actor. Likewise, they are never removed either, they simply become inactive. Because of that, the effect that should be changing the switch is not being checked, so it will never trigger.

Since it seems like the the only purpose of this switch is to check that someone in the party has the state, and then turn on, you could use a parallel process common event and check $gameParty.members().filter(function(ele){return ele.states().includes($dataStates[16])}).length > 0, then set the switch on based on the result of that check.
 
Last edited:

petpous

Villager
Member
Joined
Apr 25, 2021
Messages
23
Reaction score
1
First Language
English
Primarily Uses
RMMV
Passive states don't run the apply effect. This is because they are never applied to the actor. Likewise, they are never removed either, they simply become inactive. Because of that, the effect that should be changing the switch is not being checked, so it will never trigger.

Since it seems like the the only purpose of this switch is to check that someone in the party has the state, and then turn on, you could use a parallel process common event and check $gameParty.members().filter(function(ele){return ele.states().includes($dataStates[16])}).length > 0, then set the switch on based on the result of that check.
I don't really know what the purpose of the passive state was but the switch is meant to turn on when the weapon/armor with the upgrade armor is applied because right now the switch that runs the special upgrade effect is turned on when you add the upgrade not just when the armor/weapon with the upgrade is equipped by the party member
 

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
938
Reaction score
585
First Language
English
Primarily Uses
RMMV
I don't really know what the purpose of the passive state was but the switch is meant to turn on when the weapon/armor with the upgrade armor is applied because right now the switch that runs the special upgrade effect is turned on when you add the upgrade not just when the armor/weapon with the upgrade is equipped by the party member
The code I shared returns true if any actor in the party has the passive state on them, so it should work for what you're doing. Just make a common event, set it to parallel process, and have it check that code in an if condition, and turn the switch on. Make it wait a few frames after each check or you might get some lag.

I didn't test it myself, so I might have a typo in there, but I'll break down what the code is doing so you can understand it more.

$gameParty.members().filter(function(ele){return ele.states().includes($dataStates[16])}).length > 0
$gameParty.members() is a function that returns an array of all of your current party members.
filter() is a function that filters an array based on the criteria inside the brackets, in this case a function.
The filter function looks at every member of the array (ele) and then returns if that member's states() array contains state 16, in other words, it returns true if that specific actor has state 16 active on them.
At the very end, the actual conditional check we're making is that the newly filtered array contains at least 1 member, meaning at least one party member has been found to have the state 16. If it's true, turn on the switch, if not, don't. Simple as that.
 

petpous

Villager
Member
Joined
Apr 25, 2021
Messages
23
Reaction score
1
First Language
English
Primarily Uses
RMMV
Thank you to everyone who has helped with this journey! :kaoluv:
I have finally achieved exactly what I wanted.
Now I will show you the finished upgrade item so if anyone else wants to add this upgrade to their game they can! :wink:
Plugins used:
  • YEP_itemcore
  • YEP_X_ItemUpgradeSlots
  • YEP_Equipcore
  • YEP_AutoPassiveStates
  • YEP_BuffsandStatescore
  • YEP_Battleenginecore
  • YEP_Basetroopevents
upgrade1.PNG
So here is my upgrade item for armour ( <Upgrade Armor Type: 0> ) which if the player gets hit while guarding they will get a defence boost
The first Eval makes common event 124 run
The second Eval causes passive state 16 to be linked with the upgrade item (it will be automatically applied when the upgraded armour is equipped (All credit to ATT_Turan for the second eval)
Upgrade7.PNG
Ramza gave me the script:
JavaScript:
$gameParty.members().filter(function(ele){return ele.states().includes($dataStates[16])}).length > 0
Which checks whether passive state 16 is in effect (which it will be when the item with the upgrade is added)
This turns on the switch which triggers the effects and also adds state 17 ( which i show further down)
upgrade1.PNG

Upgrade2.PNG
This is the passive state 16 which is just blank
upgrade3.PNG
To work out when the player is hit I am using state 17 which is applied when the upgrade item is applied, and what this state does is the Custom Select effect means when the player is targeted by an enemy a switch is turned on by a common event 104 (I know you can do scripts to turn on switches but I liked to add a text box saying "code ran" so that I could work out when in the battle the switch would be applied) The switch is just called "player hit"
Now we know when the player is hit
upgrade4.PNG
When the upgrade item is applied a common event will run to check when the player guards
Upgrade6.PNG
When the upgrade is applied I am using a base troop event page to run this every turn of the battle
If Summer Guards and is hit a skill will run which will give her the defence boost then the two switches are turned off
If that turn the effect is not applied the switches will also be turned off
Here is the upgrade in action
I add the upgrade then I guard and get hit and the aura of safety skill happens

Hope this makes sense!

I'm sure some of it could be simplified but this is what makes sense to me and it works how I want
 

Attachments

  • upgrade5.PNG
    upgrade5.PNG
    22.9 KB · Views: 0

Latest Threads

Latest Posts

Latest Profile Posts

Pretty much stopped posting in the progress thread cuz it feels like talking to the void, lol, so I've just been posting on IG instead. But someone finally liked my post there, lol. Dunno if I'll continue tho. Probably not xD

My game's progressing quite well. Just kinda stuck on mapping right now. Decided to go the side, slightly top down view route. I'm drawing everything from scratch for a personal touch uwu
Stomach isn't feeling too good last time. Perhaps something I ate
Phew! logged back. Seems I was too occupied with 3D learning (yeah for RPGM purposes) creating IRL space, trying to grow catnip, dealing with health and DC is good. (so MrC) ^^
Tyler.stewart wrote on Cherry's profile.
I was wondering if you've heard anything about the patch that allows you to show text anywhere on the screen utilizing pictures being upgraded to work with the official 2k3 release? Your work with 2k3 is awesome dude, keep it alive. I'm 33 and am still playing with 2k3 largely thanks to your work with the game engine. I appreciate the official patch updates you post. Please continue posting
Currently trying to add items in the same style as Kyrise's excellent icons. I like having a large variety of items :3 KyriseandMe.PNG

Forum statistics

Threads
112,333
Messages
1,067,459
Members
145,969
Latest member
creeperQ7
Top