How to set Armor Integrity (The wrong way?)

Okay, so I really need to ask for help from anyone who understands the variable control system.
I have a complicated armor health system using multiple forms of control variables, all to set one called Armor Integrity (or the overall amount of health any piece of armor has at any given time). For now, I set up only a limited function of this system, with triggers being just a static action event and give gold to actor (based on values to see what is working, and what isn't working.)

The variables that matter: <Armor Specific HP> <Actor Armor Integrity Level>
The switches that are used: <Is Armor on/being worn>
The conditional Branches being used: <Is Actor wearing armor>
Initial Variable for "Dress Sphere Type A HP": 10

{This command is a simple test to damage the armor HP and later reduce armor integ}
________________________________________________________________________________________________
Trigger Command Test for Dress Sphere Type A HP Damage:
(Trigger: Action)
Conditional Branch: If Actor Jess is equipped Dress Sphere Type A
> Play Sound
> Control Variable: Dress Sphere Type A HP (-1)‎

{This should reduce the variable of Dress Sphere Type A HP by one, making it +9, and so on.}

________________________________________________________________________________________________

Test Armor Integrity Level:
Trigger: Action space
> Give gold by variable: == Jess Armor Integrity Value
________________________________________________________________________________________________

________________________________________________________________________________________________

Armor Integrity Checker (This is where I'm having the most trouble)
{Armors have their own HP values determined by the Armor HP variable, which is updated by specific actions, such as the above trigger command for HP armor damage.}
{But Armor integrity as it links to the actor is a separate variable controlling another variable of Dress State and Added or Subtracted Defense (not relevant to this post as that code is currently left out)}
{Armor integtity is supposed to be set to be added to the actor when that armor is equipped, based on the variable value of that armor's HP stat, and subtracted by the same value if unequipped}
{The control switches in the script are designed to prevent looping of adding varaibles when armor is always equipped or when subtracting when always dequipped. In terms of equipping and unequipping the armor to test armor integrity, the script does work!}
{But in terms of editing these values based on how much HP variable is availible, the value does not change.}
________________________________________________________________________________________________
Armor Integrity Checker:
Trigger: (Paralell Process)
> Wait: 60 frames
> Conditional Branch: If Dress Sphere Type A is equipped to actor (Jess)
>> Conditional Branch: If "Is Dress Type A" switch = ON
>
Else
>> Conditional Branch: If "Is Dress Type A" switch = OFF
>> Control Variable: Armor Integrity (Jess) + =(Variable of Dress Sphere Type A HP)
>> Control Switch: "Is Dress Type A" switch = ON
> Branch End
Branch End
Else (Meaning if Dress Sphere Type A is NOT equipped)
> Conditional Branch: If "Is Dress Type A" switch = ON
>> Control Variable: Armor Integrity (Jess) - =(Variable of Dress Sphere Type A HP)
>> Control Switch: "Is Dress Type A" switch = OFF
> Branch end
Control Switch: "Is Dress Type A" switch = OFF
Branch end
________________________________________________________________________________________________

{Note: This set is is a paralell process but not entirely automatic in how Integ is upated. The integrity varaible in this script only gets updated when the character equips or unequips their armor, from the conditional branches of control switches above. I can automate this later, I don't care about it right now. I test with this in mind and ensure equip/dequip cycles before picking up the amount of gold which SHOULD update to match the new armor integrity.}

________________________________________________________________________________________________

The problem: When checking gold with the equipment on Before and After the damage trigger is used, there is no change in the gold added, which is linked to be exactly the current armor integrity of the character. So, Armor integrity is being updated on whether the armor is equipped or not, but not by if it took damage or not. The update should include the factor of damage to armor. I've been ripping my hair out trying to figure this out, change the branches, change the order each action, and nothing. I cannot figure out why this value won't update the armor integrity from armor HP. Anyone willing to look?
That looks horrendously complex and I'm sure it's more so than it needs to be. Can you tell me what it is you're actually *trying* to do in the integrity checker (preferably with a worked example), rather than telling me how you currently have it?
That looks horrendously complex and I'm sure it's more so than it needs to be. Can you tell me what it is you're actually *trying* to do in the integrity checker (preferably with a worked example), rather than telling me how you currently have it?
I don't have a working example of this checker.
But I can explain the process. And throw in a screen shot or two (of the same scripts anyway).
Armor integity is something I'm trying to attatch as a hidden value status to each actor, based on the damage state to their equipped armor. The armor integerity however is separate as a variable from the actual armor HP (because of combinations and permutations that will exist later for equippable armor).

What I want to achieve by this: Basically, I want to set up in-battle commands that determine the actor's armor integrity variable, and add that amount to the player's defense (without adding it permenantly), so that as your armor takes damage over time, your defense will gradually fall, and eventually the armor will be destroyed and have to be repaired.

But in order to achieve this, I need to have changes and definitions (checks) to the armor HP variable, as well as paralell checks to that character's armor integrity based on what is and is not equipped.
(As you see, I don't really run a lot of custom scripts because I am still novice at understanding any of it, though I could never find an actual downloadable script for this either since it is so customized).



The example events that are on the far right side of the map trigger only by action button, as a means to test the current value of the variables, mainly armor integrity. This is because there is no way in game to simply display what variable values there are running. (Actually, I'm wrong about that, but I don't remember how button to get there.)

The one paralell event on the bottom of the same map is what checks the integrity so to speak. The way this event is set up only works currently if the actor unequips their armor, leaves the main menu, waits for 1 second or the time of the wait command in the script, and then requips that armor, and waits again. (that annoyance is only temporary).
The switches are there only to ensure that the values added or subtracted as variables to the actor's current integrity do not get reprocessed when either (add again while armor is equipped) or (subtract again while armor is not equipped). These switches do work, and I have confirmed as much in testing. I don't know if they are somehow getitng in the way of something else however.

The same paralell event is supposed to add the variable value (equal to) the current Armor HP (when that armor is immidiatley equipped/requipped) > to the variable value of the actor's current armor integrity. And consequently, subtract the same way when the armor is immidiatley unequipped.

When the armor integrity value changes, the amount of gold picked up would therefore change to match that exact setting. In my case however, this does not happen. I get 10 Gold every time when the armor is on no matter how I adjust the variable of its armor HP value. The gold is simply a test. If it is not updating, then somehow the armor integrity itself is not updating either.

Note: While it is not listed in the screenshots, I have an autorunning script at the player start position to run once and set Dress Sphere A HP to 10, to ensure there is something to subtract from.
I don't have a working example of this checker.
But I can explain the process. And throw in a screen shot or two (of the same scripts anyway).
Armor integity is something I'm trying to attatch as a hidden value status to each actor, based on the damage state to their equipped armor. The armor integerity however is separate as a variable from the actual armor HP (because of combinations and permutations that will exist later for equippable armor).

What I want to achieve by this: Basically, I want to set up in-battle commands that determine the actor's armor integrity variable, and add that amount to the player's defense (without adding it permenantly), so that as your armor takes damage over time, your defense will gradually fall, and eventually the armor will be destroyed and have to be repaired.

But in order to achieve this, I need to have changes and definitions (checks) to the armor HP variable, as well as paralell checks to that character's armor integrity based on what is and is not equipped.
(As you see, I don't really run a lot of custom scripts because I am still novice at understanding any of it, though I could never find an actual downloadable script for this either since it is so customized).



The example events that are on the far right side of the map trigger only by action button, as a means to test the current value of the variables, mainly armor integrity. This is because there is no way in game to simply display what variable values there are running. (Actually, I'm wrong about that, but I don't remember how button to get there.)

The one paralell event on the bottom of the same map is what checks the integrity so to speak. The way this event is set up only works currently if the actor unequips their armor, leaves the main menu, waits for 1 second or the time of the wait command in the script, and then requips that armor, and waits again. (that annoyance is only temporary).
The switches are there only to ensure that the values added or subtracted as variables to the actor's current integrity do not get reprocessed when either (add again while armor is equipped) or (subtract again while armor is not equipped). These switches do work, and I have confirmed as much in testing. I don't know if they are somehow getitng in the way of something else however.

The same paralell event is supposed to add the variable value (equal to) the current Armor HP (when that armor is immidiatley equipped/requipped) > to the variable value of the actor's current armor integrity. And consequently, subtract the same way when the armor is immidiatley unequipped.

When the armor integrity value changes, the amount of gold picked up would therefore change to match that exact setting. In my case however, this does not happen. I get 10 Gold every time when the armor is on no matter how I adjust the variable of its armor HP value. The gold is simply a test. If it is not updating, then somehow the armor integrity itself is not updating either.

Note: While it is not listed in the screenshots, I have an autorunning script at the player start position to run once and set Dress Sphere A HP to 10, to ensure there is something to subtract from.
I didn't mean a working example as in a demo, I meant a worked example as in you go through the process you want with sample values to show me where each one is meant to affect the calculation. Looking at this now.
Gotcha.
The "changes" in armor integrity are currently based on test actions, since I want to ensure it works before I install this into a battle somehow. The very first value that is looked at is armor HP, becuase before the paralell process script runs, that armor must have an HP variable value. If that HP value variable changes, then the armor integrity value will change afterwards; in this case, when the armor is unequipped and requipped (since I do not have this part automatic).
The gold pickup only tests the armor integrity (as is)... Though it won't display/add the variable of armor HP. Should have tested that too in a separate action-event, though that should be updating anyway.
The armor damage action-event simply reduces the armor HP value by one each time is triggered.
By which, the paralell process event should add only +9 to equipping that same armor, or -9 for unequipping it if that armor HP was reduced from 10 to 9 by the armor damage action-event.
And so on... But the armor integrity value from the paralell process does not change when the armor HP variable changes... I suspect maybe a syntax issue, but not sure.
I believe I have solved it!
Man it was annoying!
So the math is what was incorrect, not the syntax or the function. Where I specified
> Control Variable: Dress Sphere Type A HP (-1) in the damage testing script, I also added
> Control Variable: Armor Integrity (Jess) (-1)
Into the same branch. I thought that would have been wrong, but the call for the variable to add and remove ArInt from Armor HP has no way of knowing indepenently if ArInt is going to change as a result of this. That means if any equipped armors lose 2 HP, then Armor Integ must also be reduced by 2 at the same moment.
Didn't think that would work, but it does.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-set-armor-integrity-the-wrong-way.145603/