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.

Equipment typing in script...

Basically, you know how in scripts like Scene_Battle, you can say things such as if @active_battler.is_a?(Game_Actor). What I want to do is be able to say something like if @weapon.is_a?(Sword) or something along those lines, and then have it return true if the IDs match. Is this possible? Thanks in advance for any help.


Edit: I'll rephrase this now I've gone and improved my game. Basically what I have is, each character has an array called "equip_type". In this array is a collection of numbers from 0-15, each number represents a class of equipment. So using this I can have characters individually learn how to use items, like this:

http://img221.imageshack.us/img221/6622 ... enuyn9.png[/img]


But the problem is, they equip things based on their class. Is there a way that I can make it so if my equip_array includes 0, I can equip weapons with ID 1, 2, 3 and 4? Hope this makes more sense.
 
In order to do this, you will need to modify the equipable?() method under Game_Actor.

Currently it simply looks to see if the class_id of the current character includes the item (in which you are trying to equip) id. If it does, it returns true, else false.

You can replace this method using if statements to check your array and return true. The only problem with this is the item doesnt know what class of weapon/armor/item is really is, thus you would have to create a full ID list or make modifications to the default class(which would be the way I would do it). Anyway, good luck with this.
 
Gubid;307869 said:
In order to do this, you will need to modify the equipable?() method under Game_Actor.

Currently it simply looks to see if the class_id of the current character includes the item (in which you are trying to equip) id. If it does, it returns true, else false.

You can replace this method using if statements to check your array and return true. The only problem with this is the item doesnt know what class of weapon/armor/item is really is, thus you would have to create a full ID list or make modifications to the default class(which would be the way I would do it). Anyway, good luck with this.



Thanks for that info! It seems that finding that equippable? method is easy enough, but bearing in mind I scripted that entire screenshot, I think I might be able to edit straight into the default class. Where is this class, though? Thanks again.

EDIT: Ok I did the ID checking method, and it works fine now! Thanks.
 

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