MV [Resolved]Card Battle Block Generator Independent Variables

Resolution: Well, that was difficult to figure out, but easy enough to understand. Turns out the variables are stored not in the game, but in the cards, and the trick is to set the variable using the "<Card Passives>", then call it up in the "<Card Target Actions>".

In my case it became the following on a skill that targets 1 ally.:
Code:
<Card Passives>
Var(1) init eval $gameActors.actor(1).def+4
</Card Passives>
<Card Target Actions>
Add Block 3 +Var(1)
</Card Target Actions>
<OverrideMotion:guard>

The convention in these games would be to have the skill target the user, but my game gives you 3 people to control. Unless you are doing such a thing, and want the skill to be usable on your allies, have the card target the user to save the player a few clicks.

Yep... It's me again... So:

1779251027683.png

What did I do wrong?... Also did anyone actually document how things like \v and eval are used? I looked but found nothing.
I ran into similar confusion before. The \v tag is usually for variables, but it depends on the plugin. Some use it for displaying stored values, others for conditional checks. For eval, it executes code directly—so you can put conditions like if (variable == x) inside it.

What exactly are you trying to do with these? Might be easier to help with a specific example.

Also, check if the plugin has a demo project. Sometimes that's the only real "documentation" available.
I ran into similar confusion before. The \v tag is usually for variables, but it depends on the plugin. Some use it for displaying stored values, others for conditional checks. For eval, it executes code directly—so you can put conditions like if (variable == x) inside it.

What exactly are you trying to do with these? Might be easier to help with a specific example.

Also, check if the plugin has a demo project. Sometimes that's the only real "documentation" available.
What I need to do is grab the defense value of an actor though eval, use that to set a variable, then have that add block part use said variable.

It's fine to have the game grab actor 1 rather than the car user if necessary.

And ya they do... But it only demos the core things, not the extras.
did you have the console open when you were testing to see if it was throwing errors? if what you typed for the eval is being evaluated, then gameActors.actor(1).def should have given you an error. it would be $gameActors.actor(1).def if it were being ran

then on the same page you linked, it said that the card variable indices are numbers. the page doesnt give the impression that a string would work.

Im assuming Add Block is from some other plugin within the pack? i cant see it listed in either linked page.
if it is, then maybe try:
Code:
Var(1) set
    eval $gameActors.actor(1).def
Add Block Var(1)
did you have the console open when you were testing to see if it was throwing errors? if what you typed for the eval is being evaluated, then gameActors.actor(1).def should have given you an error. it would be $gameActors.actor(1).def if it were being ran

then on the same page you linked, it said that the card variable indices are numbers. the page doesnt give the impression that a string would work.

Im assuming Add Block is from some other plugin within the pack? i cant see it listed in either linked page.
if it is, then maybe try:
Code:
Var(1) set
    eval $gameActors.actor(1).def
Add Block Var(1)
Alright, tried what you said and it didn't work... I need to go sleep now but the conceal... I had never used ti before as it never worked... But now dose for some reason... Ya... If anyone has any ideas pleas go ahead and tell me about it, I'll get to you when I wake.
do you know if "add block" is a valid command to start with? looking at the documentation, I dont see it listed and I dont know what would lead someone to believing so. Looking at the other block stuff though, a state id is used in all the commands to track which block is to be used.

If it is a valid command and its just missing, then you may need to provide the block state as well. if it isnt, then id suggest asking your questions on the dev's discord server. its a paid plugin, so asking a group of people that includes others who own the plugin, are familiar with it, or are the devs themselves should get you a more definite answer faster than a more general space.
do you know if "add block" is a valid command to start with? looking at the documentation, I dont see it listed and I dont know what would lead someone to believing so. Looking at the other block stuff though, a state id is used in all the commands to track which block is to be used.

If it is a valid command and its just missing, then you may need to provide the block state as well. if it isnt, then id suggest asking your questions on the dev's discord server. its a paid plugin, so asking a group of people that includes others who own the plugin, are familiar with it, or are the devs themselves should get you a more definite answer faster than a more general space.
Ah, would but I could... And seems the wiki is out of date... Here' let me get you the help text.
Spoiler: Block Add
Code:
============================================================================
Overview
============================================================================

Block Generate is a utility plugin which simulates Block in the style of
deckbuilders like Slay the Spire. Block is a defensive resource that can be
accumulated by playing cards or having certain items equipped. When damage
is dealt to the Actor, Block is deducted first before Health.

