Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[RMXP] Changing skill/item parameters through variables?

[RMXP]

I have a question on the parameters of skills and items in the database. In the database you have to insert set values, etc. Do you know how to change this (probably in script) with a variable?

Like: skill28.damage += $game_variables[xx]. Something like that. Of course it's completely wrong and "skill28" doesn't exist, but I hope you get what I mean. ^_^

Thank you for your time!

(Note: I'm not very good at arrays and hashes, so if you refer to something like that, please give an example. ^^; )
 

khmp

Sponsor

After Scene_Title.main it's alright to use the following code:
$data_skills[n].x =

Where n is the ID of the skill in the database.

Where x can be:
RMXP Readme":2804tlgl said:
id
The skill ID.

name
The skill name.

icon_name
The skill's icon graphic file name.

description
The skill description.

scope
Scope of the skill's effects (0: none, 1: one enemy, 2: all enemies, 3: one ally, 4: all allies, 5: 1 ally--HP 0, 6: all allies--HP 0, 7: the user).

occasion
When the skill may be used (0: always, 1: only in battle, 2: only from the menu, 3: never).

animation1_id
The animation ID when using the skill.

animation2_id
The animation ID when on the receiving end of the skill.

menu_se
SE played when skill is used on the menu screen (RPG::AudioFile).

common_event_id
The Common Event ID.

sp_cost
Number of SP consumed.

power
The skill's power.

atk_f
The skill's attack power F rating.

eva_f
The skill's evasion F rating.

str_f
The skill's strength F rating.

dex_f
The skill's dexterity F rating.

agi_f
The skill's agility F rating.

int_f
The skill's intelligence F rating.

hit
The skill's hit probability.

pdef_f
The skill's physical defense F rating.

mdef_f
The skill's magic defense F rating.

variance
The skill's degree of variance.

element_set
The skill's element. An Elemental ID array.

plus_state_set
States to add. A State ID array.

minus_state_set
States to cancel. A State ID array.

You want to be playing with the skill's "power" value. You might also want to affect the F values. Those affect the strength of the skill based on the user's statistic that precedes the _f. A user with a high strength will do better with a skill with a higher than normal str_f.

Good luck with it Twin Matrix! :thumb:
 
Ooh, interesting. Thank you very much great lord of helping scripting newbies! *bows*

I'll have to mess around a bit with this, hehe.~

Edit: Ow, one thing: Does the game remember script variables, etc.? If I say "$bla = 5", go into a different Scene, save the game and restart, will it remember that $bla = 5?
 

khmp

Sponsor

Nope not any kind of variable(global, class, instance, local). And you'd be really pissed if it did. We'd call it a memory leak. Just imagine that if you made a global variable in a program and then closed said program, it just hung around your system asking for money from the more efficient programs. No instead you need to save the data to a file for anything to be stored between program closes and startups. Now if you can figure a way to sneak it into a $game_variables object that would work because they are saved whenever the player saves a game. Otherwise you'll have to write some code to save your variable:
Code:
file = File.open('settings.tix', 'wb')
Marshal.dump($bla, file)
file.close

Good luck with it Twin Matrix! :thumb:
 

khmp

Sponsor

Yes game variables are saved:
Now if you can figure a way to sneak it into a $game_variables object that would work because they are saved whenever the player saves a game.

Now there might be a miscommunication on my part. When I think of restart I imagined closing and reopening the game. Now I think that you meant loaded a different game. Globals hang around during the program's execution. So if you start the game, load a save. Alter the global. Load a different save the global will be the same. My apology for giving you the thought it wouldn't.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top