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.

variables

can some 1 give me a list or things u can store in a variable & how to store them (Mainly equipment)

also how i would say if variable 1 = 1 the bronze sword is equiped


would you put somthing like $game_variable(1)
if 1
then equip weapon id 1
 

khmp

Sponsor

You can store absolutely anything in a variable. There is no restrictive type declarations within Ruby.
Code:
a = File.new('Toast.txt')
a.close
a = 'Toast'
a = Toast.class
a = :toast
a = 5
a = toast = 'toast'

Code:
class Game_Actor
  def weapon_equipped?(id)
    return @weapon_id == id
  end
end

Let's say you want to test the party leader's weapon against a bronze sword. Well first you would need to know what number the bronze sword is in the database. In a new project it is 1. So the test for whether the leader has a bronze sword equipped would be:
Code:
if $game_party.actors[0].weapon_equipped?(1)
  # Yes the leader has the bronze sword equipped.
else
  # No the leader doesn't have the bronze sword equipped.
end
 
still a question i would like to try & make 1 myself if i cant might request 1 later


or would it be as easy as storing weapons in slot variables & useing thos variables to equip weapns
 

khmp

Sponsor

Asking where to start with something like this is very involving. It sounds like you want to create an entirely new scene where you present the weapons with the choice of equipping and showing which players can and can not use them. And if not a new scene than severe edits to Scene_Menu/Scene_Equip. This is a very involving task for someone who just asked what variables could hold. Its definitely not something I would suggest, for someone who is new to Ruby/RGSS, to start with. Start small and simple. Reading some beginner tutorials on Ruby/RGSS. Creating a HUD or a Sprite object when you're on the map. Then move into a creating a custom Scene work.

Good luck with it Nathmatt! :thumb:
 
im not completly new to rgss i knew you could store all kinds of things under varible but was sure of the method to store them i know how to edit scripts some

i know its somthink like $game_variable(1)

also i dont think you would need to modify scene equip much would have the slot open scene eqip & tell it to store that weapon under the variable number & as far as scene menu no because was goint to use a key to call it not add it to the menu wouldnt make much sice to make 1 if it was in the menu
 
nvm decided to just request 1 thought that u would have to edit equip so u could add the weapon to the menu or every time u tryed to use the weapon it would take you to the equip screen
 

khmp

Sponsor

Nathmatt":3crknen7 said:
im not completly new to rgss i knew you could store all kinds of things under varible but was sure of the method to store them i know how to edit scripts some

i know its somthink like $game_variable(1)

also i dont think you would need to modify scene equip much would have the slot open scene eqip & tell it to store that weapon under the variable number & as far as scene menu no because was goint to use a key to call it not add it to the menu wouldnt make much sice to make 1 if it was in the menu

$game_variables is an array so access its indexes with brackets not parenthesis.

You would need to edit Scene_Equip unless you would want to be able to remove and equip weapons through that scene still.
 

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