This plugin lets you designate states as Block States and Resource States.

Block States allow an Actor or Enemy to build block as a resource and use it
as part of their Actions. You can configure each Block State to have a
different initial and max value, damage type interactions, and log messages.
Actors can have multiple Block States on them at a given time with each State
managing its own Block value.

If there are multiple Block States on a target and they take Damage, you can
choose the rules by which that Damage is dealt in the Plugin Parameters.

1) Ascending - Block States with lower IDs will lose value first.
2) Descending - Block States with higher IDs will lose value first.
3) Even Spread - Damage is equally distributed among all valid Block States.

You can also set rules about who Block States interact with Slip Damage and
whether a State is removed when its value hits 0 in the plugin parameters.

Resource States are purely for UI where they show a readout of an Actor/Enemy's
resources such as HP, MP, TP etc. You can also set each Resource States to
pull its value from a different value associated with the Battler (e.g. ATK,
DEF, MAT, MDF, Gold) by changing the value in the Text tab.

Both Block and Resource States are shown in Battle via Icons with Text drawn
on them. You can configure the appearance and placement of these Icons in the
paramters for each state.

There are a number of Notetags and Script Calls that allow you to configure
Block settings for Actors and Enemies. In addition, a number of new Card
Actions have been added to let you make Cards that can manipulate the Block
values of targets. Please review them below.

============================================================================
Card Actions
============================================================================

Add Block [State ID] [+/-]X
Add Block [State Name] [+/-]X
    Adds X to the value of a Block State for the target of the Card Actions.
    If an ID is not provided, it defaults to the first Block State in the list.
    You may use name of the Block State instead of the ID (not case sensitive).
    X must be a negative or positive whole number.
    X can be the value stored in a Variable using \v[x] text code.

Set Block [State ID] X
Set Block [State Name] X
    Sets the value of a Block State to X for the target of the Card Actions.
    If an ID is not provided, it defaults to the first Block State in the list.
    You may use name of the Block State instead of the ID (not case sensitive).
    X must be a positive whole number.
    X can be the value stored in a Variable using \v[x] text code.

Fill Block [State ID]
Fill Block [State Name]
   Sets the value of a Block State to max for the target of the Card Actions.
   If an ID is not provided, it defaults to the first Block State in the list.
   You may use name of the Block State instead of the ID (not case sensitive).
   Maximum will take the Battler's Maximum for a Block State set by their Notetags.
   If no maximum was provided, will default to Maximum set in parameters.

Clear Block [State ID]
Clear Block [State Name]
    Sets the value of a Block State to 0 for the target of the Card Actions.
    If an ID is not provided, it defaults to the first Block State in the list.
    You may use name of the Block State instead of the ID (not case sensitive).

============================================================================
Notetags
============================================================================

For Actors, Classes and Enemies:

  <Init Block [State ID]: X>
  <Init Block [State Name]: X>

Sets initial value of a Block State of this Actor/Enemy to X at battle start.
You may use name of the Block State instead of the ID (not case sensitive).
X must be a negative or positive whole number.
X can be the value stored in a Variable using \v[x] text code.

  <Max Block [State ID]: X>
  <Max Block [State Name]: X>

Sets maximum value of a Block State of this Actor/Enemy to X can have at once.
You may use name of the Block State instead of the ID (not case sensitive).
X must be a negative or positive whole number.
X can be the value stored in a Variable using \v[x] text code.

   <Hide Block [State ID]>
   <Hide Block [State Name]>
   <Hide Block [State ID], [State ID], ... >
   <Hide Block [State Name], [State Name], ...>
   <Hide All Block>

Hides Icon of a Block State on the Battler's Sprite and Windows.
If an ID is not provided, it defaults to the first Block State in the list.
You may use name of the Block State instead of the ID (not case sensitive).
Hide All Block will hide icons for every ID on the Block State list.

   <Hide Resc [State ID]>
   <Hide Resc [State Name]>
   <Hide Resc [State ID], [State ID], ...>
   <Hide Resc [State Name], [State Name], ....>
   <Hide All Resc>

Hide Icon of a Resource State on the Battler's Sprite and Windows.
If an ID is not provided, it defaults to the first Resource State in the list.
You may use name of the Resource State instead of the ID (not case sensitive).
Hide All Resc will hide icons for every ID on the Resc State List.

