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.

- Frequently Asked Questions (Please Add To the FAQ) -

Frequently Asked Questions
RGSS/RGSS2 Support Forum


Introduction:
This topic is for questions that are frequently asked, since the beginning of the forums. Feel free to post questions you believe deserve to be put into the FAQ. The staff will add it to the main post and delete your post (to keep things clean).

If there is a topic discussing the question at hand, a link to the topic would be helpful, as it could possibly provide more support.
If someone asks for something that is in this FAQ, and you are sure of it, simply copy and paste the FAQ link in the thread. Do not say, "search for it", or anything. Just provide the link (This is to prevent confrontation).

RGSS(RMXP) Questions:
Once the FAQ has more questions, the questions will then be divided up accordingly.

Code:
  $game_temp.player_transferring = true

  $game_temp.player_new_map_id = #

  $game_temp.player_new_x = #

  $game_temp.player_new_y = #

  $game_temp.player_new_direction = #

  $scene = Scene_Map.new

  $game_map.autoplay

Code:
  $game_map.events[event_id]

Insert the following code somewhere above main:
Code:
class Game_Character

  attr_accessor :character_name

  attr_accessor :character_hue

end
Now, use this as your script call:
Code:
  $game_map.events[event_id].character_name = 'filename'

  $game_map.events[event_id].character_hue = 0..360

Code:
  key = [map_id, event_id, switch]

  $game_self_switches[key] = boolean

  $game_map.need_refresh = true
Where:
  map_id - Map Id
  event_id - Event Id
  switch - 'A', 'B', 'C', or 'D'
  boolean - true or false

Code:
# Variables

$game_variables[variable_id] = value

# Switches

$game_switches[switch_id] = boolean
Do not place 0's, such as 001, just use 1.

http://rmxp.org/forums/http://dev.rmxp.org/forums/viewtopic.php?p=126935#p126935

Code:
# Test for Number of Items

n = $game_party.item_number(item_id)

# Test for Number of Weapons

n = $game_party.weapon_number(weapon_id)

# Test for Number of Armors

n = $game_party.armor_number(armor_id)

Code:
# If On Map : Replace id with common event id

$game_temp.common_event_id = id

# If in Battle : Replace id with common event id

common_event = $data_common_events[id]

$game_system.battle_interpreter.setup(common_event.list, 0)

Code:
class Sprite_Timer < Sprite

  alias_method :sprite_timer_update, :update

  def update

    sprite_timer_update

    # Conditions to hide the timer (switch, $game_temp.in_battle etc.)

    if $game_switches[switch_id] == true

      # Hide the timer

      self.visible = false

    end

  end

end

Code:
  $game_temp.shop_goods = []

  $game_temp.shop_goods << [item_type, item_id]

  # item type = 0 : Items, 1 : Weapons, 2 : Armors

  # Repeat until you add all your items

  $scene = Scene_Shop.new

Insert the following code somewhere above main:
Code:
class Game_Character

  attr_accessor :move_speed

end
Now, to change the players move speed, use:
Code:
  $game_player.move_speed = n
To change events move speed, use:
Code:
  $game_map.events[event_id].move_speed = n

Code:
  self.contents.draw_text(x_pos, y_pos, width, height, text, align)
Align:
  0 = Left
  1 = Center
  2 = Right
By default align is set to left.

If there were no installation directions provided or the ones that were, seem vague. Do as follows. First open your project, then your script editor(F11, the shortcut key). Insert an empty section in the script listing by right clicking 'Main' and selecting 'Insert'. Copy the text from the custom script document you want to install. Paste this code that was just copied into the large empty section on the right known as the code panel. Lastly go back to the listing of script on the left and name the section something informative and memorable for the script.

A picture of where your script will most likely go:
scriptplacement.png
">install_script
RGSS2(RMVX) Questions:
If your question was found above but not below this heading than most likely the answer still applies for RGSS2.

Code:
  # What map to create?

$game_map.setup(map_id)

# Map position 

$game_player.moveto(x,  y)

$game_player.refresh

$scene = Scene_Map.new

$game_map.autoplay

Code:
  # Test for Number of Items

n = $game_party.item_number($data_items[item_id])

# Test for Number of Weapons

n = $game_party.item_number($data_weapons[weapon_id])

# Test for Number of Armors

n = $game_party.item_number($data_armors[armor_id])

Code:
  # If On Map : Replace id with common event id

  Script : $game_map.common_event_id = id

  # If in Battle : Replace id with common event id

  Script : common_event = $data_common_events[id]

  $game_troop.interpreter.setup(common_event.list, 0)

If there were no installation directions provided or the ones that were, seem vague. Do as follows. First open your project, then your script editor(F11, the shortcut key). Insert an empty section in the script listing by right clicking 'Insert Here' and selecting 'Insert'. Copy the text from the custom script document you want to install. Paste this code that was just copied into the large empty section on the right known as the code panel. Lastly go back to the listing of script on the left and name the section something informative and memorable for the script.

A picture of where your script will most likely go:
scriptplacementRGSS2.png



Format For Submitting to FAQ
Q.
Topic Link: http://www.rmxp.org/forums/


Please make questions in question format, if possible.
Please provide a link to topic, if possible.
Please use code tags when supplying code.

khmp: Cleaned up the thread. 4/24/08
 

khmp

Sponsor

rockstar1986":gpsc7tqv said:
RGSS/2:

Q. How do I read a string of text from an Item, Skill, Weapon, or Armor's Note?

Code:
# RGSS2

 

# Where item_id is the index of the item in the database view.

$data_items[ item_id ].description

 

# Where weapon_id is the index of the weapon in the database view.

$data_weapons[ weapon_id ].description

 

# Where armor_id is the index of the armor in the database view.

$data_armors[ armor_id ].description

 

# Where skill_id is the index of the skill in the database view.

$data_skills[ skill_id ].description
 
It's actually...
Code:
$data_items[item_id].note

$data_weapons[weapon_id].note

$data_armors[armor_id].note

$data_skills[skill_id].note

$data_enemies[enemy_id].note
Note that when you're changing the note at runtime, you have to use the appropriate $game handlers, instead of $data ones. In general, though, $data is preferred.

On a side note regarding that topic, there is no RGSS code for that, as there is no note field in RPG Maker XP. Also, if you plan on utilizing the note field, you might want to take a look at my Database Flag Reader, linked in my signature, which does about all the work you need unless it's for simple I/O purposes.

Also, I know this is a massive and utterly shameless necropost, but yeah... I figure I'm fighting the power for this one, as having totally useless information in a FAQ thread isn't really gonna help anyone...
 

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