Can't figure out how to add variables to Game Data

I thought I had figured this out but seems I just thought I did.

What I'm trying to do specifically at the moment is add homemade variables to Game Data: Enemy: [1.]'s DEF.  It looks like I'm going to need some kind of script to do this - because unless I'm just being blind or stupid (both possible) the only parameters you are allowed to change through events for an enemy is HP and MP and that's not going to cut it for my game.

So if someone could describe the process of how I can add my variables to the Game Data it would be a big help.  Ideally something that looks like this:

[Enemy 1.]'s DEF = [Homemade Variable 1]
edited.
Short of someone writing a script with script calls you can use I'm not really sure how you would do that. If you trying to make the enemy stronger during certain parts of the battle you could force states on them that will buff them up.. Or if you want your enemy's to scale with the players group there are several enemy level scripts available.

Also check out this post:

HERE

You may find it useful for what your are trying to do.
You can't change the DEF of a monster outside the editor, but usually that's not neccessary for two reasons:

1) You can change the DEF by adding a state or a buff to the monster

2) You can modify all skill's damage formulas

The first solution requires careful definition of the buff/state's removal options and has a few difficulties in finetuning

The second solution requires a lot of work in programming the skills since you'll have to change all skills, but allows full control.

If you read about the parameter's description in the help files, you'll learn that ATK, DEF, MAT and MDF have absolutely no hardcoded function in the engine.

They are ONLY used in the damage formula - and if you don't like the default damage formula of 4*ATK-2*DEF, then simply write another formula there.

And since that is a scripted field, you can access all ruby commands and all variables from there...

Tell us why you would want to make the enemies DEF variable and we'll give you the best solution to get to that - scripts aren't neccessary in most simple cases, they would only be needed for extremely rare cases of complex formulae...
Why did you delete your post Death?  That script you wrote out looked like exactly the kind of thing I was looking for - and I was planning on working on it this morning.  I was just waiting till I had more time before I delved into it is all, and that was the only reason I didn't give you an immediate response yesterday. 

Did the script not work properly or something?  Because if it works I would appreciate it if you would throw it back up here so I can give it a whirl.

Short of someone writing a script with script calls you can use I'm not really sure how you would do that. If you trying to make the enemy stronger during certain parts of the battle you could force states on them that will buff them up.. Or if you want your enemy's to scale with the players group there are several enemy level scripts available.

Also check out this post:

HERE

You may find it useful for what your are trying to do.
Thanks for the link, and that might be something I can work with and looks promising.  I will give that method a try today and see how it works out. 

Tell us why you would want to make the enemies DEF variable and we'll give you the best solution to get to that - scripts aren't neccessary in most simple cases, they would only be needed for extremely rare cases of complex formulae...
The why would be because I want to fully create my monsters from scratch at the beginning of each battle.  I've evented different leveling patterns for my enemies and I want to apply them - but in order to do that I'll need a way to change their parameters. 

I didn't think to try applying states and skills that correspond to different growth levels to do this.  So I'm going to try that out. 
It has a bug.

I will post it again when I fixed it.
It has a bug.

I will post it again when I fixed it.
ok - I just didn't want you thinking I wasn't interested in it because I didn't respond to your post right away.
Add this script:

class Game_Enemy < Game_Battler  def change_param(param_id, value)    enemy.params[param_id] = value  endendCall Script:

$game_troop.members[ID].change_param(param_id, value)ID: 1, 2, 3,... (in Troops)

param_id: (0 is Max HP, 1 is Max MP)

  def mhp;  param(0);   end               # MHP  Maximum Hit Points  def mmp;  param(1);   end               # MMP  Maximum Magic Points  def atk;  param(2);   end               # ATK  ATtacK power  def def;  param(3);   end               # DEF  DEFense power  def mat;  param(4);   end               # MAT  Magic ATtack power  def mdf;  param(5);   end               # MDF  Magic DeFense power  def agi;  param(6);   end               # AGI  AGIlity  def luk;  param(7);   end               # LUK  LUcKvalue: the var.
Add this script:

class Game_Enemy < Game_Battler  def change_param(param_id, value)    enemy.params[param_id] = value  endendCall Script:

$game_troop.members[ID].change_param(param_id, value)ID: 1, 2, 3,... (in Troops)

param_id: (0 is Max HP, 1 is Max MP)

  def mhp;  param(0);   end               # MHP  Maximum Hit Points  def mmp;  param(1);   end               # MMP  Maximum Magic Points  def atk;  param(2);   end               # ATK  ATtacK power  def def;  param(3);   end               # DEF  DEFense power  def mat;  param(4);   end               # MAT  Magic ATtack power  def mdf;  param(5);   end               # MDF  Magic DeFense power  def agi;  param(6);   end               # AGI  AGIlity  def luk;  param(7);   end               # LUK  LUcKvalue: the var.
Cool, thanks very much.

I copied this down into my notebook so if this current method I'm attempting by using skills to change enemy parameters doesn't work out I'll definitely give this a go.
using that script, you should check wether that data is consistent through savegames or not. Or you should use that to set the values anew before each battle.

I don't know what part of the editor data and database is included in the savegame and what not, and everything that is not in the savegame will revert to original values whenever a game is loaded...
using that script, you should check wether that data is consistent through savegames or not. Or you should use that to set the values anew before each battle.

I don't know what part of the editor data and database is included in the savegame and what not, and everything that is not in the savegame will revert to original values whenever a game is loaded...
The method described in that link Dark Paladin gave me is working thus far so hopefully I won't even have to go down the scripting route.  But in the event that I do end up having to use it - the values for the parameter changes would be set anew at the beginning of each battle anyways.  That's how my game's battle system currently works.   So that - at least - shouldn't be an issue for me if I understand what you are cautioning about correctly.

Edit#

I think I got it working.  Thanks to everyone who gave me a hand on this - your advice, links, and scripts were all very helpful.  Appreciate it.
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/cant-figure-out-how-to-add-variables-to-game-data.15047/