For Skills and Items:

   <Ignore Block [State ID]>
   <Ignore Block [State Name]>
   <Ignore Block [State ID], [State ID], ...>
   <Ignore Block [State Name], [State Name], ...>

Damage Formula of these Skills/Items will ignore target's Block State X
value and deal their damage directly to HP instead. Useful for "piercing"
type Skills/Items.

If an ID is not provided, it defaults to the first Block State in the list.
You may use name of the Block State instead of the ID (not case sensitive).

For Weapons and Armors:

  <Mod Init Block [State ID]: [+/-]X>
  <Mod Init Block [State Name]: [+/-]X>

Modifies an Actor's Initial for a value Block State by adding Y to it.
If an ID is not provided, it defaults to the first Block State in the list.
You may use name of the Block State instead of the ID (not case sensitive).
X must be a negative or positive whole number.
X can be the value stored in a Variable using \v[x] text code.
Can stack from multiple sources (like different pieces of equipment).

  <Mod Max Block [State ID]: [+/-]X>
  <Mod Max Block [State Name]: [+/-]X>

Modifies an Actor's Max for a Block State value by adding X to it.
If an ID is not provided, it defaults to the first Block State in the list.
You may use name of the Block State instead of the ID (not case sensitive).
X must be a negative or positive whole number.
X can be the value stored in a Variable using \v[x] text code.
Can stack from multiple sources (like different pieces of equipment).

For States:

   <Change Block [State ID]: [+/-]X>
   <Change Block [State Name]: [+/-]X>

Determines how much an Actor with a Block State will gain/lose Block at the
end of their turn (during the Regenerate Step).
If an ID is not provided, it defaults to the first Block State in the list.
You may use name of the Block State instead of the ID (not case sensitive).
X must be a negative or positive whole number.
X can be the value stored in a Variable using \v[x] text code.
Can stack from multiple sources (like different States on the same Battler).

If there is both Block Gain and Block Loss from multiple States, the values
are summed together and applied as a single instance of generation e.g. if
State A gains 20 BLOCK each turn and State B loses 40 Block each turn, then
an Actor with both State A and B loses 20 Block (+20 - 40 = -20) each turn

   <Fill Block [State ID]>
   <Fill Block [State Name]>
   <Fill Block [State ID], [State ID], ...>
   <Fill Block [State Name], [State Name], ...>

When a State with this Notetag is applied to a Battler, that Block State value
is set to max. If an ID is not provided, it defaults to the first Block State in
the list. You may use name of the Block State instead of the ID (not case
sensitive). Maximum will take the Battler's Maximum for that Block State set by
their Notetags.
If no maximum was provided, will default to Maximum set in parameters.

   <Clear Block [State ID]>
   <Clear Block [State Name]>
   <Clear Block [State ID], [State ID], ...>
   <Clear Block [State Name], [State Name], ...>

When a State with this Notetag is applied to a Battler, the Block State value
is set to 0. If an ID is not provided, it defaults to the first Block State in
the list. You may use name of the Block State instead of the ID (not
case sensitive).

   <Negate Block [State ID]>
   <Negate Block [State Name]>
   <Negate Block [State ID], [State ID], ...>
   <Negate Block [State Name], [State Name], ...>

When a State with this Notetag is applied to a Battler, Block State is removed
and can't be applied to the Battler until this state elapses or is removed.
Anything trying to Add or Set value to Block State will fail while this State
is on the Battler.

If an ID is not provided, it defaults to the first Block State in the list.
You may use name of the Block State instead of the ID (not case sensitive).

============================================================================
Script Calls
============================================================================

For Actors and Enemies:

  {battler}.getBlock(id)

Returns the Battler's current value for Block State of specified ID.
If an ID is not provided, it defaults to the first Block State in the list.

  {battler}.setBlock(id, value, show)

Sets the Battler's value for Block State of specified ID.
If an ID is not provided, it defaults to the first Block State in the list.
Value will be processed as a positive or negative whole number.
Show can be true/false based on if you want a Damage Popup + Log Message
for the action.

  {battler}.addBlock(id, value, show)

Adds value to the Battler's Block State of specified ID.
If an ID is not provided, it defaults to the first Block State in the list.
Value will be processed as a positive or negative whole number.
If it goes over the Battler's Max or under 0, the value is automatically clamped.
Show can be true/false based on if you want a Damage Popup + Log Message
for the action.

  {battler}.fillBlock(id, show)

