&
(Anti-) Rare Candy Scriplet
by Kyonides-Arkanthos
Features
The newest version (1.0.1) now offers the possibility to create 7 different "monster areas" in any map. Please read the built in instructions to learn more about this new feature. You may also disable the script for some specific maps like Pokemon-like dungeons if deemed necessary.
Instructions
Check the script, it includes comments for a reason.
Script
Version 1.0.1
[rgss]# Grass Or Bush Scriptlet - GOBS
# by Kyonides-Arkanthos
# v 1.0.1 - 08.24.2010
# v 1.0.0 - 08.11.2010
# At the Database window on the Tilesets tab you can set some tiles
# bush flag on and / or set their terrain tag number between 1 and 7.
# This will simulate the existence of Monster Areas in your game.
# You can also let the RPG Maker XP monster encounter system work as
# usual in any (Pokemon-like) dungeons.
module GrassOrBush
# Enter all (dungeons) MapIDs where monster encounters are enabled
ENCOUNTERS_ENABLED = []
# Monsters Area : [ MapID, Terrain Tag ] => Monsters : [ Monster Troop IDs ]
MONSTERS = {
[1,1] => [1..3],
[1,2] => [4,5,6,8],
}
end
class Game_Player
def grass_or_bush?
GrassOrBush::ENCOUNTERS_ENABLED[$game_map.map_id] or
$game_map.bush?(@x, @y) or $game_map.terrain_tag(@x, @y) > 0
end
def update
# If tile has a bush flag or a grass terrain tag, encounters are allowed
$game_system.encounter_disabled = grass_or_bush? ? false : true
last_moving = moving?
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing
case Input.dir4
when 2; move_down
when 4; move_left
when 6; move_right
when 8; move_up
end
end
last_real_x = @real_x
last_real_y = @real_y
super
if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
$game_map.scroll_down(@real_y - last_real_y)
elsif @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
$game_map.scroll_left(last_real_x - @real_x)
elsif @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
$game_map.scroll_right(@real_x - last_real_x)
elsif @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
$game_map.scroll_up(last_real_y - @real_y)
end
unless moving?
if last_moving
result = check_event_trigger_here([1,2])
if result == false
# Disregard if debug mode is ON and ctrl key was pressed
unless $DEBUG and Input.press?(Input::CTRL)
# Encounter countdown will work if Encounters are allowed
if @encounter_count > 0 and !$game_system.encounter_disabled
@encounter_count -= 1
end
end
end
end
if Input.trigger?(Input::C)
check_event_trigger_here([0])
check_event_trigger_there([0,1,2])
end
end
end
end
class Game_Map
def encounter_list
tag = terrain_tag($game_player.x, $game_player.y)
monsters = GrassOrBush::MONSTERS[[@map_id, tag]]
monsters = monsters[0].to_a if monsters[0].is_a?(Range)
return monsters
end
end
[/rgss]
Version 1.0.0
[rgss]# Grass Or Bushes Scriptlet - GOBS
# by Kyonides-Arkanthos
# v 1.0.0 - 08.11.2010
# At the Database window on the Tilesets tab you can either...
# set a specific tile or tiles bush flag on
# or...
# pick a terrain tag number between 1 and 7 for one or two tiles
# If you chose the former, edit the TERRAIN_TAG value accordingly (see below)
class Game_Player
TERRAIN_TAG = 1
def tile_is_grass_or_bush?
$game_map.bush?(@x, @y) or TERRAIN_TAG == $game_map.terrain_tag(@x, @y)
end
def update
# If tile has a bush flag or a grass terrain tag, encounters are allowed
$game_system.encounter_disabled = tile_is_grass_or_bush? ? false : true
last_moving = moving?
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing
case Input.dir4
when 2; move_down
when 4; move_left
when 6; move_right
when 8; move_up
end
end
last_real_x = @real_x
last_real_y = @real_y
super
if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
$game_map.scroll_down(@real_y - last_real_y)
elsif @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
$game_map.scroll_left(last_real_x - @real_x)
elsif @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
$game_map.scroll_right(@real_x - last_real_x)
elsif @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
$game_map.scroll_up(last_real_y - @real_y)
end
unless moving?
if last_moving
result = check_event_trigger_here([1,2])
if result == false
# Disregard if debug mode is ON and ctrl key was pressed
unless $DEBUG and Input.press?(Input::CTRL)
# Encounter countdown will work if Encounters are allowed
if @encounter_count > 0 and !$game_system.encounter_disabled
@encounter_count -= 1
end
end
end
end
if Input.trigger?(Input::C)
check_event_trigger_here([0])
check_event_trigger_there([0,1,2])
end
end
end
end
[/rgss]
_____________________________________________________________
Remember I also provided you with a Rare Candy (and Anti Rare Candy) Scriptlet for your Pokemon games.
_____________________________________________________________
Features
Here you can find 2 versions of the same scriptlet that will allow you to use an item to level up or down your hero at will.
Instructions
Go to the items database and create 1 or 2 new items (just in case you want to add the Anti Rare Candy one, too). Make sure their scopes are equal to One Ally. The rest if up to you. Later copy either one of the scriptlets and testplay your game.
Scriptlets
Rare Candy Only Version
[rgss]module MoreEffects
RARE_CANDY_ID = 33
end
class Game_Battler
alias kyon_rare_candy_game_battler_item_effect item_effect
def item_effect(item)
if item.id == MoreEffects::RARE_CANDY_ID && item.scope == 3 &&
self.level < 99 && self.hp > 0
self.level += 1
return true
end
kyon_rare_candy_game_battler_item_effect(item)
end
end
[/rgss]
Rare Candy + Anti Rare Candy Version
[rgss]module MoreEffects
# IDS de Caramelo Raro, Anti Caramelo Raro
CANDIES_IDS = [33, 34]
end
class Game_Battler
alias kyon_rare_candy_game_battler_item_effect item_effect
def item_effect(item)
if ((item.id == MoreEffects::CANDIES_IDS[0] && self.level < 99) or
(item.id == MoreEffects::CANDIES_IDS[1] && self.level > 1)) &&
item.scope == 3 && self.hp > 0
self.level += item.id == MoreEffects::CANDIES_IDS[0] ? +1 : -1
return true
end
kyon_rare_candy_game_battler_item_effect(item)
end
end
[/rgss]
Rare and Anti Rare Candy Version with Restrictions
[rgss]module MoreEffects
# Rare Candy & Anti Rare Candy IDS
CANDIES_IDS = [33, 34]
LVLUPDOWN_LIMITS = [5,5]
end
class Game_Actor
include MoreEffects
alias kyon_pkmn_candies_setup setup
alias kyon_rare_candy_game_battler_item_effect item_effect
def setup(actor_id)
kyon_pkmn_candies_setup(actor_id)
@candies_limits = CANDIES_LVLUPDOWN_LIMIT
end
def item_effect(item)
if item.scope == 3 && self.hp > 0
if CANDIES_IDS.include?(item.id) && @level.between?(1, 99)
index, level = CANDIES_IDS.index(item.id), @level
return false if LVLUPDOWN_LIMITS[index] == 0
@candies_limits[index] -= 1 if LVLUPDOWN_LIMITS[index] != -1
return false if @candies_limits[index] == 0
@level += 1 if index == 0 and @level < 99
@level -= 1 if index == 1 and @level > 1
return level == @level
end
end
kyon_rare_candy_game_battler_item_effect(item)
end
end
[/rgss]
Author's Notes
Yeah, I know these are some extremely simple but useful scriptlets.