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.

(thinking about...) Weapon Customization -- FFX

Aran

Member

I want to make a Weapon Customization Script, but am not sure how. That's why instead of creating a number of ridiculous threads in the form of contests or discussions, I'll just quit bullshittin and ask here XD.

Now:
1.) What would the difficulty of such a script be? Let's say... on a scale of 1-10.

2.) How would I go about doing this? Should I use a module? why (or why not?) Should I go into the RPG::Weapon/Armor class and add an empty array labeled customs?

3.) How would I go about making the customization abilities? Should I use a hash? can you handle it (result, required items, required items quantity) with a hash?
 
It shouldn't be too hard. But don't add the customizations to the RPG module classes, as they don't get saved in save files. You probably should make a Game_Weapon class or something, and make it save in save files.
 
He wants to -make- the script.

Aran: Well explain what you want this 'weapon customization' script to do. If you want it so you can use money/items to alter the statistics of a weapon, you're in for a bit of work.

Mainly because the $data_weapons array is initialized based on information in the database (namely the .rxdata file that coresponds with the weapons from the database). Your best bet would be that whenever a weapon is put in the players inventory, create a copy of the information in $data_weapons at the id of the weapon (lets say 1 for the Bronze Sword), and push it into a new array (something like $game_weapons), assign it a new ID, and use that ID and that instance of RPG::Weapon to alter and such. The big problems that come up here are mainly duplicate items with the same ID, and stacking items in the database, but its not too terribly complicated to figure out. Regardless, it'd take more than I can type here to explain it all to you.
 
8-9 for most people, as most have no clue how to go about this the right way.


Modifing 1 weapon modifies all weapons of that object, so what you have to do is add to new weapons to your $data_weapons, but what you have to do is use something like my Virtual Database script that allows you to modify that array for each game session.

@Daniel: What? You can modify the methods in RPG::Whatever, but you cannot modify the initialize method. All other methods are open for modification. What happens is something like this:

You create your stuff in the database, and when you save, it saves the each objects into the .rxdata files. Which is why when you load them, the initialize method is never called because the objects have already been created.

Everyother time, when calling a method like price from RPG::Item, the RGSS Library is loaded with the game, then everything from the script editor, saving all mods to the default methods.
 
He could look through the script and see what they did to get an idea of how it works. Think of it as a kind of cheat sheet. As soon as I learn enough RGSS, I will be able to rewrite a few scripts with nothing more than just looking at them. of course it would be a waste since they already exist, but its practice for me
 

Aran

Member

@Prexus: Well, one, what you're talking about with altering it with money, sounds more like Star Ocean: Till the End of Time, while I am just thinking about the FFX customization where you can add effects such as: Poisonproof, Fire Eater, STR +10%, etc. But of course, where you're talking about creating a duplicate you mean by using .clone, correct? But thanx for the tutorial.

@Twiligiht: I know it's been done, but like Seph said, I would like to make my own. And I'd rather not use a cheat sheet, because then i don't learn as much. Plus, when you make your own script you tend to know its methods and basic functions easily.

@SephirothSpawn: I'm sorry but I don't know what your Virtual Database is (yet...)

But what I've gathered so far is: don't bother the RPG module at all.
 
No no no. Do modify the methods if you need, but nothing will happen if you modify the initialize method.

I would use .dup, as I never use .clone as I think it has something to do with modifing the "cloned" object affects the original object sometimes. I always have problems with it. :P

The Virtual Database script I made basically allows you to modify the $data objects mid-game, and saves them from game to game. I made it by request, and that I had full on plans to use it for a Smithery / FFX customization script myself.

Anyways, the data structure classes like RPG::Weapon are basically just plain old blank object classes with nothing more than accessors.

Code:
class Boring
  attr_accessor :id
  attr_accessor :name
  # ...
end

So all you really have to do is modify each objects attributes. So before you do this, know what every attribute does for the weapon, and how Game_Battler and other classes use these attributes to determine stuff.
 

Aran

Member

Yes. I do believe that to create a script like this I'll have to modify Game_Battler, correct? as Scene_Battle uses Game_Battler to determine defense, attack, status alignments, etc. right?
 
Nope.

The only thing it actually requires is creating new RPG::Weapons and adding them to the $data arrays.

Code:
new_weapon = RPG::Weapon.new
new_weapon.id = $data_weapons.size
new_weapon.name = 'Blah Weapon'
# etc.

$data_weapons << new_weapon

# Then here, you could do something like my virtual database and refresh it so it will reload the $data objects when you load a game.
 
See Seph when I do it, I usually create an array called $game_weapons/armors/items etc. and send a modified version of the RPG:: object out of the $data_ array to the $game_ array and then marshal dump that with the save file.
 
@Prexus: I know. That is what I usually do as well. That's basically all the virtual database script does. It creates a $game with all the $data classes duplicated as atributes, and modifing those directly modifies the $data classes, and when you load, it refreshes the $data arrays from the $game_virtualdatabase.

The version I posted takes up entirely too much memory, as the new version of it on my laptop on records the changes done to the database, and not 100% copies of each $data array.

It prevents making $game_items, $game_weapons, $game_skills, etc. and making 1 $game_database.

@Aran: Creating custom skills does the exact same thing.
 

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