Fills the Battler's Block State of specified ID setting it to max.
If an ID is not provided, it defaults to the first Block State in the list.
Maximum will take the Battler's Maximum for Block State X set by their
Notetags. If no maximum was provided, will default to Maximum set in
parameters. Show can be true/false based on if you want a Damage Popup
+ Log Message for the action.

  {battler}.clearBlock(id, show)

Clears the Battler's Block State of specified ID setting it to 0.
If an ID is not provided, it defaults to the first Block State in the list.
Show can be true/false based on if you want a Damage Popup + Log Message
for the action.

============================================================================
For more information and other features please use the wiki
that has been made for this and all related plugins:
http://card-game-combat-help.alwaysdata.net/
============================================================================


============================================================================
Version History
============================================================================

v1.4.1 - Enemies appearing midway in Battle properly have Block/Resc States
       - Transforming an Enemy now properly sets them to Initial Block Values

v1.4.0 - Fixed Enemy State Icon flickering issue
       - Added support for Block States used in Card Summons (for summoners)
       - Fixed Show Icon on Battler and Show Icon on Window struct parameters
       - Added support for formula input in Init Block, Max Block,
         Mod Max Block, Mod Init Block, Change Block Notetags
       - Added support for comma seperated values in Hide Block, Hide Resc,
         Ignore Block, Fill Block, Clear Block, Negate Block Notetags
       - Added Class Notetags for Init Block, Max Block, Hide Block, Hide Resc

v1.3.2 - Fixed bug where Block States were not being cleared at Battle Start.

v1.3.1 - Improved Message Warning infrastructure.

v1.3.0  - Changed parameters to accomodate multiple Block/Resource States
        - Changed Notetags, Card Actions and Script Calls to work
          with new params
        - Added Param to turn on/off Battle Log Messages for Block States
        - Added Param to turn on/off Damge Popups for Block States
        - Added Param letting you set the Damage Popup colors per Block State
        - Added Param for whether Slip Damage reduces Block value before HP
        - Added Param to let you set Resource States to HP, MP, TP or others
        - Added Params to turn on/off State Icons on Actors and Windows
        - Block Font Color does not change with Actor HP State in Windows
        - Allowed using State Names instead of ID for Card Actions
          and Notetags
        - Changed <Block Change> Notetag syntax to <Change Block>
        - Added <Fill Block> and <Clear Block> State Notetags
        - Added support for Variable Input in Card Actions and Notetags

v1.2.0  - Fixed issue with Normal Attack damage type ignoring Block
        - <Ignore Block> is working again and unaffected by Damage Types
        - Added new Card Actions for Add Block, Set Block and Clear Block
        - Fixed bug where Block carried over rounds despite showing it cleared

v1.1.0 - Added in Health Icon in case users want to show both Health and
         Block on a Battler. Has a Notetags if you want to hide it.
       - Block and Health values are written to Icons on Actor & Party Windows
         Can set different Fonts for Block and Health Icon text.
       - Exposed the text for State Messages for Block and Break. Now can
         be customized. Has differences between MV and MZ.
       - Added support for Elements. You can now choose which Damage Types
         the Block State reduces vs which ones are ignored.
       - Different Icon Offsets can be declared for Actors and Enemies

v1.0.0 - Base Functionality complete! Will probably come back around and do
         some minor edits once I am done testing this with CGC Demo Project.


============================================================================
Contact Info
============================================================================

This tool was developed by folks at MythAtelier LLC. We make Games that Care.

Need more tools for your project? Be sure to check out our other plugins here:
https://itch.io/c/1695699/tools-plugins

Have any questions? Run into any bugs? Want to chat? Best place to reach us:
https://discord.gg/wRk4XHF5tZ

If you like this plugin and want to support us, please give our Patreon a look:
https://www.patreon.com/mythatelier

Other Places to Find Us:
- YouTube: https://www.youtube.com/channel/UCQn_1kWmj2iAkNEv9eqL_LA
- BSky: https://bsky.app/profile/mythatelier.itch.io
- Steam: https://store.steampowered.com/search/?developer=MythAtelier%2C%20LLC
Spoiler: Independent Card Variables
Code:
============================================================================
Overview
============================================================================

This plugin gives cards a new array of variables called Var, which can
be accessed through code (for damage formulas and the like) and can also
be used in place of numbers in other Card Actions.

