Jump to content

Recommended Posts

Okay.... then how do you set it to where you can activate an event from any side?

Share this post


Link to post
Share on other sites

It should do that by default... I'm not quite getting what you mean? If it collides with an event it will activate it. Check to make sure you set up your collision detection for your new tools in this method: csca_check_collision(event)

Share this post


Link to post
Share on other sites

Here's what I've done to the coding.  For some reason in region 15, it only activates events from the right hand side, while in region 14 it only activates from the right hand side.  It's probably a simple line of coding I didn't think to add/change.  But if you get a chance can you look at it and tell me what I'm doing wrong?

 

 

=begin
CSCA Dungeon Tools
version: 1.4b
Created by: Casper Gaming (http://www.caspergaming.com/)

Compatibility:
Made for RPGVXAce
IMPORTANT: ALL CSCA Scripts should be compatible with each other unless
otherwise noted.
REQUIRES CSCA Core Script
================================================================================
UPDATE HISTORY:

Version 1.1
-Fixed boomerang misspelling
-Aliased a few more things
-Bomb is now seperate from other tools, as in you can use other tools while a
bomb is planted. However, you're still limited to 1 sonic/arrow/hookshot/boomerang
at one time.
-Tool events are now designated by comments rather than entering a predefined
event id in the module.

Version 1.2
-Fixed bug that occured if a map didn't have dungeon tool events set up.
-Fixed bug that caused a crash if any event on the map had no event pages with
met conditions.

Version 1.3
-Added ability to hold a button down to turn in the direction pressed instead
of moving. This is able to be done at all times.
-Fixed reset bug
-Added ability to require the player has items to use some tools. For example,
the player might need an arrow in their inventory to use the arrow tool.
-Increased compatibility by aliasing more stuff.

Version 1.3b
- Changed some stuff for compatibility with CSCA Menu Organizer.

Version 1.4
- Damage floor now doesn't damage the player when hookshotting over it.
- Added a new region, similar to region 1 but only functions if a switch is ON.

Version 1.4b
- Region ID 1 will no longer allow tools to go through events. Use the other
regions for this effect. (Toggleable).
================================================================================

FFEATURES:
This script allows you to enable/disable use of pre-made "dungeon tools" easily
with switches. The pre-made tools include: Reset, Arrow, Bomb, Hookshot, Boomarang.
Each tool behaves slightly differently, and it is recommended to download
the demo to get a better understanding of how each tool works.

RESET: Resets the map to how it was when you entered. This option will NOT turn
switches/variables back to their original value, but it will turn self
switches to false unless RESET_EXEMPT is put in the event page of an event. It
also transfers the player to where they were originally after the previous
transfer.

ARROW: Shoots an arrow in the direction you're facing. When it hits an event, if
the event has ARROW_ACTIVATE in a comment event command, it will activate the
next self switch. If no self switch is on, it will turn A on. If A is on, B will
be turned on, etc.

BOMB: Sets a bomb down where the player is standing. When the player steps a
specified amount of times, the bomb blows up, activating the next self switche of
events underneath it, as well as directly above/below, and to the right/left.
The self switches are only turned on if BOMB_ACTIVATE is in their event page in
a comment command.

HOOKSHOT: Shoots a hookshot in the direction of the player. If it connects with
an event that has HOOKSHOT_ENABLED in a comment event command, it will move the
player to that event, even if there are impassable tiles in between. If no
event is hit, or the event does not have the comment command, the hookshot
returns to the player.

BOOMARANG: Shoots a boomarang, which can collect one item at a time(requires
some eventing, shown in demo). If the boomarang flies over an event with the
comment command BOOMARANG_ACTIVATE, it will turn on that event's next self switch.

SETUP
This script requires setup further down. It is important that you do not allow
the player to reset the map before they have transferred once(by using the Transfer
event command), as this script assumes a transfer has already happened.

SETTING UP YOUR EVENTS:
Each map where you plan to use these tools MUST have an event with the comment
BOMB_TOOL inside, as well as an event with the comment DUNGEON_TOOL inside. The
BOMB_TOOL event will act as the bomb, and the DUNGEON_TOOL will act as all other
tools. Case Matters. Make sure you set the through/priority/stepping animation
settings in the event page how you want them, as this script does not
automatically do that. If you get a undefined method error, chances are you have
set your events up incorrectly.

On maps that do not have these events(any map that you do not want to use these
tools on), it is very important to turn the ON_OFF switch OFF. Remember to turn
it back ON for maps where these tools will be used, though!

IMPORTANT! If you do not understand how to do some things, please download the
demo to see each item properly used.

CREDIT:
Free to use in noncommercial games if credit is given to:
Casper Gaming (http://www.caspergaming.com/)

To use in a commercial game, please purchase a license here:
http://www.caspergaming.com/licenses.html

TERMS:
http://www.caspergaming.com/terms_of_use.html
=end
module CSCA_DUNGEON_TOOLS # Don't touch this.

ON_OFF = 12 # Switch ID. Turns this whole script on/off.

# Trigger name Key on keyboard
# :A = Shift
# :B = X
# :C = Z
# :X = A
# :Y = S
# :Z = D
# :L = Q
# :R = W
TRIGGER = :R # Which button do you want to bring up the tool select menu?
USETOOL = :X # Which button do you want to use a tool?

STILL_TRIGGER = :L # Which button do you want the player to hold to turn
# without moving?
ENABLE_STILL = true # Allow the player to hold a button to turn without moving?

# Dungeon Tools. If you don't want to use one, simply leave it's switch OFF.
SONIC = 18 # Switch ID. Turn ON to allow selection of the sonic.
ARROW = 13 # Switch ID. Turn ON to allow selection of the arrow.
BOMB = 14 # Switch ID. Turn ON to allow selection of the bomb.
HOOKSHOT = 15 # Switch ID. Turn ON to allow selection of the hookshot.
BOOMERANG = 16 # Switch ID. Turn ON to allow selection of the boomarang.
RESET = 17 # Switch ID. Turn ON to allow selection of the reset option.

# Names. This is all text shown in game in the selection window.
SONIC_NAME = "Sonic Screw Driver" # Name of the Sonic tool.
ARROW_NAME = "Arrow" # Name of the Arrow tool.
BOMB_NAME = "Bomb" # Name of the Bomb tool.
HOOKSHOT_NAME = "Hookshot" # Name of the Hookshot tool.
BOOMERANG_NAME = "Boomerang" # Name of the Boomarang tool.
RESET_NAME = "Reset" # Name of the Reset tool.
HEADER = "Tools" # Name of the selection window.

# Icons. These icons will be shown next to the similarly named tools.
SONIC_ICON = 416 # Icon displayed next to the Sonic text.
ARROW_ICON = 427 # Icon displayed next to the Arrow text.
BOMB_ICON = 223 # Icon displayed next to the Bomb text.
HOOKSHOT_ICON = 157# Icon displayed next to the Hookshot text.
BOOMERANG_ICON = 154 # Icon displayed next to the Boomarang text.
RESET_ICON = 351 # Icon displayed next to the Reset text.

CSCADGT = 3 # Variable ID. By setting this in-game you can force use of some
# tools. 1 sets to sonic, 2 sets to arrow, 3 to bomb, 4 to hookshot, 5 to boomarang.
# If set to 6, the map will automatically reset and set this to 0,
# so setting this variable's value to 6 requires some caution.

REGION_ID1 = 1 # Region ID. Sonic/Arrow/hookshot/boomarang can always move when in
# this region, no matter if the map tile is passable or not.
# However, the sonic/arrow/hookshot will not be able to activate
# events while in this region ID either.
REGION_ID2 = 2 # Region ID. Sonic/Arrow/hookshot/boomarang can always move when in
# this region IF it is facing down.
REGION_ID3 = 3 # Region ID. Sonic/Arrow/hookshot/boomarang can always move when in
# this region IF it is facing left.
REGION_ID4 = 4 # Region ID. Sonic/Arrow/hookshot/boomarang can always move when in
# this region IF it is facing right.
REGION_ID5 = 5 # Region ID. Sonic/Arrow/hookshot/boomarang can always move when in
# this region IF it is facing up.
REGION_ID6 = 6 # Region ID. Sonic/Arrow/hookshot/boomarang can always move when in
# this region IF it is facing up OR left
REGION_ID7 = 7 # Region ID. Sonic/Arrow/hookshot/boomarang can always move when in
# this region IF it is facing up OR right
REGION_ID8 = 8 # Region ID. Sonic/Arrow/hookshot/boomarang can always move when in
# this region IF it is facing down OR left
REGION_ID9 = 9 # Region ID. Sonic/Arrow/hookshot/boomarang can always move when in
# this region IF it is facing down OR right
REGION_ID10 = 10 # Region ID. Sonic/Arrow/hookshot/boomarang can always move when in
# this region IF it is facing up OR down.
REGION_ID11 = 11 # Region ID. Sonic/Arrow/hookshot/boomarang can always move when in
# this region IF it is facing left OR right
REGION_ID12 = 12 # Region ID. Sonic/Arrow/hookshot/boomarang can always move when in
# this region IF it is facing left OR right OR up
REGION_ID13 = 13 # Region ID. Sonic/Arrow/hookshot/boomarang can always move when in
# this region IF it is facing left OR right OR down
REGION_ID14 = 14 # Region ID. Sonic/Arrow/hookshot/boomarang can always move when in
# this region IF it is facing up OR down OR left
REGION_ID15 = 15 # Region ID. Sonic/Arrow/hookshot/boomarang can always move when in
# this region IF it is facing up OR down OR right


REGION_ID16 = 16 # Region ID. Sonic/Arrow/hookshot/boomarang can always move when in
# this region IF REGION_SWITCH is ON. Useful for multi-level
# areas.

REGION_SWITCH = 1 # Turns region ID 16 on.

R1_EVENTS = false # Allow region ID 1 to move through events?

FILENAME = "CSCA_DT2" # Filename of the character sheet containing your bomb,
# arrow, hookshot, and boomarang graphics. This should
# be placed in Graphics/Characters.

# File indexes. Character graphic files are laid out like so:
# [0,1,2,3]
# [4,5,6,7]
# Where each number corresponds to the spot on the character sheet.
SONIC_INDEX = 5 # Index of the sonic graphic in the previously specified file.
ARROW_INDEX = 1 # Index of the arrow graphic in the previously specified file.
BOMB_INDEX = 0 # Index of the bomb graphic in the previously specified file.
HOOKSHOT_INDEX = 3 # Index of the hookshot graphic in the previously specified
# file.
BOOMERANG_INDEX = 2 # Index of the boomarang graphic in the previously
# specified file.

SONIC_DIST = 3 # Amount of spaces you want the sonic to travel.
ARROW_DIST = 8 # Amount of spaces you want the arrow to travel.
BOOMERANG_DIST = 6 # Amount of spaces the boomarang will travel before returning
# to you.
HOOKSHOT_DIST = 4 # Amount of spaces the hookshot will travel before returning
# to you.
STEP_AMOUNT = 6 # Amount of steps required for bomb to explode.

BOMB_ANIMATION_ID = 126 # Bomb explosion animation id.
BOMB_ANIMATION_TIME = 36 # Bomb explosion animation length in frames. To get
# this, multiply the highest number in the animation's
# frame list by 4.

# All sound files are located in your Audio/SE/ folder.
SONIC_SHOOT_SOUND = "Recovery" # Plays when sonic shoots, if enabled.
SONIC_HIT_SOUND1 = "Magic1" # Plays when sonic hits event, if enabled.
SONIC_HIT_SOUND2 = "Magic2" # Plays when sonic hits non-event, if enabled.
ARROW_SHOOT_SOUND = "Bow1" # Plays when arrow shoots, if enabled.
ARROW_HIT_SOUND1 = "Damage1" # Plays when arrow hits event, if enabled.
ARROW_HIT_SOUND2 = "Shot2" # Plays when arrow hits non-event, if enabled.
BOMB_PLACEMENT_SOUND = "Cursor1" # Sound file to play when bomb is planted.
HOOKSHOT_USE_SOUND = "Saint3" # Sound file to play when hookshot is used.
BOOMERANG_USE_SOUND = "Darkness2" # Sound file to play when boomarang thrown.

# Choose whether or not each sound file plays.
SONIC_SOUND1 = true # Play SONIC_SHOOT_SOUND ?
SONIC_SOUND2 = true # Play sound when sonic collides with event ?
SONIC_SOUND3 = true # Play sound when sonic collides with non-event ?
ARROW_SOUND1 = true # Play ARROW_SHOOT_SOUND ?
ARROW_SOUND2 = true # Play sound when arrow collides with event ?
ARROW_SOUND3 = true # Play sound when arrow collides with non-event ?
BOMB_SOUND1 = true # Play BOMB_PLACEMENT_SOUND ?
HOOKSHOT_SOUND1 = true # Play hookshot use sound ?
BOOMERANG_SOUND1 = true # Play boomarang throw sound ?


# Setting this to true will require the player to have the items specified
# below in thier inventory or else the tool will not be used. This will also
# subtract one of that item upon use of that tool.
REQUIRE_ITEMS_C = false # Require an item to use sonic?
REQUIRE_ITEMS_B = false # Require an item to use bombs?
REQUIRE_ITEMS_A = false # Require an item to use arrows?

# The following item ID's are the items that determine whether a tool is usable.
# For example, if the palyer know how to use bombs, but has no bombs in their
# inventory, the bomb tool will be unusable. Only works if REQUIRE_ITEMS is true.
BOMB_ITEM_ID = 1 # Item ID. This item will be used when the Bomb Tool is used.
ARROW_ITEM_ID = 2 # Item ID. This item will be used when the Arrow Tool is used.
SONIC_ITEM_ID = 3 # Item ID. This item will be used when the Sonic Tool is used.

# Text displayed when a tool is used, but the player doesn't have the required
# item specified above in their inventory. This feature only happens if
# REQUIRE_ITEMS is set to true.
NO_ITEM_TEXT = "You don't have any %ss!"

end # END SETUP. Don't touch this or anything below.
$imported = {} if $imported.nil?
$imported["CSCA-DungeonTools"] = true
msgbox('Missing Script: CSCA Core Script! CSCA Dungeon Tools requires this
script to work properly.') if !$imported["CSCA-Core"]
class Game_CharacterBase
include CSCA_DUNGEON_TOOLS

def csca_change_graphic(character, type)
case type
when 1
character.set_graphic(FILENAME, SONIC_INDEX)
when 2
character.set_graphic(FILENAME, ARROW_INDEX)
when 3
character.set_graphic(FILENAME, BOMB_INDEX)
when 4
character.set_graphic(FILENAME, HOOKSHOT_INDEX)
when 5
character.set_graphic(FILENAME, BOOMERANG_INDEX)
else
character.set_graphic("", 0)
end
end

def csca_change_move_speed(speed)
@move_speed = speed
end

def csca_change_through(t_f)
@through = t_f
end

end
class Scene_Map < Scene_Base
include CSCA_DUNGEON_TOOLS

alias csca_update update_scene
def update_scene
csca_update
csca_update_dt unless $game_map.interpreter.running?
csca_call_dts unless scene_changing? || $game_map.interpreter.running?
end

def csca_call_dts
if Input.press?(TRIGGER) && $game_switches[ON_OFF] && csca_check_tools
Sound.play_ok
SceneManager.call(CSCA_Scene_DungeonToolSelect)
end
end

def csca_check_tools
return $game_switches[sONIC] || $game_switches[ARROW] || $game_switches[bOMB] ||
$game_switches[HOOKSHOT] || $game_switches[bOOMERANG] ||
$game_switches[RESET]
end

def csca_update_dt
if Input.press?(USETOOL) && $game_switches[ON_OFF]
use_sonic if $game_variables[CSCADGT] == 1
use_arrow if $game_variables[CSCADGT] == 2
use_bomb if $game_variables[CSCADGT] == 3
use_hookshot if $game_variables[CSCADGT] == 4
use_boomarang if $game_variables[CSCADGT] == 5
end
end

def use_sonic
$game_map.use_sonic unless $game_map.using_tool?
end

def use_arrow
$game_map.use_arrow unless $game_map.using_tool?
end

def use_bomb
$game_map.use_bomb unless $game_map.using_bomb? || $game_map.anime_playing?
end

def use_hookshot
$game_map.use_hookshot unless $game_map.using_tool?
end

def use_boomarang
$game_map.use_boomarang unless $game_map.using_tool?
end

end
class Game_Map
include CSCA_DUNGEON_TOOLS

alias csca_map_update update
def update(main)
csca_map_update(main)
csca_reset if $game_variables[CSCADGT] == 5
csca_update if using_tool? || using_bomb?
csca_sonic_finish if done_moving? && @tooltype == :sonic
csca_arrow_finish if done_moving? && @tooltype == :arrow
csca_boomarang_finish if done_moving? && @tooltype == :boomarang
csca_hookshot_finish if done_moving? && @tooltype == :hookshot
end

def csca_update
csca_check_through if @tooltype == :sonic || @tooltype == :arrow || @tooltype == :boomarang || @tooltype == :hookshot
csca_check_steps if using_bomb?
csca_check_pickup if @tooltype == :boomarang && !pickup?
end

def csca_check_through
csca_get_event
d = @csca_event.direction
x = @csca_event.x
y = @csca_event.y
case d
when 2; y += 1
when 4; x -= 1
when 6; x += 1
when 8; y -= 1
end
block_event = events_xy_nt(x, y)
if ((region_id(@csca_event.x, @csca_event.y) == REGION_ID1) && (block_event == [] || R1_EVENTS)) ||
(d == 2 && region_id(@csca_event.x, @csca_event.y) == REGION_ID2) ||
(d == 4 && region_id(@csca_event.x, @csca_event.y) == REGION_ID3) ||
(d == 6 && region_id(@csca_event.x, @csca_event.y) == REGION_ID4) ||
(d == 8 && region_id(@csca_event.x, @csca_event.y) == REGION_ID5) ||
((d == 8 || d == 4) && region_id(@csca_event.x, @csca_event.y) == REGION_ID6) ||
((d == 8 || d == 6) && region_id(@csca_event.x, @csca_event.y) == REGION_ID7) ||
((d == 2 || d == 4) && region_id(@csca_event.x, @csca_event.y) == REGION_ID8) ||
((d == 2 || d == 6) && region_id(@csca_event.x, @csca_event.y) == REGION_ID9) ||
((d == 2 || d == 8) && region_id(@csca_event.x, @csca_event.y) == REGION_ID10) ||
((d == 4 || d == 6) && region_id(@csca_event.x, @csca_event.y) == REGION_ID11) ||
((d == 4 || d == 6 || d == 8) && region_id(@csca_event.x, @csca_event.y) == REGION_ID12) ||
((d == 4 || d == 6 || d == 2) && region_id(@csca_event.x, @csca_event.y) == REGION_ID13) ||
((d == 2 || d == 8 || d == 4) && region_id(@csca_event.x, @csca_event.y) == REGION_ID14) ||
((d == 2 || d == 8 || d == 6) && region_id(@csca_event.x, @csca_event.y) == REGION_ID15) ||
($game_switches[REGION_SWITCH] && region_id(@csca_event.x, @csca_event.y) == REGION_ID16) ||
@hookshot_reverse_dir == true
@csca_event.csca_change_through(true)
else
@csca_event.csca_change_through(false)
end
end

def csca_check_steps
@bombsteps2 = $game_party.steps
@bombsteps1 = @bombsteps
@bombsteps2 -= @bombsteps1
if @bombsteps2 >= STEP_AMOUNT
bomb_explode(@csca_bomb_event)
end
end

def csca_check_pickup
x = @csca_event.x
y = @csca_event.y
d = @csca_event.direction
case d
when 2; y -= 1
when 4; x += 1
when 6; x -= 1
when 8; y += 1
end
@csca_event_id = event_id_xy(x, y)
if @csca_event_id != 0
csca_get_collision_event(@csca_event_id)
csca_check_comment(@csca_collision_event, 2)
end
end

def bomb_explode(event)
@waitforanimation = true
@bombplanted = false
event.animation_id = BOMB_ANIMATION_ID
do_bomb_effect(event)
csca_clear_ok?(event)
end

def do_bomb_effect(bomb)
x = bomb.x
y = bomb.y
@csca_bomb_event_id5 = event_id_xy(x, y)
x += 1
@csca_bomb_event_id1 = event_id_xy(x, y)
x -= 2
@csca_bomb_event_id2 = event_id_xy(x, y)
x = bomb.x
y += 1
@csca_bomb_event_id3 = event_id_xy(x, y)
y -= 2
@csca_bomb_event_id4 = event_id_xy(x, y)
if @csca_bomb_event_id1 != 0
get_bomb_explode_event(@csca_bomb_event_id1)
csca_check_comment(@csca_bomb_explode_event, 5, 1)
end
if @csca_bomb_event_id2 != 0
get_bomb_explode_event(@csca_bomb_event_id2)
csca_check_comment(@csca_bomb_explode_event, 5, 2)
end
if @csca_bomb_event_id3 != 0
get_bomb_explode_event(@csca_bomb_event_id3)
csca_check_comment(@csca_bomb_explode_event, 5, 3)
end
if @csca_bomb_event_id4 != 0
get_bomb_explode_event(@csca_bomb_event_id4)
csca_check_comment(@csca_bomb_explode_event, 5, 4)
end
if @csca_bomb_event_id5 != 0
get_bomb_explode_event(@csca_bomb_event_id5)
csca_check_comment(@csca_bomb_explode_event, 5, 5)
end
end

def get_sonic_success_coords(event)
x = event.x
y = event.y
d = event.direction
case d
when 2; y += SONIC_DIST
when 4; x -= SONIC_DIST
when 6; x += SONIC_DIST
when 8; y -= SONIC_DIST
end
@csca_success_x = x
@csca_success_y = y
end

def csca_finish_move_route
@csca_dt_done_moving = true
end

def csca_sonic_finish
csca_get_event
if @csca_event.x == @csca_success_x && @csca_event.y == @csca_success_y
csca_clear_event
else
csca_check_collision(@csca_event)
end
end

def get_arrow_success_coords(event)
x = event.x
y = event.y
d = event.direction
case d
when 2; y += ARROW_DIST
when 4; x -= ARROW_DIST
when 6; x += ARROW_DIST
when 8; y -= ARROW_DIST
end
@csca_success_x = x
@csca_success_y = y
end

def csca_finish_move_route
@csca_dt_done_moving = true
end

def csca_arrow_finish
csca_get_event
if @csca_event.x == @csca_success_x && @csca_event.y == @csca_success_y
csca_clear_event
else
csca_check_collision(@csca_event)
end
end

def csca_boomarang_finish
$game_party.leader.hp -= 1
csca_clear_event
end

def csca_hookshot_finish
csca_clear_event
end

def csca_hookshot_check
csca_check_collision(@csca_event)
end

def use_sonic
if $game_party.has_item?($data_items[sONIC_ITEM_ID]) || !REQUIRE_ITEMS_C
@tooltype = :sonic
csca_get_event
csca_event_setup(@csca_event)
@csca_event.csca_change_graphic(@csca_event, 1)
@csca_event.csca_change_move_speed(6)
Audio.se_play("Audio/SE/" + SONIC_SHOOT_SOUND, 80, 100) if SONIC_SOUND1
get_sonic_success_coords(@csca_event)
sonic_move_route(@csca_event, SONIC_DIST)
$game_party.lose_item($data_items[sONIC_ITEM_ID], 1) if REQUIRE_ITEMS_C
else
$game_message.add(sprintf(NO_ITEM_TEXT, SONIC_NAME))
end
end

def use_arrow
if $game_party.has_item?($data_items[ARROW_ITEM_ID]) || !REQUIRE_ITEMS_A
@tooltype = :arrow
csca_get_event
csca_event_setup(@csca_event)
@csca_event.csca_change_graphic(@csca_event, 2)
@csca_event.csca_change_move_speed(6)
Audio.se_play("Audio/SE/" + ARROW_SHOOT_SOUND, 80, 100) if ARROW_SOUND1
get_arrow_success_coords(@csca_event)
arrow_move_route(@csca_event, ARROW_DIST)
$game_party.lose_item($data_items[ARROW_ITEM_ID], 1) if REQUIRE_ITEMS_A
else
$game_message.add(sprintf(NO_ITEM_TEXT, ARROW_NAME))
end
end

def use_bomb
if $game_party.has_item?($data_items[bOMB_ITEM_ID]) || !REQUIRE_ITEMS_B
@tooltype = :bomb
csca_get_bomb_event
@csca_bomb_event.moveto($game_player.x, $game_player.y)
@csca_bomb_event.csca_change_graphic(@csca_bomb_event, 3)
Audio.se_play("Audio/SE/" + BOMB_PLACEMENT_SOUND, 80, 100) if BOMB_SOUND1
@bombplanted = true
@bombsteps = $game_party.steps
$game_party.lose_item($data_items[bOMB_ITEM_ID], 1) if REQUIRE_ITEMS_B
else
$game_message.add(sprintf(NO_ITEM_TEXT, BOMB_NAME))
end
end

def use_hookshot
@tooltype = :hookshot
csca_get_event
csca_event_setup(@csca_event)
@csca_event.csca_change_graphic(@csca_event, 4)
@csca_event.csca_change_move_speed(5)
Audio.se_play("Audio/SE/" + HOOKSHOT_USE_SOUND, 80, 100) if HOOKSHOT_SOUND1
hookshot_move_route(@csca_event, HOOKSHOT_DIST)
end

def use_boomarang
@tooltype = :boomarang
csca_get_event
csca_event_setup(@csca_event)
@csca_event.csca_change_graphic(@csca_event, 5)
@csca_event.csca_change_move_speed(5)
Audio.se_play("Audio/SE/" + BOOMERANG_USE_SOUND, 80, 100) if BOOMERANG_SOUND1
boomarang_move_route(@csca_event, BOOMERANG_DIST)
end

def csca_get_event
events.each do |i, event|
if event.list != nil
for i in 0...event.list.size
if event.list.code == 108 && event.list.parameters == ["DUNGEON_TOOL"]
@csca_event = event
end
end
end
end
end

def csca_get_bomb_event
events.each do |i, event|
if event.list != nil
for i in 0...event.list.size
if event.list.code == 108 && event.list.parameters == ["BOMB_TOOL"]
@csca_bomb_event = event
end
end
end
end
end

def csca_event_setup(event)
@usingtool = true
event.moveto($game_player.x, $game_player.y)
event.set_direction($game_player.direction)
event.csca_change_through(false)
end

def using_tool?
@usingtool
end

def using_bomb?
@bombplanted
end

def anime_playing?
@waitforanimation
end

def tooltype?
@tooltype
end

def done_moving?
@csca_dt_done_moving
end

def pickup?
@pickedup
end

def moving_back?
@movingback
end

def csca_clear_event
@usingtool = @csca_dt_done_moving = @pickedup = @movingback = @hookshot_reverse_dir = false
csca_get_event
if @csca_event != nil
@csca_event.moveto(0,0)
@csca_event.csca_change_graphic(@csca_event, 6)
end
end

def csca_clear_bomb_event
@bombplanted = @waitforanimation = false
csca_get_bomb_event
if @csca_bomb_event != nil
@csca_bomb_event.moveto(1,0)
@csca_bomb_event.csca_change_graphic(@csca_bomb_event, 5)
end
end

def sonic_move_route(event, dist)
mr = RPG::MoveRoute.new
mr.repeat = false
mr.wait = true
mr.skippable = true
mc = RPG::MoveCommand.new
mc.code = 12
mc.parameters = []
mc2 = RPG::MoveCommand.new
mc2.code = 45
mc2.parameters = ["$game_map.csca_finish_move_route"]
for i in 0...dist
mr.list = mc
end
mr.list[dist] = mc2
event.force_move_route(mr)
end

def arrow_move_route(event, dist)
mr = RPG::MoveRoute.new
mr.repeat = false
mr.wait = true
mr.skippable = true
mc = RPG::MoveCommand.new
mc.code = 12
mc.parameters = []
mc2 = RPG::MoveCommand.new
mc2.code = 45
mc2.parameters = ["$game_map.csca_finish_move_route"]
for i in 0...dist
mr.list = mc
end
mr.list[dist] = mc2
event.force_move_route(mr)
end

def boomarang_move_route(event, dist)
mr = RPG::MoveRoute.new
mr.repeat = false
mr.wait = true
mr.skippable = true
mc = RPG::MoveCommand.new
mc.code = 12
mc.parameters = []
mc2 = RPG::MoveCommand.new
mc2.code = 45
if moving_back?
mc2.parameters = ["$game_map.csca_finish_move_route"]
else
mc2.parameters = ["$game_map.csca_move_back"]
end
mc3 = RPG::MoveCommand.new
mc3.code = 22
mc3.parameters = []
for i in 0...dist
mr.list = mc
end
mr.list[dist] = mc3
mr.list[dist + 1] = mc2
event.force_move_route(mr)
end

def hookshot_move_route(event, dist)
mr = RPG::MoveRoute.new
mr.repeat = false
mr.wait = true
mr.skippable = true
mc = RPG::MoveCommand.new
mc.code = 12
mc.parameters = []
mc2 = RPG::MoveCommand.new
mc2.code = 45
mc2.parameters = ["$game_map.csca_hookshot_check"]
for i in 0...dist
mr.list = mc
end
mr.list[dist] = mc2
event.force_move_route(mr)
end

def hookshot_move_back(event)
@hookshot_reverse_dir = true
x1 = $game_player.x
y1 = $game_player.y
x2 = event.x
y2 = event.y
event.direction == 2 ? distance = (y1 - y2).abs :
event.direction == 8 ? distance = (y1 - y2).abs : distance = (x1 - x2).abs
if x1 == x2 && y1 == y2
csca_clear_event
return
end
mr = RPG::MoveRoute.new
mr.repeat = false
mr.wait = true
mr.skippable = true
mc = RPG::MoveCommand.new
mc.code = 13
mc.parameters = []
mc2 = RPG::MoveCommand.new
mc2.code = 45
mc2.parameters = ["$game_map.csca_finish_move_route"]
for i in 0...distance
mr.list = mc
end
mr.list[distance] = mc2
event.force_move_route(mr)
end

def csca_hookshot_success(event)
x1 = event.x
y1 = event.y
x2 = @csca_event.x
y2 = @csca_event.y
event.direction == 2 ? distance = (y1 - y2).abs :
event.direction == 8 ? distance = (y1 - y2).abs : distance = (x1 - x2).abs
mr = RPG::MoveRoute.new
mr.repeat = false
mr.wait = true
mr.skippable = true
mc = RPG::MoveCommand.new
mc.code = 12
mc.parameters = []
mc2 = RPG::MoveCommand.new
mc2.code = 45
mc2.parameters = ["$game_map.csca_finish_move_route"]
mc3 = RPG::MoveCommand.new
mc3.code = 37
mc3.parameters = []
mc4 = RPG::MoveCommand.new
mc4.code = 38
mc4.parameters = []
mc5 = RPG::MoveCommand.new
mc5.code = 32
mc5.parameters = []
mc6 = RPG::MoveCommand.new
mc6.code = 31
mc6.parameters = []
mc7 = RPG::MoveCommand.new
mc7.code = 45
mc7.parameters = ["$game_player.csca_move_route_over"]
mr.list[0] = mc3
mr.list[1] = mc5
for i in 2..distance + 1
mr.list = mc
end
mr.list[distance + 2] = mc4
mr.list[distance + 3] = mc6
mr.list[distance + 4] = mc2
mr.list[distance + 5] = mc7
event.force_move_route(mr)
end

def csca_move_back
@movingback = true
csca_get_event
x1 = $game_player.x
y1 = $game_player.y
x2 = @csca_event.x
y2 = @csca_event.y
@csca_event.direction == 2 ? distance = (y1 - y2).abs :
@csca_event.direction == 8 ? distance = (y1 - y2).abs : distance = (x1 - x2).abs
boomarang_move_route(@csca_event, distance)
end

def csca_clear_ok?(event)
mr = RPG::MoveRoute.new
mr.repeat = false
mr.wait = true
mr.skippable = true
mc = RPG::MoveCommand.new
mc.code = 15
mc.parameters = [bOMB_ANIMATION_TIME]
mc2 = RPG::MoveCommand.new
mc2.code = 45
mc2.parameters = ["$game_map.csca_clear_bomb_event"]
mr.list[0] = mc
mr.list[1] = mc2
event.force_move_route(mr)
end

def turn_on_next_ss(event)
csca_map_id = map_id
csca_event_id = event
switches = ["A","B","C","D"]
for i in switches
key = [csca_map_id, csca_event_id, i]
if !$game_self_switches[key]
$game_self_switches[key] = true
return
end
end
end

def csca_check_collision(event)
x = event.x
y = event.y
d = event.direction
case d
when 2; y += 1
when 4; x -= 1
when 6; x += 1
when 8; y -= 1
end
@csca_event_id = event_id_xy(x, y)
if @csca_event_id != 0
csca_get_collision_event(@csca_event_id)
csca_check_comment(@csca_collision_event, 1) if @tooltype == :sonic
csca_check_comment(@csca_collision_event, 2) if @tooltype == :arrow
if region_id(@csca_event.x, @csca_event.y) == REGION_ID1 && @tooltype == :hookshot
hookshot_move_back(@csca_event)
else
csca_check_comment(@csca_collision_event, 4) if @tooltype == :hookshot
end
else
Audio.se_play("Audio/SE/" + ARROW_HIT_SOUND2, 80, 100) if ARROW_SOUND3 && @tooltype == :arrow
hookshot_move_back(@csca_event) if @tooltype == :hookshot
end
csca_clear_event if @tooltype == :sonic
csca_clear_event if @tooltype == :arrow
end

def csca_get_collision_event(id)
events.each do |i, event|
@csca_collision_event = event if event.id == id
end
end

def csca_check_comment(event, tool, bombvar = 0)
unless event == nil
for i in 0...event.list.size
case tool
when 1
if event.list.code == 108 && event.list.parameters == ["SONIC_ACTIVATE"]
Audio.se_play("Audio/SE/" + SONIC_HIT_SOUND1, 80, 100) if SONIC_SOUND2
turn_on_next_ss(@csca_event_id)
else
Audio.se_play("Audio/SE/" + SONIC_HIT_SOUND2, 80, 100) if SONIC_SOUND3
end
when 2
if event.list.code == 108 && event.list.parameters == ["ARROW_ACTIVATE"]
Audio.se_play("Audio/SE/" + ARROW_HIT_SOUND1, 80, 100) if ARROW_SOUND2
turn_on_next_ss(@csca_event_id)
else
Audio.se_play("Audio/SE/" + ARROW_HIT_SOUND2, 80, 100) if ARROW_SOUND3
end
when 3
if event.list.code == 108 && event.list.parameters == ["BOOMERANG_ACTIVATE"] && !pickup?
turn_on_next_ss(@csca_event_id)
@pickedup = true
end
when 4
if event.list.code == 108 && event.list.parameters == ["HOOKSHOT_ENABLED"]
csca_hookshot_success($game_player)
return
else
hookshot_move_back(@csca_event)
end
when 5
if event.list.code == 108 && event.list.parameters == ["RESET_EXEMPT"]
return false
else
return true
end
when 6
if event.list.code == 108 && event.list.parameters == ["BOMB_ACTIVATE"]
turn_on_next_ss(@csca_bomb_event_id1) if bombvar == 1
turn_on_next_ss(@csca_bomb_event_id2) if bombvar == 2
turn_on_next_ss(@csca_bomb_event_id3) if bombvar == 3
turn_on_next_ss(@csca_bomb_event_id4) if bombvar == 4
turn_on_next_ss(@csca_bomb_event_id5) if bombvar == 5
turn_on_next_ss(@csca_bomb_event_id6) if bombvar == 6
end
end
end
end # unless event == nil
end

def csca_reset
$game_variables[CSCADGT] = 0
map_id = $game_player.csca_transfer_map_id
event_amount = events.size
for i in 1..event_amount
event_id = i
get_exempt_event(event_id)
if $game_map.csca_check_comment(@csca_exempt_event, 4)
switches = ["A","B","C","D"]
for i in switches
key = [map_id, event_id, i]
$game_self_switches[key] = false
end
end
end
x = $game_player.csca_transfer_x
y = $game_player.csca_transfer_y
d = $game_player.direction
if x != nil && y != nil && d != nil
$game_player.reserve_transfer(map_id, x, y, d)
$game_temp.fade_type = 0
end
end

def get_exempt_event(id)
events.each do |i, event|
@csca_exempt_event = event if event.id == id
end
end

def get_bomb_explode_event(id)
events.each do |i, event|
@csca_bomb_explode_event = event if event.id == id
end
end

end
class Game_Player < Game_Character

alias csca_save_transfer reserve_transfer
def reserve_transfer(map_id, x, y, d = 2)
csca_save_transfer(map_id, x, y, d)
@csca_saved_map_id = map_id
@csca_saved_x = x
@csca_saved_y = y
$game_map.csca_clear_event
$game_map.csca_clear_bomb_event
end

def csca_transfer_map_id
@csca_saved_map_id
end

def csca_transfer_x
@csca_saved_x
end

def csca_transfer_y
@csca_saved_y
end

def csca_move_route_over
@move_route_forcing = false
end

alias csca_movable? movable?
def movable?
return false if $game_map.using_tool? && ($game_map.tooltype? == :hookshot || $game_map.tooltype? == :boomarang)
csca_movable?
end

alias csca_dt_damage_floor? on_damage_floor?
def on_damage_floor?
!($game_map.tooltype? == :hookshot && $game_map.using_tool?) && csca_dt_damage_floor?
end

def move_by_input
return if !movable? || $game_map.interpreter.running?
if Input.press?(CSCA_DUNGEON_TOOLS::STILL_TRIGGER) && CSCA_DUNGEON_TOOLS::ENABLE_STILL
set_direction(Input.dir4) if Input.dir4 > 0
else
move_straight(Input.dir4) if Input.dir4 > 0
end
end

end
class CSCA_Scene_DungeonToolSelect < Scene_MenuBase
include CSCA_DUNGEON_TOOLS

def start
super
create_command_window
create_head_window
end

def update
super
update_cancel
end

def update_cancel
if Input.press?(:B)
Sound.play_cancel
return_scene
end
end

def create_command_window
@command_window = CSCA_Window_DungeonToolSelect.new(200, 150)
if $game_switches[sONIC]
@command_window.set_handler(:sonic, method(:select_sonic))
end
if $game_switches[ARROW]
@command_window.set_handler(:arrow, method(:select_arrow))
end
if $game_switches[bOMB]
@command_window.set_handler(:bomb, method(:select_bomb))
end
if $game_switches[HOOKSHOT]
@command_window.set_handler(:hookshot, method(:select_hookshot))
end
if $game_switches[bOOMERANG]
@command_window.set_handler(:boomarang, method(:select_boomarang))
end
if $game_switches[RESET]
@command_window.set_handler(:reset, method(:select_reset))
end
end

def create_head_window
@head_window = CSCA_Window_Header.new(200, 100, 160, HEADER)
end

def select_sonic
$game_variables[CSCADGT] = 1
return_scene
end

def select_arrow
$game_variables[CSCADGT] = 2
return_scene
end

def select_bomb
$game_variables[CSCADGT] = 3
return_scene
end

def select_hookshot
$game_variables[CSCADGT] = 4
return_scene
end

def select_boomarang
$game_variables[CSCADGT] = 5
return_scene
end

def select_reset
$game_variables[CSCADGT] = 6
return_scene
end

end
class CSCA_Window_DungeonToolSelect < Window_Command
include CSCA_DUNGEON_TOOLS

def initialize(x, y)
super(x, y)
make_command_icons
end

def make_command_list
add_command(SONIC_NAME, :sonic) if $game_switches[sONIC]
add_command(ARROW_NAME, :arrow) if $game_switches[ARROW]
add_command(BOMB_NAME, :bomb) if $game_switches[bOMB]
add_command(HOOKSHOT_NAME, :hookshot) if $game_switches[HOOKSHOT]
add_command(BOOMERANG_NAME, :boomarang) if $game_switches[bOOMERANG]
add_command(RESET_NAME, :reset) if $game_switches[RESET]
end

def make_command_icons
y = 0
if $game_switches[sONIC]
draw_icon(SONIC_ICON, 110, y)
y += line_height
end
if $game_switches[ARROW]
draw_icon(ARROW_ICON, 110, y)
y += line_height
end
if $game_switches[bOMB]
draw_icon(BOMB_ICON, 110, y)
y += line_height
end
if $game_switches[HOOKSHOT]
draw_icon(HOOKSHOT_ICON, 110, y)
y += line_height
end
if $game_switches[bOOMERANG]
draw_icon(BOOMERANG_ICON, 110, y)
y += line_height
end
if $game_switches[RESET]
draw_icon(RESET_ICON, 110, y)
end
end
end

 

Share this post


Link to post
Share on other sites

That's because if it is in that region facing any other way it will be set to through and move through other events. This is a limitation with all tools, and intended so that scenery or blank events don't collide with the tools. If you want, you can change this by editing the csca_check_through method.

Share this post


Link to post
Share on other sites

Just switch where it says csca_check_through = true else csca_check_through = false to be the other way around?

Share this post


Link to post
Share on other sites

STILL having trouble with the hookshot. Been awhile since I worked on my project, and decided to do some other stuff first.
Hookshot passes over unpassable terrain, but doesn't pull player to events. Images attached.

post-12975-0-44755500-1375701900_thumb.jpg

post-12975-0-92920400-1375701910_thumb.jpg

Share this post


Link to post
Share on other sites

Are your hookshot events set up correctly? They need to have this exact string in a comment somewhere in the event:

HOOKSHOT_ENABLED

Share this post


Link to post
Share on other sites

Not really sure then. Could you send me a compressed game file with an example of the problem?

Share this post


Link to post
Share on other sites

Oh mighty god, this is awesome!!!

I realy need that, but for VX. Is that possible to import this script to VX?

Share this post


Link to post
Share on other sites

Ok when using this tool nothing seems to happen.

 

Have I missed Something?

 

 kwxv.png

 

I have also added the 2 comments for DUNGEON_TOOL and BOMB_TOOL but I can't seem to access the tool menu. 

 

I Have Tried the W Key but nothing happens and the option is greyed out in the CSCA Menu Organizer.

 

any ideas?

 

EDIT: Fixed it, I put a 0 in front of the switch numbers by mistake. Awesome script :D

Edited by CloudTheWolf

Share this post


Link to post
Share on other sites

Is there a way to make the arrows 'stun' enemies when they are hit with them?

Share this post


Link to post
Share on other sites

Is there a way to make the arrows 'stun' enemies when they are hit with them?

 

Yeah.  You set the enemy event so that the first page has the arrow activation script on it.

Then the second event page should be self switch a is on, change the sprite sheet to something that comes across as stunned if you want, or just tell it not to move, set it to be a parallel process that waits x frames, and then shuts off self switch a.

Share this post


Link to post
Share on other sites

 

Is there a way to make the arrows 'stun' enemies when they are hit with them?

 

Yeah.  You set the enemy event so that the first page has the arrow activation script on it.

Then the second event page should be self switch a is on, change the sprite sheet to something that comes across as stunned if you want, or just tell it not to move, set it to be a parallel process that waits x frames, and then shuts off self switch a.

 

Thanks.

Share this post


Link to post
Share on other sites

You're welcome.  Using that set up you can set the arrows to do a lot of different things.

Oh, and if you want a more realistic explosion... there's a minigame demo on here somewhere I forget who does it.  But they made an explosion animation that looks more realistic.  I only noticed it the other day when I was playing the mini game in the demo again. -smiles-

Share this post


Link to post
Share on other sites

You're welcome.  Using that set up you can set the arrows to do a lot of different things.

Oh, and if you want a more realistic explosion... there's a minigame demo on here somewhere I forget who does it.  But they made an explosion animation that looks more realistic.  I only noticed it the other day when I was playing the mini game in the demo again. -smiles-

Wouldn't happen to remember the name of the mini game do you? I've been collecting mini game scripts lately like the new Triple Triad script that just came out & Galv's Invader shooter mini game. I'd like to round up as many mini game scripts as possible.

Share this post


Link to post
Share on other sites

Hello!

 

I think this script is awesome, but.. can any body tell me if there is a  fix to properly display hookshot missing chain animation? Its only displaying the arrow tip, between the player and the tip inst drawing the chain.

Share this post


Link to post
Share on other sites

Hello everyone..!

 

I've been working in a simple modification to the bomb tool:

 

- Added ability to set up bomb timer in frames to explosion, instead of steps.
It was added to avoid getting stuck on certain situations when the player can
be trapped by own bombs.

- Bombs can damage the player if doesnt move away from it.

Steps still present, but now the bomb explode after
timer run out, steps were kept to simulate a fake safe distance away from bomb. Maybe Casper
can be able to add a real safe distance for bombs explosion using more
complex scripting methods, maybe using manhattan distance formula.

 

Hope you find it useful...

 

 

 

    =begin
    CSCA Dungeon Tools MOD BY MR. KARL
    version: 1.4b
    Created by: Casper Gaming (http://www.caspergaming.com/)

    Compatibility:
    Made for RPGVXAce
    IMPORTANT: ALL CSCA Scripts should be compatible with each other unless
    otherwise noted.
    REQUIRES CSCA Core Script
    ================================================================================
    UPDATE HISTORY:

    Version 1.1
    -Fixed boomerang misspelling
    -Aliased a few more things
    -Bomb is now seperate from other tools, as in you can use other tools while a
    bomb is planted. However, you're still limited to 1 arrow/hookshot/boomerang
    at one time.
    -Tool events are now designated by comments rather than entering a predefined
    event id in the module.

    Version 1.2
    -Fixed bug that occured if a map didn't have dungeon tool events set up.
    -Fixed bug that caused a crash if any event on the map had no event pages with
    met conditions.

    Version 1.3
    -Added ability to hold a button down to turn in the direction pressed instead
    of moving. This is able to be done at all times.
    -Fixed reset bug
    -Added ability to require the player has items to use some tools. For example,
    the player might need an arrow in their inventory to use the arrow tool.
    -Increased compatibility by aliasing more stuff.

    Version 1.3b
    - Changed some stuff for compatibility with CSCA Menu Organizer.

    Version 1.4
    - Damage floor now doesn't damage the player when hookshotting over it.
    - Added a new region, similar to region 1 but only functions if a switch is ON.

    Version 1.4b
    - Region ID 1 will no longer allow tools to go through events. Use the other
    regions for this effect. (Toggleable).

    ===============================================================================
    ===============================================================================
    Unoficial MR. KARL BOMB DAMAGE/TIMER MOD // February 20 2014
    ===============================================================================
    ===============================================================================
    - Added ability to set up bomb timer in frames to explosion, instead of steps.
    It was added to avoid getting stuck on certain situations when the player can
    be trapped by own bombs.

    - Bombs can damage the player if doesnt move away from it.

    Steps still present, but now the bomb explode after
    timer run out, steps were kept to simulate a fake safe distance. Maybe Casper
    can be able to add a real safe distance for bombs explosion using more
    complex scripting methods, maybe using manhattan distance formula.

    Note: All changes made in the original code are marked with #MR. KARL MOD in
    each line.

    casper667 TIPS:
    To change module settings in the middle of a game, make this script call:
    CSCA_DUNGEON_TOOLS::HOOKSHOT_DIST = 8
    you can replace HOOKSHOT_DIST or the 8 with whatever variable/number you want.

    To change graphics, you'll need to do this script call:
    CSCA_DUNGEON_TOOLS::ARROW_INDEX = 5 to change the arrow graphic to the
    second-to-the-left index of the specified file with the graphics. Likewise,
    you could also do CSCA_DUNGEON_TOOLS::BOMB_INDEX = 4 to change the bomb graphic
    to the lower-left index of the character sheet. If you need to change the
    filename, this should work CSCA_DUNGEON_TOOLS::FILENAME = "text"

    To change the names, CSCA_DUNGEON_TOOLS::ARROW_NAME = "newarrowname"
    To change the icons, CSCA_DUNGEON_TOOLS::BOMB_ICON = 413
    ===============================================================================

    ================================================================================

    FFEATURES:
    This script allows you to enable/disable use of pre-made "dungeon tools" easily
    with switches. The pre-made tools include: Reset, Arrow, Bomb, Hookshot, Boomarang.
    Each tool behaves slightly differently, and it is recommended to download
    the demo to get a better understanding of how each tool works.

    RESET: Resets the map to how it was when you entered. This option will NOT turn
    switches/variables back to their original value, but it will turn self
    switches to false unless RESET_EXEMPT is put in the event page of an event. It
    also transfers the player to where they were originally after the previous
    transfer.

    ARROW: Shoots an arrow in the direction you're facing. When it hits an event, if
    the event has ARROW_ACTIVATE in a comment event command, it will activate the
    next self switch. If no self switch is on, it will turn A on. If A is on, B will
    be turned on, etc.

    BOMB: Sets a bomb down where the player is standing. When the player steps a
    specified amount of times, the bomb blows up, activating the next self switche of
    events underneath it, as well as directly above/below, and to the right/left.
    The self switches are only turned on if BOMB_ACTIVATE is in their event page in
    a comment command.

    HOOKSHOT: Shoots a hookshot in the direction of the player. If it connects with
    an event that has HOOKSHOT_ENABLED in a comment event command, it will move the
    player to that event, even if there are impassable tiles in between. If no
    event is hit, or the event does not have the comment command, the hookshot
    returns to the player.

    BOOMARANG: Shoots a boomarang, which can collect one item at a time(requires
    some eventing, shown in demo). If the boomarang flies over an event with the
    comment command BOOMARANG_ACTIVATE, it will turn on that event's next self switch.

    SETUP
    This script requires setup further down. It is important that you do not allow
    the player to reset the map before they have transferred once(by using the Transfer
    event command), as this script assumes a transfer has already happened.

    SETTING UP YOUR EVENTS:
    Each map where you plan to use these tools MUST have an event with the comment
    BOMB_TOOL inside, as well as an event with the comment DUNGEON_TOOL inside. The
    BOMB_TOOL event will act as the bomb, and the DUNGEON_TOOL will act as all other
    tools. Case Matters. Make sure you set the through/priority/stepping animation
    settings in the event page how you want them, as this script does not
    automatically do that. If you get a undefined method error, chances are you have
    set your events up incorrectly.

    On maps that do not have these events(any map that you do not want to use these
    tools on), it is very important to turn the ON_OFF switch OFF. Remember to turn
    it back ON for maps where these tools will be used, though!

    IMPORTANT! If you do not understand how to do some things, please download the
    demo to see each item properly used.

    CREDIT:
    Free to use in noncommercial games if credit is given to:
    Casper Gaming (http://www.caspergaming.com/)

    To use in a commercial game, please purchase a license here:
    http://www.caspergaming.com/licenses.html

    TERMS:
    http://www.caspergaming.com/terms_of_use.html
    =end
    module CSCA_DUNGEON_TOOLS # Don't touch this.
     
      ON_OFF = 41 # Switch ID. Turns this whole script on/off.
     
      # Trigger name        Key on keyboard
      # :A             =    Shift
      # :B             =    X
      # :C             =    Z
      # :X             =    A
      # :Y             =    S
      # :Z             =    D
      # :L             =    Q
      # :R             =    W
      TRIGGER = :R # Which button do you want to bring up the tool select menu?
      USETOOL = :X # Which button do you want to use a tool?
     
      STILL_TRIGGER = :L # Which button do you want the player to hold to turn
                         # without moving?
      ENABLE_STILL = true # Allow the player to hold a button to turn without moving?
     
      # Dungeon Tools. If you don't want to use one, simply leave it's switch OFF.
      ARROW = 42 # Switch ID. Turn ON to allow selection of the arrow.
      BOMB = 43 # Switch ID. Turn ON to allow selection of the bomb.
      HOOKSHOT = 44 # Switch ID. Turn ON to allow selection of the hookshot.
      BOOMERANG = 45 # Switch ID. Turn ON to allow selection of the boomarang.
      RESET = 46 # Switch ID. Turn ON to allow selection of the reset option.
     
      # Names. This is all text shown in game in the selection window.
      ARROW_NAME = "Arrow" # Name of the Arrow tool.
      BOMB_NAME = "Bomb" # Name of the Bomb tool.
      HOOKSHOT_NAME = "Hookshot" # Name of the Hookshot tool.
      BOOMERANG_NAME = "Boomerang" # Name of the Boomarang tool.
      RESET_NAME = "Reset" # Name of the Reset tool.
      HEADER = "Dungeon Tools" # Name of the selection window.
     
      # Icons. These icons will be shown next to the similarly named tools.
      ARROW_ICON = 529 # Icon displayed next to the Arrow text.
      BOMB_ICON = 528 # Icon displayed next to the Bomb text.
      HOOKSHOT_ICON = 530 # Icon displayed next to the Hookshot text.
      BOOMERANG_ICON = 154 # Icon displayed next to the Boomarang text.
      RESET_ICON = 280 # Icon displayed next to the Reset text.
     
      CSCADGT = 99 # Variable ID. By setting this in-game you can force use of some
                  # tools. 1 sets to arrow, 2 to bomb, 3 to hookshot, 4 to boomarang.
                  # If set to 5, the map will automatically reset and set this to 0,
                  # so setting this variable's value to 5 requires some caution.
                   
      REGION_ID1 = 1 # Region ID. Arrow/hookshot/boomarang can always move when in
                     # this region, no matter if the map tile is passable or not.
                     # However, the arrow/hookshot will not be able to activate
                     # events while in this region ID either.
      REGION_ID2 = 2 # Region ID. Arrow/hookshot/boomarang can always move when in
                     # this region IF it is facing down.
      REGION_ID3 = 3 # Region ID. Arrow/hookshot/boomarang can always move when in
                     # this region IF it is facing left.
      REGION_ID4 = 4 # Region ID. Arrow/hookshot/boomarang can always move when in
                     # this region IF it is facing right.
      REGION_ID5 = 5 # Region ID. Arrow/hookshot/boomarang can always move when in
                     # this region IF it is facing up.
      REGION_ID6 = 6 # Region ID. Arrow/hookshot/boomarang can always move when in
                     # this region IF it is facing up OR left
      REGION_ID7 = 7 # Region ID. Arrow/hookshot/boomarang can always move when in
                     # this region IF it is facing up OR right
      REGION_ID8 = 8 # Region ID. Arrow/hookshot/boomarang can always move when in
                     # this region IF it is facing down OR left
      REGION_ID9 = 9 # Region ID. Arrow/hookshot/boomarang can always move when in
                     # this region IF it is facing down OR right
      REGION_ID10 = 10 # Region ID. Arrow/hookshot/boomarang can always move when in
                       # this region IF it is facing up OR down.
      REGION_ID11 = 11 # Region ID. Arrow/hookshot/boomarang can always move when in
                       # this region IF it is facing left OR right
      REGION_ID12 = 12 # Region ID. Arrow/hookshot/boomarang can always move when in
                       # this region IF it is facing left OR right OR up
      REGION_ID13 = 13 # Region ID. Arrow/hookshot/boomarang can always move when in
                       # this region IF it is facing left OR right OR down
      REGION_ID14 = 14 # Region ID. Arrow/hookshot/boomarang can always move when in
                       # this region IF it is facing up OR down OR left
      REGION_ID15 = 15 # Region ID. Arrow/hookshot/boomarang can always move when in
                       # this region IF it is facing up OR down OR right
                       
                       
      REGION_ID16 = 16 # Region ID. Arrow/hookshot/boomarang can always move when in
                       # this region IF REGION_SWITCH is ON. Useful for multi-level
                       # areas.
                       
      REGION_SWITCH = 7 # Turns region ID 16 on.
     
      R1_EVENTS = false # Allow region ID 1 to move through events?
                   
      FILENAME = "dungeontools" # Filename of the character sheet containing your bomb,
                           # arrow, hookshot, and boomarang graphics. This should
                           # be placed in Graphics/Characters.
                           
      # File indexes. Character graphic files are laid out like so:
      # [0,1,2,3]
      # [4,5,6,7]
      # Where each number corresponds to the spot on the character sheet.
      ARROW_INDEX = 1 # Index of the arrow graphic in the previously specified file.
      BOMB_INDEX = 0 # Index of the bomb graphic in the previously specified file.
      HOOKSHOT_INDEX = 3 # Index of the hookshot graphic in the previously specified
                         # file.
      BOOMERANG_INDEX = 2 # Index of the boomarang graphic in the previously
                          # specified file.
                          
      ARROW_DIST = 7 # Amount of spaces you want the arrow to travel.
      BOOMERANG_DIST = 5 # Amount of spaces the boomarang will travel before returning
                         # to you.
      HOOKSHOT_DIST = 6 # Amount of spaces the hookshot will travel before returning
                        # to you.
      BOMB_TIMER = 60 #MR. KARL MOD >> Set bomb timer in frames required for explosion
      SAFE_STEPS = 3  #MR. KARL MOD >> Adjust the amount of steps to get away from explosion.
     
      BOMB_ANIMATION_ID = 126 # Bomb explosion animation id.
      BOMB_ANIMATION_TIME = 36 # Bomb explosion animation length in frames. To get
                               # this, multiply the highest number in the animation's
                               # frame list by 4.
     
      # All sound files are located in your Audio/SE/ folder.
      ARROW_SHOOT_SOUND = "Bow1" # Plays when arrow shoots, if enabled.
      ARROW_HIT_SOUND1 = "Damage1" # Plays when arrow hits event, if enabled.
      ARROW_HIT_SOUND2 = "Shot2" # Plays when arrow hits non-event, if enabled.
      BOMB_PLACEMENT_SOUND = "Cursor1" # Sound file to play when bomb is planted.
      HOOKSHOT_USE_SOUND = "Saint3" # Sound file to play when hookshot is used.
      BOOMERANG_USE_SOUND = "Darkness2" # Sound file to play when boomarang thrown.
      INJURED_BY_BOMB = "Down1" # MR. KARL MOD Sound file to play when bomb hurt.
     
      # Choose whether or not each sound file plays.
      ARROW_SOUND1 = true # Play ARROW_SHOOT_SOUND ?
      ARROW_SOUND2 = true # Play sound when arrow collides with event ?
      ARROW_SOUND3 = true # Play sound when arrow collides with non-event ?
      BOMB_SOUND1 = true # Play BOMB_PLACEMENT_SOUND ?
      HOOKSHOT_SOUND1 = true # Play hookshot use sound ?
      BOOMERANG_SOUND1 = true # Play boomarang throw sound ?
     
     
      # Setting this to true will require the player to have the items specified
      # below in thier inventory or else the tool will not be used. This will also
      # subtract one of that item upon use of that tool.
      REQUIRE_ITEMS_B = false # Require an item to use bombs?
      REQUIRE_ITEMS_A = false # Require an item to use arrows?
     
      # The following item ID's are the items that determine whether a tool is usable.
      # For example, if the palyer know how to use bombs, but has no bombs in their
      # inventory, the bomb tool will be unusable. Only works if REQUIRE_ITEMS is true.
      BOMB_ITEM_ID = 1 # Item ID. This item will be used when the Bomb Tool is used.
      ARROW_ITEM_ID = 2 # Item ID. This item will be used when the Arrow Tool is used.
     
      # Text displayed when a tool is used, but the player doesn't have the required
      # item specified above in their inventory. This feature only happens if
      # REQUIRE_ITEMS is set to true.
      NO_ITEM_TEXT = "You don't have any %ss!"
     
    end # END SETUP. Don't touch this or anything below.
    $imported = {} if $imported.nil?
    $imported["CSCA-DungeonTools"] = true
    msgbox('Missing Script: CSCA Core Script! CSCA Dungeon Tools requires this
    script to work properly.') if !$imported["CSCA-Core"]
    class Game_CharacterBase
      include CSCA_DUNGEON_TOOLS
     
      def csca_change_graphic(character, type)
        case type
        when 1
          character.set_graphic(FILENAME, ARROW_INDEX)
        when 2
          character.set_graphic(FILENAME, BOMB_INDEX)
        when 3
          character.set_graphic(FILENAME, HOOKSHOT_INDEX)
        when 4
          character.set_graphic(FILENAME, BOOMERANG_INDEX)
        else
          character.set_graphic("", 0)
        end
      end
     
      def csca_change_move_speed(speed)
        @move_speed = speed
      end
     
      def csca_change_through(t_f)
        @through = t_f
      end
     
    end
    class Scene_Map < Scene_Base
      include CSCA_DUNGEON_TOOLS
     
      alias csca_update update_scene
      def update_scene
        csca_update
        csca_update_dt unless $game_map.interpreter.running?
        csca_call_dts unless scene_changing? || $game_map.interpreter.running?
      end
     
      def csca_call_dts
        if Input.press?(TRIGGER) && $game_switches[ON_OFF] && csca_check_tools
          Sound.play_ok
          SceneManager.call(CSCA_Scene_DungeonToolSelect)
        end
      end
     
      def csca_check_tools
        return $game_switches[ARROW] || $game_switches[BOMB] ||
        $game_switches[HOOKSHOT] || $game_switches[BOOMERANG] ||
        $game_switches[RESET]
      end
     
      def csca_update_dt
        if Input.press?(USETOOL) && $game_switches[ON_OFF]
          use_arrow if $game_variables[CSCADGT] == 1
          use_bomb if $game_variables[CSCADGT] == 2
          use_hookshot if $game_variables[CSCADGT] == 3
          use_boomarang if $game_variables[CSCADGT] == 4
        end
      end
     
      def use_arrow
        $game_map.use_arrow unless $game_map.using_tool?
      end
     
      def use_bomb
        $game_map.use_bomb unless $game_map.using_bomb? || $game_map.anime_playing?
      end
     
      def use_hookshot
        $game_map.use_hookshot unless $game_map.using_tool?
      end
     
      def use_boomarang
        $game_map.use_boomarang unless $game_map.using_tool?
      end
     
    end
    class Game_Map
      include CSCA_DUNGEON_TOOLS

      alias csca_map_update update
      def update(main)
        csca_map_update(main)
        csca_reset if $game_variables[CSCADGT] == 5
        csca_update if using_tool? || using_bomb?
        csca_arrow_finish if done_moving? && @tooltype == :arrow
        csca_boomarang_finish if done_moving? && @tooltype == :boomarang
        csca_hookshot_finish if done_moving? && @tooltype == :hookshot
      end
     
      def csca_update
        csca_check_through if @tooltype == :arrow || @tooltype == :boomarang || @tooltype == :hookshot
        csca_check_frames if using_bomb? # MR. KARL MOD
        csca_check_pickup if @tooltype == :boomarang && !pickup?
      end
     
      def csca_check_through
        csca_get_event
        d = @csca_event.direction
        x = @csca_event.x
        y = @csca_event.y
        case d
        when 2; y += 1
        when 4; x -= 1
        when 6; x += 1
        when 8; y -= 1
        end
        block_event = events_xy_nt(x, y)
        if ((region_id(@csca_event.x, @csca_event.y) == REGION_ID1) && (block_event == [] || R1_EVENTS))  ||
        (d == 2 && region_id(@csca_event.x, @csca_event.y) == REGION_ID2) ||
        (d == 4 && region_id(@csca_event.x, @csca_event.y) == REGION_ID3) ||
        (d == 6 && region_id(@csca_event.x, @csca_event.y) == REGION_ID4) ||
        (d == 8 && region_id(@csca_event.x, @csca_event.y) == REGION_ID5) ||
        ((d == 8 || d == 4) && region_id(@csca_event.x, @csca_event.y) == REGION_ID6) ||
        ((d == 8 || d == 6) && region_id(@csca_event.x, @csca_event.y) == REGION_ID7) ||
        ((d == 2 || d == 4) && region_id(@csca_event.x, @csca_event.y) == REGION_ID8) ||
        ((d == 2 || d == 6) && region_id(@csca_event.x, @csca_event.y) == REGION_ID9) ||
        ((d == 2 || d == 8) && region_id(@csca_event.x, @csca_event.y) == REGION_ID10) ||
        ((d == 4 || d == 6) && region_id(@csca_event.x, @csca_event.y) == REGION_ID11) ||
        ((d == 4 || d == 6 || d == 8) && region_id(@csca_event.x, @csca_event.y) == REGION_ID12) ||
        ((d == 4 || d == 6 || d == 2) && region_id(@csca_event.x, @csca_event.y) == REGION_ID13) ||
        ((d == 2 || d == 8 || d == 4) && region_id(@csca_event.x, @csca_event.y) == REGION_ID14) ||
        ((d == 2 || d == 8 || d == 6) && region_id(@csca_event.x, @csca_event.y) == REGION_ID15) ||
        ($game_switches[REGION_SWITCH] && region_id(@csca_event.x, @csca_event.y) == REGION_ID16) ||
        @hookshot_reverse_dir == true
          @csca_event.csca_change_through(true)
        else
          @csca_event.csca_change_through(false)
        end
      end
      #============================================================#
                       #MR. KARL BOMB TIMER MOD#
      #============================================================#
      def csca_check_frames # MR. KARL MOD
        @bombtimer2 = Graphics.frame_count # MR. KARL MOD
        @bombtimer1 = @bombtimer # MR. KARL MOD
        @bombtimer2 -= @bombtimer1 # MR. KARL MOD
        @bombsteps2 = $game_party.steps
        @bombsteps1 = @bombsteps
        @bombsteps2 -= @bombsteps1
        if @bombtimer2 >= BOMB_TIMER# MR. KARL MOD
          bomb_explode(@csca_bomb_event)
        end
        if @bombtimer2 >= BOMB_TIMER && @bombsteps2 <= SAFE_STEPS # MR. KARL MOD
         Audio.se_play("Audio/SE/" + INJURED_BY_BOMB, 80, 80) # MR. KARL MOD
         $game_party.leader.hp /= 2 # MR. KARL MOD
        end
      end
     
      def csca_check_pickup
        x = @csca_event.x
        y = @csca_event.y
        d = @csca_event.direction
        case d
        when 2; y -= 1
        when 4; x += 1
        when 6; x -= 1
        when 8; y += 1
        end
        @csca_event_id = event_id_xy(x, y)
        if @csca_event_id != 0
          csca_get_collision_event(@csca_event_id)
          csca_check_comment(@csca_collision_event, 2)
        end
      end
     
      def bomb_explode(event)
        @waitforanimation = true
        @bombplanted = false
        event.animation_id = BOMB_ANIMATION_ID
        do_bomb_effect(event)
        csca_clear_ok?(event)
      end
     
      def do_bomb_effect(bomb)
        x = bomb.x
        y = bomb.y
        @csca_bomb_event_id5 = event_id_xy(x, y)
        x += 1
        @csca_bomb_event_id1 = event_id_xy(x, y)
        x -= 2
        @csca_bomb_event_id2 = event_id_xy(x, y)
        x = bomb.x
        y += 1
        @csca_bomb_event_id3 = event_id_xy(x, y)
        y -= 2
        @csca_bomb_event_id4 = event_id_xy(x, y)
        if @csca_bomb_event_id1 != 0
          get_bomb_explode_event(@csca_bomb_event_id1)
          csca_check_comment(@csca_bomb_explode_event, 5, 1)
        end
        if @csca_bomb_event_id2 != 0
          get_bomb_explode_event(@csca_bomb_event_id2)
          csca_check_comment(@csca_bomb_explode_event, 5, 2)
        end
        if @csca_bomb_event_id3 != 0
          get_bomb_explode_event(@csca_bomb_event_id3)
          csca_check_comment(@csca_bomb_explode_event, 5, 3)
        end
        if @csca_bomb_event_id4 != 0
          get_bomb_explode_event(@csca_bomb_event_id4)
          csca_check_comment(@csca_bomb_explode_event, 5, 4)
        end
        if @csca_bomb_event_id5 != 0
          get_bomb_explode_event(@csca_bomb_event_id5)
          csca_check_comment(@csca_bomb_explode_event, 5, 5)
        end
      end
     
      def get_arrow_success_coords(event)
        x = event.x
        y = event.y
        d = event.direction
        case d
        when 2; y += ARROW_DIST
        when 4; x -= ARROW_DIST
        when 6; x += ARROW_DIST
        when 8; y -= ARROW_DIST
        end
        @csca_success_x = x
        @csca_success_y = y
      end

      def csca_finish_move_route
        @csca_dt_done_moving = true
      end
     
      def csca_arrow_finish
        csca_get_event
        if @csca_event.x == @csca_success_x && @csca_event.y == @csca_success_y
          csca_clear_event
        else
          csca_check_collision(@csca_event)
        end
      end
     
      def csca_boomarang_finish
        $game_party.leader.hp -= 1
        csca_clear_event
      end
     
      def csca_hookshot_finish
        csca_clear_event
      end
     
      def csca_hookshot_check
        csca_check_collision(@csca_event)
      end
     
      def use_arrow
        if $game_party.has_item?($data_items[ARROW_ITEM_ID]) || !REQUIRE_ITEMS_A
          @tooltype = :arrow
          csca_get_event
          csca_event_setup(@csca_event)
          @csca_event.csca_change_graphic(@csca_event, 1)
          @csca_event.csca_change_move_speed(6)
          Audio.se_play("Audio/SE/" + ARROW_SHOOT_SOUND, 80, 100) if ARROW_SOUND1
          get_arrow_success_coords(@csca_event)
          arrow_move_route(@csca_event, ARROW_DIST)
          $game_party.lose_item($data_items[ARROW_ITEM_ID], 1) if REQUIRE_ITEMS_A
        else
          $game_message.add(sprintf(NO_ITEM_TEXT, ARROW_NAME))
        end
      end
     
      def use_bomb
        if $game_party.has_item?($data_items[BOMB_ITEM_ID]) || !REQUIRE_ITEMS_B
          @tooltype = :bomb
          csca_get_bomb_event
          @csca_bomb_event.moveto($game_player.x, $game_player.y)
          @csca_bomb_event.csca_change_graphic(@csca_bomb_event, 2)
          Audio.se_play("Audio/SE/" + BOMB_PLACEMENT_SOUND, 80, 100) if BOMB_SOUND1
          @bombplanted = true
          @bombsteps = $game_party.steps
          @bombtimer = Graphics.frame_count # MR. KARL MOD
          $game_party.lose_item($data_items[BOMB_ITEM_ID], 1) if REQUIRE_ITEMS_B
        else
          $game_message.add(sprintf(NO_ITEM_TEXT, BOMB_NAME))
        end
      end
     
      def use_hookshot
        @tooltype = :hookshot
        csca_get_event
        csca_event_setup(@csca_event)
        @csca_event.csca_change_graphic(@csca_event, 3)
        @csca_event.csca_change_move_speed(6)
        Audio.se_play("Audio/SE/" + HOOKSHOT_USE_SOUND, 80, 100) if HOOKSHOT_SOUND1
        hookshot_move_route(@csca_event, HOOKSHOT_DIST)
      end
     
      def use_boomarang
        @tooltype = :boomarang
        csca_get_event
        csca_event_setup(@csca_event)
        @csca_event.csca_change_graphic(@csca_event, 4)
        @csca_event.csca_change_move_speed(5)
        Audio.se_play("Audio/SE/" + BOOMERANG_USE_SOUND, 80, 100) if BOOMERANG_SOUND1
        boomarang_move_route(@csca_event, BOOMERANG_DIST)
      end
     
      def csca_get_event
        events.each do |i, event|
          if event.list != nil
            for i in 0...event.list.size
              if event.list[i].code == 108 && event.list[i].parameters == ["DUNGEON_TOOL"]
                @csca_event = event
              end
            end
          end
        end
      end
     
      def csca_get_bomb_event
        events.each do |i, event|
          if event.list != nil
            for i in 0...event.list.size
              if event.list[i].code == 108 && event.list[i].parameters == ["BOMB_TOOL"]
                @csca_bomb_event = event
              end
            end
          end
        end
      end
     
      def csca_event_setup(event)
        @usingtool = true
        event.moveto($game_player.x, $game_player.y)
        event.set_direction($game_player.direction)
        event.csca_change_through(false)
      end
     
      def using_tool?
        @usingtool
      end
     
      def using_bomb?
        @bombplanted
      end
     
      def anime_playing?
        @waitforanimation
      end
     
      def tooltype?
        @tooltype
      end
     
      def done_moving?
        @csca_dt_done_moving
      end
     
      def pickup?
        @pickedup
      end
     
      def moving_back?
        @movingback
      end
     
      def csca_clear_event
        @usingtool = @csca_dt_done_moving = @pickedup = @movingback = @hookshot_reverse_dir = false
        csca_get_event
        if @csca_event != nil
          @csca_event.moveto(0,0)
          @csca_event.csca_change_graphic(@csca_event, 5)
        end
      end
     
      def csca_clear_bomb_event
        @bombplanted = @waitforanimation = false
        csca_get_bomb_event
        if @csca_bomb_event != nil
          @csca_bomb_event.moveto(1,0)
          @csca_bomb_event.csca_change_graphic(@csca_bomb_event, 5)
        end
      end
     
      def arrow_move_route(event, dist)
        mr = RPG::MoveRoute.new
        mr.repeat = false
        mr.wait = true
        mr.skippable = true
        mc = RPG::MoveCommand.new
        mc.code = 12
        mc.parameters = []
        mc2 = RPG::MoveCommand.new
        mc2.code = 45
        mc2.parameters = ["$game_map.csca_finish_move_route"]
        for i in 0...dist
          mr.list[i] = mc
        end
        mr.list[dist] = mc2
        event.force_move_route(mr)
      end
     
      def boomarang_move_route(event, dist)
        mr = RPG::MoveRoute.new
        mr.repeat = false
        mr.wait = true
        mr.skippable = true
        mc = RPG::MoveCommand.new
        mc.code = 12
        mc.parameters = []
        mc2 = RPG::MoveCommand.new
        mc2.code = 45
        if moving_back?
          mc2.parameters = ["$game_map.csca_finish_move_route"]
        else
          mc2.parameters = ["$game_map.csca_move_back"]
        end
        mc3 = RPG::MoveCommand.new
        mc3.code = 22
        mc3.parameters = []
        for i in 0...dist
          mr.list[i] = mc
        end
        mr.list[dist] = mc3
        mr.list[dist + 1] = mc2
        event.force_move_route(mr)
      end
     
      def hookshot_move_route(event, dist)
        mr = RPG::MoveRoute.new
        mr.repeat = false
        mr.wait = true
        mr.skippable = true
        mc = RPG::MoveCommand.new
        mc.code = 12
        mc.parameters = []
        mc2 = RPG::MoveCommand.new
        mc2.code = 45
        mc2.parameters = ["$game_map.csca_hookshot_check"]
        for i in 0...dist
          mr.list[i] = mc
        end
        mr.list[dist] = mc2
        event.force_move_route(mr)
      end
     
      def hookshot_move_back(event)
        @hookshot_reverse_dir = true
        x1 = $game_player.x
        y1 = $game_player.y
        x2 = event.x
        y2 = event.y
        event.direction == 2 ? distance = (y1 - y2).abs :
        event.direction == 8 ? distance = (y1 - y2).abs : distance = (x1 - x2).abs
        if x1 == x2 && y1 == y2
          csca_clear_event
          return
        end
        mr = RPG::MoveRoute.new
        mr.repeat = false
        mr.wait = true
        mr.skippable = true
        mc = RPG::MoveCommand.new
        mc.code = 13
        mc.parameters = []
        mc2 = RPG::MoveCommand.new
        mc2.code = 45
        mc2.parameters = ["$game_map.csca_finish_move_route"]
        for i in 0...distance
          mr.list[i] = mc
        end
        mr.list[distance] = mc2
        event.force_move_route(mr)
      end
       
      def csca_hookshot_success(event)
        x1 = event.x
        y1 = event.y
        x2 = @csca_event.x
        y2 = @csca_event.y
        event.direction == 2 ? distance = (y1 - y2).abs :
        event.direction == 8 ? distance = (y1 - y2).abs : distance = (x1 - x2).abs
        mr = RPG::MoveRoute.new
        mr.repeat = false
        mr.wait = true
        mr.skippable = true
        mc = RPG::MoveCommand.new
        mc.code = 12
        mc.parameters = []
        mc2 = RPG::MoveCommand.new
        mc2.code = 45
        mc2.parameters = ["$game_map.csca_finish_move_route"]
        mc3 = RPG::MoveCommand.new
        mc3.code = 37
        mc3.parameters = []
        mc4 = RPG::MoveCommand.new
        mc4.code = 38
        mc4.parameters = []
        mc5 = RPG::MoveCommand.new
        mc5.code = 32
        mc5.parameters = []
        mc6 = RPG::MoveCommand.new
        mc6.code = 31
        mc6.parameters = []
        mc7 = RPG::MoveCommand.new
        mc7.code = 45
        mc7.parameters = ["$game_player.csca_move_route_over"]
        mr.list[0] = mc3
        mr.list[1] = mc5
        for i in 2..distance + 1
          mr.list[i] = mc
        end
        mr.list[distance + 2] = mc4
        mr.list[distance + 3] = mc6
        mr.list[distance + 4] = mc2
        mr.list[distance + 5] = mc7
        event.force_move_route(mr)
      end
     
      def csca_move_back
        @movingback = true
        csca_get_event
        x1 = $game_player.x
        y1 = $game_player.y
        x2 = @csca_event.x
        y2 = @csca_event.y
        @csca_event.direction == 2 ? distance = (y1 - y2).abs :
        @csca_event.direction == 8 ? distance = (y1 - y2).abs : distance = (x1 - x2).abs
        boomarang_move_route(@csca_event, distance)
      end
     
      def csca_clear_ok?(event)
        mr = RPG::MoveRoute.new
        mr.repeat = false
        mr.wait = true
        mr.skippable = true
        mc = RPG::MoveCommand.new
        mc.code = 15
        mc.parameters = [BOMB_ANIMATION_TIME]
        mc2 = RPG::MoveCommand.new
        mc2.code = 45
        mc2.parameters = ["$game_map.csca_clear_bomb_event"]
        mr.list[0] = mc
        mr.list[1] = mc2
        event.force_move_route(mr)
      end
     
      def turn_on_next_ss(event)
        csca_map_id = map_id
        csca_event_id = event
        switches = ["A","B","C","D"]
        for i in switches
          key = [csca_map_id, csca_event_id, i]
          if !$game_self_switches[key]
            $game_self_switches[key] = true
            return
          end
        end
      end
     
      def csca_check_collision(event)
        x = event.x
        y = event.y
        d = event.direction
        case d
        when 2; y += 1
        when 4; x -= 1
        when 6; x += 1
        when 8; y -= 1
        end
        @csca_event_id = event_id_xy(x, y)
        if @csca_event_id != 0
          csca_get_collision_event(@csca_event_id)
          csca_check_comment(@csca_collision_event, 1) if @tooltype == :arrow
          if region_id(@csca_event.x, @csca_event.y) == REGION_ID1 && @tooltype == :hookshot
            hookshot_move_back(@csca_event)
          else
            csca_check_comment(@csca_collision_event, 3) if @tooltype == :hookshot
          end
        else
          Audio.se_play("Audio/SE/" + ARROW_HIT_SOUND2, 80, 100) if ARROW_SOUND3 && @tooltype == :arrow
          hookshot_move_back(@csca_event) if @tooltype == :hookshot
        end
        csca_clear_event if @tooltype == :arrow
      end
     
      def csca_get_collision_event(id)
        events.each do |i, event|
          @csca_collision_event = event if event.id == id
        end
      end
     
      def csca_check_comment(event, tool, bombvar = 0)
        unless event == nil
        for i in 0...event.list.size
          case tool
          when 1
            if event.list[i].code == 108 && event.list[i].parameters == ["ARROW_ACTIVATE"]
              Audio.se_play("Audio/SE/" + ARROW_HIT_SOUND1, 80, 100) if ARROW_SOUND2
              turn_on_next_ss(@csca_event_id)
            else
              Audio.se_play("Audio/SE/" + ARROW_HIT_SOUND2, 80, 100) if ARROW_SOUND3
            end
          when 2
            if event.list[i].code == 108 && event.list[i].parameters == ["BOOMERANG_ACTIVATE"] && !pickup?
              turn_on_next_ss(@csca_event_id)
              @pickedup = true
            end
          when 3
            if event.list[i].code == 108 && event.list[i].parameters == ["HOOKSHOT_ENABLED"]
              csca_hookshot_success($game_player)
              return
            else
              hookshot_move_back(@csca_event)
            end
          when 4
            if event.list[i].code == 108 && event.list[i].parameters == ["RESET_EXEMPT"]
              return false
            else
              return true
            end
          when 5
            if event.list[i].code == 108 && event.list[i].parameters == ["BOMB_ACTIVATE"]
              turn_on_next_ss(@csca_bomb_event_id1) if bombvar == 1
              turn_on_next_ss(@csca_bomb_event_id2) if bombvar == 2
              turn_on_next_ss(@csca_bomb_event_id3) if bombvar == 3
              turn_on_next_ss(@csca_bomb_event_id4) if bombvar == 4
              turn_on_next_ss(@csca_bomb_event_id5) if bombvar == 5
            end
          end
        end
        end # unless event == nil
      end
     
      def csca_reset
        $game_variables[CSCADGT] = 0
        map_id = $game_player.csca_transfer_map_id
        event_amount = events.size
        for i in 1..event_amount
          event_id = i
          get_exempt_event(event_id)
          if $game_map.csca_check_comment(@csca_exempt_event, 4)
            switches = ["A","B","C","D"]
            for i in switches
              key = [map_id, event_id, i]
              $game_self_switches[key] = false
            end
          end
        end
        x = $game_player.csca_transfer_x
        y = $game_player.csca_transfer_y
        d = $game_player.direction
        if x != nil && y != nil && d != nil
          $game_player.reserve_transfer(map_id, x, y, d)
          $game_temp.fade_type = 0
        end
      end
     
      def get_exempt_event(id)
        events.each do |i, event|
          @csca_exempt_event = event if event.id == id
        end
      end
     
      def get_bomb_explode_event(id)
        events.each do |i, event|
          @csca_bomb_explode_event = event if event.id == id
        end
      end
     
    end
    class Game_Player < Game_Character
     
      alias csca_save_transfer reserve_transfer
      def reserve_transfer(map_id, x, y, d = 2)
        csca_save_transfer(map_id, x, y, d)
        @csca_saved_map_id = map_id
        @csca_saved_x = x
        @csca_saved_y = y
        $game_map.csca_clear_event
        $game_map.csca_clear_bomb_event
      end
     
      def csca_transfer_map_id
        @csca_saved_map_id
      end
     
      def csca_transfer_x
        @csca_saved_x
      end
     
      def csca_transfer_y
        @csca_saved_y
      end
     
      def csca_move_route_over
        @move_route_forcing = false
      end
     
      alias csca_movable? movable?
      def movable?
        return false if $game_map.using_tool? && ($game_map.tooltype? == :hookshot || $game_map.tooltype? == :boomarang)
        csca_movable?
      end
     
      alias csca_dt_damage_floor? on_damage_floor?
      def on_damage_floor?
        !($game_map.tooltype? == :hookshot && $game_map.using_tool?) && csca_dt_damage_floor?
      end
     
      def move_by_input
        return if !movable? || $game_map.interpreter.running?
        if Input.press?(CSCA_DUNGEON_TOOLS::STILL_TRIGGER) && CSCA_DUNGEON_TOOLS::ENABLE_STILL
          set_direction(Input.dir4) if Input.dir4 > 0
        else
          move_straight(Input.dir4) if Input.dir4 > 0
        end
      end
     
    end
    class CSCA_Scene_DungeonToolSelect < Scene_MenuBase
      include CSCA_DUNGEON_TOOLS
     
      def start
        super
        create_command_window
        create_head_window
      end
     
      def update
        super
        update_cancel
      end
     
      def update_cancel
        if Input.press?(: []
          Sound.play_cancel
          return_scene
        end
      end
     
      def create_command_window
        @command_window = CSCA_Window_DungeonToolSelect.new(200, 150)
        if $game_switches[ARROW]
          @command_window.set_handler(:arrow, method(:select_arrow))
        end
        if $game_switches[BOMB]
          @command_window.set_handler(:bomb, method(:select_bomb))
        end
        if $game_switches[HOOKSHOT]
          @command_window.set_handler(:hookshot, method(:select_hookshot))
        end
        if $game_switches[BOOMERANG]
          @command_window.set_handler(:boomarang, method(:select_boomarang))
        end
        if $game_switches[RESET]
          @command_window.set_handler(:reset, method(:select_reset))
        end
      end
     
      def create_head_window
        @head_window = CSCA_Window_Header.new(200, 100, 160, HEADER)
      end
     
      def select_arrow
        $game_variables[CSCADGT] = 1
        return_scene
      end
     
      def select_bomb
        $game_variables[CSCADGT] = 2
        return_scene
      end
     
      def select_hookshot
        $game_variables[CSCADGT] = 3
        return_scene
      end
     
      def select_boomarang
        $game_variables[CSCADGT] = 4
        return_scene
      end
     
      def select_reset
        $game_variables[CSCADGT] = 5
        return_scene
      end
     
    end
    class CSCA_Window_DungeonToolSelect < Window_Command
      include CSCA_DUNGEON_TOOLS
     
      def initialize(x, y)
        super(x, y)
        make_command_icons
      end
     
      def make_command_list
        add_command(ARROW_NAME, :arrow) if $game_switches[ARROW]
        add_command(BOMB_NAME, :bomb) if $game_switches[BOMB]
        add_command(HOOKSHOT_NAME, :hookshot) if $game_switches[HOOKSHOT]
        add_command(BOOMERANG_NAME, :boomarang) if $game_switches[BOOMERANG]
        add_command(RESET_NAME, :reset) if $game_switches[RESET]
      end
     
      def make_command_icons
        y = 0
        if $game_switches[ARROW]
          draw_icon(ARROW_ICON, 110, y)
          y += line_height
        end
        if $game_switches[BOMB]
          draw_icon(BOMB_ICON, 110, y)
          y += line_height
        end
        if $game_switches[HOOKSHOT]
          draw_icon(HOOKSHOT_ICON, 110, y)
          y += line_height
        end
        if $game_switches[BOOMERANG]
          draw_icon(BOOMERANG_ICON, 110, y)
          y += line_height
        end
        if $game_switches[RESET]
          draw_icon(RESET_ICON, 110, y)
        end
      end
    end



 

 

Edited by Mr_Karl
  • Like 1

Share this post


Link to post
Share on other sites

Sorry am new,on new map copy and past all 3 script:core,tools,menu. but when I try to push the W button,nothing happens. Have the

comments set up :bomb_tool,dungeon tool and arrow_activate, just have missed something I guess. thanks

Share this post


Link to post
Share on other sites

Sorry am new,on new map copy and past all 3 script:core,tools,menu. but when I try to push the W button,nothing happens. Have the

comments set up :bomb_tool,dungeon tool and arrow_activate, just have missed something I guess. thanks

 

Control Switches, you don't see them straight off but if you look at the guys in the demo, talking to them activates specific switches, you need to either set the same switches into yours and turn them on.  Or you'll need to set up new switches and edit the listing for them inside the script.

 

Hit me back if you have trouble.

Share this post


Link to post
Share on other sites

Notsalony Thanks for the feed back

 

OK figured out the problem, now have problem with conflicting scripts, in other words both scripts make the tools activate when you press the A key on keyboard, any way around.thanks

Edited by lazzyydogg1212

Share this post


Link to post
Share on other sites

Notsalony Thanks for the feed back

 

OK figured out the problem, now have problem with conflicting scripts, in other words both scripts make the tools activate when you press the A key on keyboard, any way around.thanks

 

Which two scripts because depending on which one it is it might change up which one you need to change.

 

But the only basic way to change that is to look in the script for the line towards the top that tells it what button activates it.  I think it says something like :z or something like, you need to change that to a different letter to change which keyboard key opens it.  Sadly I don't have a list of what letter equals out what key or I could be of more help.

Share this post


Link to post
Share on other sites

I have CSCA_DUNGEONTOOLS and FA Interactive System 2.0 scripts, needed the boomerang,bomb,sword,hookshot.Ok got it to work with changing letter to Y,in case you need the info for the keys here it is http://www.rpgmakervxace.net/topic/13904-need-help-with-keyboard-input/, now how to set up hidden doors which explode with bombs proper.After set up the bomb opens both of them, do I change the number of the switch or variable? thanks again

Edited by lazzyydogg1212

Share this post


Link to post
Share on other sites

I have CSCA_DUNGEONTOOLS and FA Interactive System 2.0 scripts, needed the boomerang,bomb,sword,hookshot.Ok got it to work with changing letter to Y,in case you need the info for the keys here it is http://www.rpgmakervxace.net/topic/13904-need-help-with-keyboard-input/, now how to set up hidden doors which explode with bombs proper.After set up the bomb opens both of them, do I change the number of the switch or variable? thanks again

 

One the first event page give it only one line of coding, it's a comment, same one that's in the bombing items in the demon.  BOMB_ACTIVATE , then on the second page of the event, set it to self switch a is activated, and make it passable.  That way what ever you have page 1 to look like, page 2 will be blank and clear or a doorway that transports you or what have you.

Share this post


Link to post
Share on other sites

Hey guys I was wondering if there is anyway to change the graphic and sound effect of the arrow during the game?

 

Theres a section of my game where the main character is transformed into a chicken and I want the arrows to turn into eggs and make an appropriate sound when they are fired.

 

Im hoping it would be possible to change with a switch or a script call or something along those lines but if its of any use I'm not planning on using the boomerang tool so that could be a slot to double up with a second arrow tool that is the egg.

 

Thanks in advance :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted