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

Status
Not open for further replies.

Berylstone

Veteran
Veteran
Joined
Jun 3, 2013
Messages
642
Reaction score
62
First Language
English
Primarily Uses
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]
 
Last edited by a moderator:

Death10

;D
Member
Joined
Jul 18, 2012
Messages
29
Reaction score
5
First Language
Vietnamese
Primarily Uses
edited.
 
Last edited by a moderator:

Dark Paladin

Game Designer
Veteran
Joined
Jul 10, 2012
Messages
165
Reaction score
10
First Language
English
Primarily Uses
RMMV
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.
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,366
Reaction score
7,676
First Language
German
Primarily Uses
RMMV
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...
 

Berylstone

Veteran
Veteran
Joined
Jun 3, 2013
Messages
642
Reaction score
62
First Language
English
Primarily Uses
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. 
 
Last edited by a moderator:

Death10

;D
Member
Joined
Jul 18, 2012
Messages
29
Reaction score
5
First Language
Vietnamese
Primarily Uses
It has a bug.

I will post it again when I fixed it.
 

Berylstone

Veteran
Veteran
Joined
Jun 3, 2013
Messages
642
Reaction score
62
First Language
English
Primarily Uses
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.
 

Death10

;D
Member
Joined
Jul 18, 2012
Messages
29
Reaction score
5
First Language
Vietnamese
Primarily Uses
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.
 

Berylstone

Veteran
Veteran
Joined
Jun 3, 2013
Messages
642
Reaction score
62
First Language
English
Primarily Uses
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.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,366
Reaction score
7,676
First Language
German
Primarily Uses
RMMV
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...
 

Berylstone

Veteran
Veteran
Joined
Jun 3, 2013
Messages
642
Reaction score
62
First Language
English
Primarily Uses
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.
 
Last edited by a moderator:

Celianna

Tileset artist
Veteran
Joined
Mar 1, 2012
Messages
10,557
Reaction score
5,592
First Language
Dutch
Primarily Uses
RMMV
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.
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,081
Members
137,582
Latest member
Spartacraft
Top