Var can contain as many variables within it that you need. To access them
in card actions, use:
    Var(index)
Where index is any number. By default all variables inside Var are set to 0.

Below is a list of Card Actions which allow you to modify the variables
inside Var.

Note that this plugin is compatible with CGC 1.5, but some features will
not work - namely, the Card appearance will not change to reflect
description or cost changes as a result of Var values changing. 1.6.0 or
higher is required for these features.


============================================================================
New Card Actions & Passives
============================================================================

Card Actions:

    Var(X) set Y
Replace X with the Var index
Replace Y with the value you wish the Var index to contain

This sets the specified Var of this card to the value supplied in Y.

    Var(X) mod [+/-]Y
Replace X with the Var index
Replace [+/-]Y with a positive or negative number

This modifies the specified Var of this card by the value of Y. Basically
it adds or subtracts Y to/from the Var.

    Var(x) set eval [formula]
Replace X with the Var index
Replace [formula] with a formula to be evaluated.

This sets the specified Var of this card to get the value of the formula.
This value is re-evaluated at the end of each Action in battle.


    All Skill [skillID] Var(X) set Y
    All Skill [skillID] Var(X) mod [+/-]Y
    All Skill [skillID] Var(X) set eval [formula]

These Card Actions modify the Var of all cards belonging to that actor
of the specified Skill ID.

    All Skill [skillID] Var(X) set Y in [zoneName]
    All Skill [skillID] Var(X) mod [+/-]Y in [zoneName]
    All Skill [skillID] Var(X) set eval [formula] in [zoneName]

These Card Actions modify the Var of all cards belonging to that actor's
specific zone. Replace "[zoneName]" with "Deck", "Discard" or "Hand".


If you have MYTH_CGC_ActionPack1 you also have access to these Card Actions:

    Selected Var(X) set Y
    Selected Var(X) mod [+/-]Y
    Selected Var(X) set eval [formula]

These Card Actions act on all Selected cards instead of the card containing
the Card Actions.


Card Passive:

    Var(X) init Y
    Var(X) init eval [formula]

This will set the initial value of Var(X) to the number specified in Y, or
evalutated from the formula.
All values initialize at 0 by default, and this overrides that behavior for
this Var index of all cards belonging to this skill.

When Var values are reset, either through the "Reset Var after battle?"
plugin parameter or through functions listed below, they return to their
initial values.



============================================================================
Getting the Value of a Var
============================================================================

In Card Actions you can use:
    Var(index)
Where index is the number of the index you want.

In damage formulas, use:
    a.cardVar(index)
Where index is the number of the index you want.

Finally, in skill descriptions, you can use:
    \Var[n]
Where n is the number of the index you want.

By default, these will all return 0 if no value was found at that index
of Var.

============================================================================
Modifying Card Cost
============================================================================

Use the following notetag:
    <[MP/TP/HP] cost [+/-/=] var(X)>

This takes the current MP/TP/HP cost and adds/subtracts/sets equal to
the variable of index X in Var.

Eg.

    <MP cost + var(0)>
    This will cause the value of Var(0) of that card to be added onto
    the base skill cost

    <TP cost - var(1)>
    This will make the TP cost go down as Var(1) goes up.

    <HP cost = var(1)>
    This will override the base HP cost and replace it with the value
    of Var(1).

Note that the HP cost tag will only work if you are using plugins that
support HP cost.


============================================================================
Advanced / Functions
============================================================================

    actor.cardVar(index)
This returns the value of the Var of the currently-being-used card.
Useful for damage formulas.


    actor.modSkillVar(skillId, index, value, direction)
This function modifies the Var of all Cards of a given Skill ID belonging
to this actor.
direction should be -1, 0, or 1.
When direction is -1, value is subtracted from the var. When direction is 1,
value is added to the var.
When direction is 0, the var is set to the value.

    actor.resetAllCardVars();
This function resets all Vars of all Cards belonging to the actor.

    actor.resetSkillVar(skillId)
This function resets all Vars of all Cards of a given Skill ID belonging
to this actor.

    card.getVar(index)
If you can get access to a specific Game Card you can use this function
to grab the Var from that card.

============================================================================
Version History
============================================================================

v1.2.1 - Added Warn Messages for errors in Var formulas.

v1.2.0 - Added Eval variants on Var Card Actions.

v1.1.3 - Fixed bug where extra zones' cards wouldn't have their Var values
         changed when using All Skill Var(X) Set Card Action.
         Added Preserve Var Values on Transform parameter.
         Fixed bug where skill description would always reference the first
         Var value for all Vars.

v1.1.2 - Small change to one function for compatibility with Core Engine
         v1.6.2.

v1.1.1 - Simple View for the Card Library is now forced
       - Var values are now shown on cards in the Card Library Simple View.
       - Initial Var values are now shown on cards in all scenes where
         previously their values always shown as 0.

v1.1.0 - Changed plugin name
       - Updated for compatibility with 1.6.0
       - Minor refactoring to improve compatibility with other expansion
         plugins.

v1.0.3 - Fixed All Skill Card Action adding numbers like strings instead of
         numbers. 1 + 1 now equals 2 instead of 11.
         Init Var(x) and Set Var(x) can now supply a negative number.

v1.0.2 - Init Var(x) now a Card Passive for consistency with CGC.
         Cleaned up help file for improved readability.

v1.0.1 - Changed syntax for Card Actions that modify Var to be a bit more
         intuitive.
         Fixed Set Card Action not working properly
         Added <init> notetag and fixed reset function to use initial
         values.

v1.0.0 - Finished plugin

============================================================================
Contact Info
============================================================================

This tool was developed by folks at MythAtelier LLC. We make Games that Care.

Need more tools for your project? Be sure to check out our other plugins here:
https://itch.io/c/1695699/tools-plugins

Have any questions? Run into any bugs? Want to chat? Best place to reach us:
https://discord.gg/wRk4XHF5tZ

If you like this plugin and want to support us, please give our Patreon a look:
https://www.patreon.com/mythatelier

Other Places to Find Us:
- YouTube: https://www.youtube.com/channel/UCQn_1kWmj2iAkNEv9eqL_LA
- BSky: https://bsky.app/profile/mythatelier.itch.io
- Steam: https://store.steampowered.com/search/?developer=MythAtelier%2C%20LLC
What I was able to learn after a little sleep and coffee was that the command dose in fact need to be on 1 line rather than 2;
Code:
Var(1) set eval $gameActors.actor(1).def
Not;
Code:
Var(1) set
eval $gameActors.actor(1).def
And that "$gameActors.actor(1).def" dose not seem to be the right thing to run in this case as it simply crashes the game.

I also know for a fact that the "Add Block" portion is right as it works fine when I run it with a set number (EG; 5) rather than a variable... I would use that, but I intend to allow the block to be bolstered.
And that "$gameActors.actor(1).def" dose not seem to be the right thing to run in this case as it simply crashes the game.
what does the crash message say? or better yet, when it happens, press f12, open up the console, and share a screenshot of the message and error trace. $gameActors.actor(1).def is valid script to get the defence parameter of actor #1. Unless you have a plugin that severely messes with how actor data is handled or the notetag doesnt allow the $ character and has some shortcut, I would have assumed either some other notetag issue without seeing it.
what does the crash message say? or better yet, when it happens, press f12, open up the console, and share a screenshot of the message and error trace. $gameActors.actor(1).def is valid script to get the defence parameter of actor #1. Unless you have a plugin that severely messes with how actor data is handled or the notetag doesnt allow the $ character and has some shortcut, I would have assumed either some other notetag issue without seeing it.
1779285398951.png

1779285445967.png
you got the same error both with and without the $ at the front of $gameActors? your screenshot shows it without while ive only mentioned it with.

if so, have you tried setting the variable to a static number with the eval just to see if it runs? you mentioned
"Add Block"... works fine when I run it with a set number (EG; 5) rather than a variable.
but it looks like the error happens when trying to set the value of a variable from some formula. it doesnt sound like it from the help text you provided, but seeing as how the error is from setting a property to something undefined rather than null, a step somewhere may have been skipped and something hasnt initialized properly.

And to cover all the bases. every time you tested a change, you saved the project and tested it within a new save file in the playtest and not from a battle test from the troop menu in the database, right?
you got the same error both with and without the $ at the front of $gameActors? your screenshot shows it without while ive only mentioned it with.

if so, have you tried setting the variable to a static number with the eval just to see if it runs? you mentioned

but it looks like the error happens when trying to set the value of a variable from some formula. it doesnt sound like it from the help text you provided, but seeing as how the error is from setting a property to something undefined rather than null, a step somewhere may have been skipped and something hasnt initialized properly.

And to cover all the bases. every time you tested a change, you saved the project and tested it within a new save file in the playtest and not from a battle test from the troop menu in the database, right?
I did try setting it as a static thing ya goober... And no, I was doing the battle test? I would hope that wouldn't matter, but I tried it anyway just to be sure and got the same issue.

As for your question, ya I tried with and without the "$".

Also for the sake of completeness, I tried moving the variable plugin above the block generation.

And farthermore, I don't need to grab the variable in any particular fashion, I just need that card to be able to use the defense of the actor using. Hard coding it to actor 1 is fine, but not needed.
Tried setting the Var to a static number then adding block using said Var, it worked... So I at least know that my method of calling an actor's value is the issue... Likely.
Tried setting the Var to a static number then adding block using said Var, it worked
thats what i wanted to be sure of before making any other assumptions.

So I at least know that my method of calling an actor's value is the issue... Likely.
i checked the documentation again and it has an instance of using user as a reference to the current battler. try user.def

And no, I was doing the battle test? I would hope that wouldn't matter, but I tried it anyway just to be sure and got the same issue.
its an issue that depends on the plugin and and how its written. Sometimes, plugins are written in ways that makes it so that important data is only created on the start of a new game and is skipped when setting hp a battle test. Its likely not an issue here, but just something to keep in mind. especially if you add more plugins later
thats what i wanted to be sure of before making any other assumptions.


i checked the documentation again and it has an instance of using user as a reference to the current battler. try user.def


its an issue that depends on the plugin and and how its written. Sometimes, plugins are written in ways that makes it so that important data is only created on the start of a new game and is skipped when setting hp a battle test. Its likely not an issue here, but just something to keep in mind. especially if you add more plugins later
Didn't work, same crash as before, same error.
1779316194617.png
More digging has been done... Seems the Independent Variables plug in can not handle actor stats, but the block addon uses global variables... Anyone happen to know a way to force a common even to run before the card can be used?
What I need to do is grab the defense value of an actor though eval, use that to set a variable, then have that add block part use said variable.

It's fine to have the game grab actor 1 rather than the car user if necessary.

And ya they do... But it only demos the core things, not the extras.
You can grab an actor's defense value in RPG Maker using script calls. For eval, something like:

$gameActors.actor(1).def

Then set that to a variable using Control Variables -> Script. After that, the add block part should be able to read that variable directly. No need to overcomplicate.

If the plugin's demo doesn't cover this, try looking at the plugin's code directly—sometimes the author includes comments explaining the eval syntax.
You can grab an actor's defense value in RPG Maker using script calls. For eval, something like:

$gameActors.actor(1).def

Then set that to a variable using Control Variables -> Script. After that, the add block part should be able to read that variable directly. No need to overcomplicate.

If the plugin's demo doesn't cover this, try looking at the plugin's code directly—sometimes the author includes comments explaining the eval syntax.
That's where things get tricky... The plugin itself can not read the eval statement as whoever made it somehow managed to allow that for descriptions but not the note tag executions. (I have no idea why anyone would do that.)

My plan now, is to simply have something else fetch the value. A thing I know how to do... The issue comes in that I am not sure to make sure that value is always taken before the ability tries to apply block.
Anyone happen to know a way to force a common even to run before the card can be used?
A common event may not be the choice here as they are queued. they arent ran immediately and only play at certain times when the engine is allowed to process them. You shouldnt be able to run one any earlier than the end of the skill's execution.

when you say global variables, do you mean Game Variables, or JS global variables? if its the former, then you might be able to use the regular card action eval to set a game variable to the actor's defence (not sure if its just the variable set eval that cant read it or if its just how card actions are read in general) or use yanfly's skill core or action sequences to set it before the actual effect is applied.
I've had a few ideas, hold on while I try things...
Tried this for testing:
1779379024232.png

Card worked, doing 1 damage as expected. (def 1 is normal here.)

Then tried this:
1779379248042.png

Which made it finally stop crashing.

Then the moment of truth:
1779379417381.png


This worked... At long last... Big brother can protect his siblings.... No, I would not in fact have figured this out on my own. Robro33, if you would like to be added to the list of folks getting free copies of the game, you need only ask. Here or privet messages will do. I'll just update the main post with my findings.

Original thread: https://forums.rpgmakerweb.com/threads/resolved-card-battle-block-generator-independent-variables.183723/