CSCA Dungeon Tools: Arrow accuracy and Bomb range

Tw0Face

Master Strategist
Veteran
Joined
Nov 12, 2018
Messages
430
Reaction score
370
First Language
German
Primarily Uses
RMVXA
I'm currently messing around with CSCA Dungeon Tools for RM Vx Ace just for fun. I've created moving enemies to hit with the Arrow Tool, but sometimes the Arrow simply passes through the enemies. I think that's because of the collision detection mentioned in the script. It seems to use Event coordinates.

Code:
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

I tried to exchange event.x for screen.x and event.y for screen.y to use screen coordinates for the Arrow Event, but that doesn't work like I thought. How can I change that, so that the result is more accurate? Also, how can I set the bomb up to have a certain range (for example 4 fields)?

Greetings,
Tw0Face
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,674
Reaction score
566
First Language
English
Primarily Uses
RMVXA
The event that is designed to receive the arrow has a comment ARROW_ACTIVATE.
This sets the event self switch A to on.
How well did you read the instructions?
Code:
bomb blows up, activating the next self switch 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.
The bomb is designed to only activate the spots next to where you set the bomb.
To change this would require an addon if it can be done.
 

Tw0Face

Master Strategist
Veteran
Joined
Nov 12, 2018
Messages
430
Reaction score
370
First Language
German
Primarily Uses
RMVXA
The event that is designed to receive the arrow has a comment ARROW_ACTIVATE.
This sets the event self switch A to on.
How well did you read the instructions?
I know how to use this script. I set up my Events exactly like this and it works fine. It's just that the Arrows misses sometimes even though it should hit the Event. It works fine with static Events, but with moving Events the collision detection seems to be a bit wonky and inaccurate. I think it would be more accurate if it were possible to solve this with screen coordinates. But I'm not quite sure.

The bomb is designed to only activate the spots next to where you set the bomb.
To change this would require an addon if it can be done.
That's what I'm asking for. :) A range would make the bomb a lot more useful.

Greetings,
Tw0Face
 
Last edited:

Tw0Face

Master Strategist
Veteran
Joined
Nov 12, 2018
Messages
430
Reaction score
370
First Language
German
Primarily Uses
RMVXA

Another Fen

Veteran
Veteran
Joined
Jan 23, 2013
Messages
565
Reaction score
276
First Language
German
Primarily Uses
Uh, hello here!

I have only skimmed over the script, so I might still be wrong with the following:


Arrows seem to work on ordinary move routes, so they naturally use map coordinates to determine whether they collide with an obstacle (and skip the rest of their movement). The code above only calculate the target coordinates of the arrow, which are then used to determine whether the arrow was blocked by a target somewhere on the way (in the third method, the arrow event is cleared if it reached its destination, otherwise a collision check is started).

In addition to using map coordinates, skipping a move command also takes one frame each, so depending on your ARROW_DIST your target events may also have a time window to escape a collision. For example, at ARROW_DIST = 8 it should be impossible to hit a target from point blank range that is passing by at normal speed.

A more precise collision detection would probably have to be added on top of the current movement system, though at the moment I'm not sure what this would mean for the other projectile types the script offers.


The targets for the bomb are determined in the do_bomb_effect method. As Roninator2 already stated, right now this method should check the position of the bomb itself and the 4 adjacent tiles.


Can't offer actual code as of right now unfortunately.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,674
Reaction score
566
First Language
English
Primarily Uses
RMVXA
Bomb addon
Code:
=begin
CSCA Dungeon Tools Bomb addon
version: 1.4b
Created by: Casper Gaming (http://www.caspergaming.com/)
Mod by: Roninator2
Compatibility:
Made for RPGVXAce
IMPORTANT: ALL CSCA Scripts should be compatible with each other unless
otherwise noted.
REQUIRES CSCA Core Script
Place below CSCA Dungeon Tools Script
=end

module CSCA_DUNGEON_TOOLS # Don't touch this.
  # Value 1-5
  BOMB_DISTANCE = 5 # how many squares away from bomb rounded into a circle
end

class Game_Map
  include CSCA_DUNGEON_TOOLS
  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)
    # BOMB distance greater than 1
    if CSCA_DUNGEON_TOOLS::BOMB_DISTANCE >= 2
    x += 1
    @csca_bomb_event_id6 = event_id_xy(x, y)
    y += 2
    @csca_bomb_event_id7 = event_id_xy(x, y)
    x -= 2
    @csca_bomb_event_id8 = event_id_xy(x, y)
    y -= 2
    @csca_bomb_event_id9 = event_id_xy(x, y)
    y -= 1
    x += 1
    @csca_bomb_event_id10 = event_id_xy(x, y)
    x += 2
    y += 2
    @csca_bomb_event_id11 = event_id_xy(x, y)
    x -= 2
    y += 2
    @csca_bomb_event_id12 = event_id_xy(x, y)
    x -= 2
    y -= 2
    @csca_bomb_event_id13 = event_id_xy(x, y)
    end
    # BOMB distance greater than 2
    if CSCA_DUNGEON_TOOLS::BOMB_DISTANCE >= 3
    x -= 1
    @csca_bomb_event_id14 = event_id_xy(x, y)
    y -= 1
    x += 1
    @csca_bomb_event_id15 = event_id_xy(x, y)
    y -= 1
    x += 1
    @csca_bomb_event_id16 = event_id_xy(x, y)
    y -= 1
    x += 1
    @csca_bomb_event_id17 = event_id_xy(x, y)
    y += 1
    x += 1
    @csca_bomb_event_id18 = event_id_xy(x, y)
    y += 1
    x += 1
    @csca_bomb_event_id19 = event_id_xy(x, y)
    y += 1
    x += 1
    @csca_bomb_event_id20 = event_id_xy(x, y)
    x -= 1
    y += 1
    @csca_bomb_event_id21 = event_id_xy(x, y)
    x -= 1
    y += 1
    @csca_bomb_event_id22 = event_id_xy(x, y)
    x -= 1
    y += 1
    @csca_bomb_event_id23 = event_id_xy(x, y)
    y -= 1
    x -= 1
    @csca_bomb_event_id24 = event_id_xy(x, y)
    y -= 1
    x -= 1
    @csca_bomb_event_id25 = event_id_xy(x, y)
    end
    # BOMB distance greater than 3
    if CSCA_DUNGEON_TOOLS::BOMB_DISTANCE >= 4
    y -= 1
    x -= 2
    @csca_bomb_event_id26 = event_id_xy(x, y)
    y -= 1
    x += 1
    @csca_bomb_event_id27 = event_id_xy(x, y)
    y -= 1
    x += 1
    @csca_bomb_event_id28 = event_id_xy(x, y)
    y -= 1
    x += 1
    @csca_bomb_event_id29 = event_id_xy(x, y)
    y -= 1
    x += 1
    @csca_bomb_event_id30 = event_id_xy(x, y)
    x += 1
    y += 1
    @csca_bomb_event_id31 = event_id_xy(x, y)
    x += 1
    y += 1
    @csca_bomb_event_id32 = event_id_xy(x, y)
    x += 1
    y += 1
    @csca_bomb_event_id33 = event_id_xy(x, y)
    x += 1
    y += 1
    @csca_bomb_event_id34 = event_id_xy(x, y)
    x -= 1
    y += 1
    @csca_bomb_event_id35 = event_id_xy(x, y)
    x -= 1
    y += 1
    @csca_bomb_event_id36 = event_id_xy(x, y)
    x -= 1
    y += 1
    @csca_bomb_event_id37 = event_id_xy(x, y)
    x -= 1
    y += 1
    @csca_bomb_event_id38 = event_id_xy(x, y)
    x -= 1
    y -= 1
    @csca_bomb_event_id39 = event_id_xy(x, y)
    x -= 1
    y -= 1
    @csca_bomb_event_id40 = event_id_xy(x, y)
    x -= 1
    y -= 1
    @csca_bomb_event_id41 = event_id_xy(x, y)
    end
    # BOMB distance greater than 4
    if CSCA_DUNGEON_TOOLS::BOMB_DISTANCE >= 5
    y -= 1
    x -= 2
    @csca_bomb_event_id42 = event_id_xy(x, y)
    y -= 1
    x += 1
    @csca_bomb_event_id43 = event_id_xy(x, y)
    y -= 1
    x += 1
    @csca_bomb_event_id44 = event_id_xy(x, y)
    y -= 1
    x += 1
    @csca_bomb_event_id45 = event_id_xy(x, y)
    y -= 1
    x += 1
    @csca_bomb_event_id46 = event_id_xy(x, y)
    y -= 1
    x += 1
    @csca_bomb_event_id47 = event_id_xy(x, y)
    y += 1
    x += 1
    @csca_bomb_event_id48 = event_id_xy(x, y)
    y += 1
    x += 1
    @csca_bomb_event_id49 = event_id_xy(x, y)
    y += 1
    x += 1
    @csca_bomb_event_id50 = event_id_xy(x, y)
    y += 1
    x += 1
    @csca_bomb_event_id51 = event_id_xy(x, y)
    y += 1
    x += 1
    @csca_bomb_event_id52 = event_id_xy(x, y)
    y += 1
    x -= 1
    @csca_bomb_event_id53 = event_id_xy(x, y)
    y += 1
    x -= 1
    @csca_bomb_event_id54 = event_id_xy(x, y)
    y += 1
    x -= 1
    @csca_bomb_event_id55 = event_id_xy(x, y)
    y += 1
    x -= 1
    @csca_bomb_event_id56 = event_id_xy(x, y)
    y += 1
    x -= 1
    @csca_bomb_event_id57 = event_id_xy(x, y)
    y -= 1
    x -= 1
    @csca_bomb_event_id58 = event_id_xy(x, y)
    y -= 1
    x -= 1
    @csca_bomb_event_id59 = event_id_xy(x, y)
    y -= 1
    x -= 1
    @csca_bomb_event_id60 = event_id_xy(x, y)
    y -= 1
    x -= 1
    @csca_bomb_event_id61 = event_id_xy(x, y)
    end
 
    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
    if @csca_bomb_event_id6 != 0
      get_bomb_explode_event(@csca_bomb_event_id6)
      csca_check_comment(@csca_bomb_explode_event, 5, 6)
    end
    if @csca_bomb_event_id7 != 0
      get_bomb_explode_event(@csca_bomb_event_id7)
      csca_check_comment(@csca_bomb_explode_event, 5, 7)
    end
    if @csca_bomb_event_id8 != 0
      get_bomb_explode_event(@csca_bomb_event_id8)
      csca_check_comment(@csca_bomb_explode_event, 5, 8)
    end
    if @csca_bomb_event_id9 != 0
      get_bomb_explode_event(@csca_bomb_event_id9)
      csca_check_comment(@csca_bomb_explode_event, 5, 9)
    end
    if @csca_bomb_event_id10 != 0
      get_bomb_explode_event(@csca_bomb_event_id10)
      csca_check_comment(@csca_bomb_explode_event, 5, 10)
    end
    if @csca_bomb_event_id11 != 0
      get_bomb_explode_event(@csca_bomb_event_id11)
      csca_check_comment(@csca_bomb_explode_event, 5, 11)
    end
    if @csca_bomb_event_id12 != 0
      get_bomb_explode_event(@csca_bomb_event_id12)
      csca_check_comment(@csca_bomb_explode_event, 5, 12)
    end
    if @csca_bomb_event_id13 != 0
      get_bomb_explode_event(@csca_bomb_event_id13)
      csca_check_comment(@csca_bomb_explode_event, 5, 13)
    end
    if @csca_bomb_event_id14 != 0
      get_bomb_explode_event(@csca_bomb_event_id14)
      csca_check_comment(@csca_bomb_explode_event, 5, 14)
    end
    if @csca_bomb_event_id15 != 0
      get_bomb_explode_event(@csca_bomb_event_id15)
      csca_check_comment(@csca_bomb_explode_event, 5, 15)
    end
    if @csca_bomb_event_id16 != 0
      get_bomb_explode_event(@csca_bomb_event_id16)
      csca_check_comment(@csca_bomb_explode_event, 5, 16)
    end
    if @csca_bomb_event_id17 != 0
      get_bomb_explode_event(@csca_bomb_event_id17)
      csca_check_comment(@csca_bomb_explode_event, 5, 17)
    end
    if @csca_bomb_event_id18 != 0
      get_bomb_explode_event(@csca_bomb_event_id18)
      csca_check_comment(@csca_bomb_explode_event, 5, 18)
    end
    if @csca_bomb_event_id19 != 0
      get_bomb_explode_event(@csca_bomb_event_id19)
      csca_check_comment(@csca_bomb_explode_event, 5, 19)
    end
    if @csca_bomb_event_id20 != 0
      get_bomb_explode_event(@csca_bomb_event_id20)
      csca_check_comment(@csca_bomb_explode_event, 5, 20)
    end
    if @csca_bomb_event_id21 != 0
      get_bomb_explode_event(@csca_bomb_event_id21)
      csca_check_comment(@csca_bomb_explode_event, 5, 21)
    end
    if @csca_bomb_event_id22 != 0
      get_bomb_explode_event(@csca_bomb_event_id22)
      csca_check_comment(@csca_bomb_explode_event, 5, 22)
    end
    if @csca_bomb_event_id23 != 0
      get_bomb_explode_event(@csca_bomb_event_id23)
      csca_check_comment(@csca_bomb_explode_event, 5, 23)
    end
    if @csca_bomb_event_id24 != 0
      get_bomb_explode_event(@csca_bomb_event_id24)
      csca_check_comment(@csca_bomb_explode_event, 5, 24)
    end
    if @csca_bomb_event_id25 != 0
      get_bomb_explode_event(@csca_bomb_event_id25)
      csca_check_comment(@csca_bomb_explode_event, 5, 25)
    end
    if @csca_bomb_event_id26 != 0
      get_bomb_explode_event(@csca_bomb_event_id26)
      csca_check_comment(@csca_bomb_explode_event, 5, 26)
    end
    if @csca_bomb_event_id27 != 0
      get_bomb_explode_event(@csca_bomb_event_id27)
      csca_check_comment(@csca_bomb_explode_event, 5, 27)
    end
    if @csca_bomb_event_id28 != 0
      get_bomb_explode_event(@csca_bomb_event_id28)
      csca_check_comment(@csca_bomb_explode_event, 5, 28)
    end
    if @csca_bomb_event_id29 != 0
      get_bomb_explode_event(@csca_bomb_event_id29)
      csca_check_comment(@csca_bomb_explode_event, 5, 29)
    end
    if @csca_bomb_event_id30 != 0
      get_bomb_explode_event(@csca_bomb_event_id30)
      csca_check_comment(@csca_bomb_explode_event, 5, 30)
    end
    if @csca_bomb_event_id31 != 0
      get_bomb_explode_event(@csca_bomb_event_id31)
      csca_check_comment(@csca_bomb_explode_event, 5, 31)
    end
    if @csca_bomb_event_id32 != 0
      get_bomb_explode_event(@csca_bomb_event_id32)
      csca_check_comment(@csca_bomb_explode_event, 5, 32)
    end
    if @csca_bomb_event_id33 != 0
      get_bomb_explode_event(@csca_bomb_event_id33)
      csca_check_comment(@csca_bomb_explode_event, 5, 33)
    end
    if @csca_bomb_event_id34 != 0
      get_bomb_explode_event(@csca_bomb_event_id34)
      csca_check_comment(@csca_bomb_explode_event, 5, 34)
    end
    if @csca_bomb_event_id35 != 0
      get_bomb_explode_event(@csca_bomb_event_id35)
      csca_check_comment(@csca_bomb_explode_event, 5, 35)
    end
    if @csca_bomb_event_id36 != 0
      get_bomb_explode_event(@csca_bomb_event_id36)
      csca_check_comment(@csca_bomb_explode_event, 5, 36)
    end
    if @csca_bomb_event_id37 != 0
      get_bomb_explode_event(@csca_bomb_event_id37)
      csca_check_comment(@csca_bomb_explode_event, 5, 37)
    end
    if @csca_bomb_event_id38 != 0
      get_bomb_explode_event(@csca_bomb_event_id38)
      csca_check_comment(@csca_bomb_explode_event, 5, 38)
    end
    if @csca_bomb_event_id39 != 0
      get_bomb_explode_event(@csca_bomb_event_id39)
      csca_check_comment(@csca_bomb_explode_event, 5, 39)
    end
    if @csca_bomb_event_id40 != 0
      get_bomb_explode_event(@csca_bomb_event_id40)
      csca_check_comment(@csca_bomb_explode_event, 5, 40)
    end
    if @csca_bomb_event_id41 != 0
      get_bomb_explode_event(@csca_bomb_event_id41)
      csca_check_comment(@csca_bomb_explode_event, 5, 41)
    end
    if @csca_bomb_event_id42 != 0
      get_bomb_explode_event(@csca_bomb_event_id42)
      csca_check_comment(@csca_bomb_explode_event, 5, 42)
    end
    if @csca_bomb_event_id43 != 0
      get_bomb_explode_event(@csca_bomb_event_id43)
      csca_check_comment(@csca_bomb_explode_event, 5, 43)
    end
    if @csca_bomb_event_id44 != 0
      get_bomb_explode_event(@csca_bomb_event_id44)
      csca_check_comment(@csca_bomb_explode_event, 5, 44)
    end
    if @csca_bomb_event_id45 != 0
      get_bomb_explode_event(@csca_bomb_event_id45)
      csca_check_comment(@csca_bomb_explode_event, 5, 45)
    end
    if @csca_bomb_event_id46 != 0
      get_bomb_explode_event(@csca_bomb_event_id46)
      csca_check_comment(@csca_bomb_explode_event, 5, 46)
    end
    if @csca_bomb_event_id47 != 0
      get_bomb_explode_event(@csca_bomb_event_id47)
      csca_check_comment(@csca_bomb_explode_event, 5, 47)
    end
    if @csca_bomb_event_id48 != 0
      get_bomb_explode_event(@csca_bomb_event_id48)
      csca_check_comment(@csca_bomb_explode_event, 5, 48)
    end
    if @csca_bomb_event_id49 != 0
      get_bomb_explode_event(@csca_bomb_event_id49)
      csca_check_comment(@csca_bomb_explode_event, 5, 49)
    end
    if @csca_bomb_event_id50 != 0
      get_bomb_explode_event(@csca_bomb_event_id50)
      csca_check_comment(@csca_bomb_explode_event, 5, 50)
    end
    if @csca_bomb_event_id51 != 0
      get_bomb_explode_event(@csca_bomb_event_id51)
      csca_check_comment(@csca_bomb_explode_event, 5, 51)
    end
    if @csca_bomb_event_id52 != 0
      get_bomb_explode_event(@csca_bomb_event_id52)
      csca_check_comment(@csca_bomb_explode_event, 5, 52)
    end
    if @csca_bomb_event_id53 != 0
      get_bomb_explode_event(@csca_bomb_event_id53)
      csca_check_comment(@csca_bomb_explode_event, 5, 53)
    end
    if @csca_bomb_event_id54 != 0
      get_bomb_explode_event(@csca_bomb_event_id54)
      csca_check_comment(@csca_bomb_explode_event, 5, 54)
    end
    if @csca_bomb_event_id55 != 0
      get_bomb_explode_event(@csca_bomb_event_id55)
      csca_check_comment(@csca_bomb_explode_event, 5, 55)
    end
    if @csca_bomb_event_id56 != 0
      get_bomb_explode_event(@csca_bomb_event_id56)
      csca_check_comment(@csca_bomb_explode_event, 5, 56)
    end
    if @csca_bomb_event_id57 != 0
      get_bomb_explode_event(@csca_bomb_event_id57)
      csca_check_comment(@csca_bomb_explode_event, 5, 57)
    end
    if @csca_bomb_event_id58 != 0
      get_bomb_explode_event(@csca_bomb_event_id58)
      csca_check_comment(@csca_bomb_explode_event, 5, 58)
    end
    if @csca_bomb_event_id59 != 0
      get_bomb_explode_event(@csca_bomb_event_id59)
      csca_check_comment(@csca_bomb_explode_event, 5, 59)
    end
    if @csca_bomb_event_id60 != 0
      get_bomb_explode_event(@csca_bomb_event_id60)
      csca_check_comment(@csca_bomb_explode_event, 5, 60)
    end
    if @csca_bomb_event_id61 != 0
      get_bomb_explode_event(@csca_bomb_event_id61)
      csca_check_comment(@csca_bomb_explode_event, 5, 61)
    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
          turn_on_next_ss(@csca_bomb_event_id6) if bombvar == 6
          turn_on_next_ss(@csca_bomb_event_id7) if bombvar == 7
          turn_on_next_ss(@csca_bomb_event_id8) if bombvar == 8
          turn_on_next_ss(@csca_bomb_event_id9) if bombvar == 9
          turn_on_next_ss(@csca_bomb_event_id10) if bombvar == 10
          turn_on_next_ss(@csca_bomb_event_id11) if bombvar == 11
          turn_on_next_ss(@csca_bomb_event_id12) if bombvar == 12
          turn_on_next_ss(@csca_bomb_event_id13) if bombvar == 13
          turn_on_next_ss(@csca_bomb_event_id14) if bombvar == 14
          turn_on_next_ss(@csca_bomb_event_id15) if bombvar == 15
          turn_on_next_ss(@csca_bomb_event_id16) if bombvar == 16
          turn_on_next_ss(@csca_bomb_event_id17) if bombvar == 17
          turn_on_next_ss(@csca_bomb_event_id18) if bombvar == 18
          turn_on_next_ss(@csca_bomb_event_id19) if bombvar == 19
          turn_on_next_ss(@csca_bomb_event_id20) if bombvar == 20
          turn_on_next_ss(@csca_bomb_event_id21) if bombvar == 21
          turn_on_next_ss(@csca_bomb_event_id22) if bombvar == 22
          turn_on_next_ss(@csca_bomb_event_id23) if bombvar == 23
          turn_on_next_ss(@csca_bomb_event_id24) if bombvar == 24
          turn_on_next_ss(@csca_bomb_event_id25) if bombvar == 25
          turn_on_next_ss(@csca_bomb_event_id26) if bombvar == 26
          turn_on_next_ss(@csca_bomb_event_id27) if bombvar == 27
          turn_on_next_ss(@csca_bomb_event_id28) if bombvar == 28
          turn_on_next_ss(@csca_bomb_event_id29) if bombvar == 29
          turn_on_next_ss(@csca_bomb_event_id30) if bombvar == 30
          turn_on_next_ss(@csca_bomb_event_id31) if bombvar == 31
          turn_on_next_ss(@csca_bomb_event_id32) if bombvar == 32
          turn_on_next_ss(@csca_bomb_event_id33) if bombvar == 33
          turn_on_next_ss(@csca_bomb_event_id34) if bombvar == 34
          turn_on_next_ss(@csca_bomb_event_id35) if bombvar == 35
          turn_on_next_ss(@csca_bomb_event_id36) if bombvar == 36
          turn_on_next_ss(@csca_bomb_event_id37) if bombvar == 37
          turn_on_next_ss(@csca_bomb_event_id38) if bombvar == 38
          turn_on_next_ss(@csca_bomb_event_id39) if bombvar == 39
          turn_on_next_ss(@csca_bomb_event_id40) if bombvar == 40
          turn_on_next_ss(@csca_bomb_event_id41) if bombvar == 41
          turn_on_next_ss(@csca_bomb_event_id42) if bombvar == 42
          turn_on_next_ss(@csca_bomb_event_id43) if bombvar == 43
          turn_on_next_ss(@csca_bomb_event_id44) if bombvar == 44
          turn_on_next_ss(@csca_bomb_event_id45) if bombvar == 45
          turn_on_next_ss(@csca_bomb_event_id46) if bombvar == 46
          turn_on_next_ss(@csca_bomb_event_id47) if bombvar == 47
          turn_on_next_ss(@csca_bomb_event_id48) if bombvar == 48
          turn_on_next_ss(@csca_bomb_event_id49) if bombvar == 49
          turn_on_next_ss(@csca_bomb_event_id50) if bombvar == 50
          turn_on_next_ss(@csca_bomb_event_id51) if bombvar == 51
          turn_on_next_ss(@csca_bomb_event_id52) if bombvar == 52
          turn_on_next_ss(@csca_bomb_event_id53) if bombvar == 53
          turn_on_next_ss(@csca_bomb_event_id54) if bombvar == 54
          turn_on_next_ss(@csca_bomb_event_id55) if bombvar == 55
          turn_on_next_ss(@csca_bomb_event_id56) if bombvar == 56
          turn_on_next_ss(@csca_bomb_event_id57) if bombvar == 57
          turn_on_next_ss(@csca_bomb_event_id58) if bombvar == 58
          turn_on_next_ss(@csca_bomb_event_id59) if bombvar == 59
          turn_on_next_ss(@csca_bomb_event_id60) if bombvar == 60
          turn_on_next_ss(@csca_bomb_event_id61) if bombvar == 61
        end
      end
    end
    end # unless event == nil
  end
 
end

Sixth Script works and is more robust. Leaving mine for burial ritual.:frown::smile::wink:
 
Last edited:

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
823
First Language
Hungarian
Primarily Uses
RMVXA
That code... uhh... :D
I suppose you followed CSCA's original code (pretty rigid, if I remember right)?

I did not test this at all, but I would do it this way instead:
Code:
module CSCA_DUNGEON_TOOLS # Don't touch this.
  # Value 1 - infinity
  BOMB_DISTANCE = 5 # how many squares away from bomb rounded into a circle
end

class Game_Map
 
  include CSCA_DUNGEON_TOOLS
 
  def do_bomb_effect(bomb)
    xx = bomb.x
    yy = bomb.y
    cords = [] # Co-ordinates to check
    evs = []   # Events in range
    rdist = CSCA_DUNGEON_TOOLS::BOMB_DISTANCE + 1
    rdist.times do |xi|
      rdist.times do |yi|
        [-1,1].each do |xm|
          [-1,1].each do |ym|
            next if xi + yi > CSCA_DUNGEON_TOOLS::BOMB_DISTANCE
            ex = xx + xi * xm
            ey = yy + yi * ym
            cords << [ex,ey]
          end
        end
      end
    end
    cords.uniq!
    cords.each do |cord|
      next unless valid?(*cord) # Skip out of map cords
      eid = event_id_xy(*cord)
      next if evs.include?(eid) # Skip already activated events
      evs << eid
      get_bomb_explode_event(eid)
      csca_check_comment(@csca_bomb_explode_event, 5, eid)
    end
  end
  
  def csca_check_comment(event, tool, bombvar = 0)
    return unless event
    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(bombvar)
        end
      end
    end
  end
 
end
Much more elegant, I guess.

You can also make different distance for different bomb types by getting the distance from an event comment instead, for example, in case you need multiple bomb types during the game. Assuming that the bomb argument is an event, of course, I didn't check that either. :p
 
Last edited:

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,674
Reaction score
566
First Language
English
Primarily Uses
RMVXA
I did not test this
Gives an error
Code:
Sixth DT addon:20:in `block (4 levels) in do_bomb_effect': undefined local variable or method `dist' for #<Game_Map:0x11bb25b8>, NameError
    from Sixth DT addon:19:in `each'
    from Sixth DT addon:19:in `block (3 levels) in do_bomb_effect'
    from Sixth DT addon:18:in `each'
    from Sixth DT addon:18:in `block (2 levels) in do_bomb_effect'
    from Sixth DT addon:17:in `times'
    from Sixth DT addon:17:in `block in do_bomb_effect'
    from Sixth DT addon:16:in `times'
    from Sixth DT addon:16:in `do_bomb_effect'
    from CSCA | DungeonTools:435:in `bomb_explode'
    from CSCA | DungeonTools:406:in `csca_check_steps'
    from CSCA | DungeonTools:358:in `csca_update'
    from CSCA | DungeonTools:350:in `update'

And yes I just used the same script layout. Don't know enough yet to attempt what you did.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,674
Reaction score
566
First Language
English
Primarily Uses
RMVXA
created moving enemies to hit with the Arrow Tool,
I just tested this, and the only issue I had was if the enemy was on the highest move setting. Having the enemy on normal speed but highest frequency worked fine.
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
823
First Language
Hungarian
Primarily Uses
RMVXA
Opps, that was a copy/paste left-over. I made that co-ord logic for another project, forgot to change that variable name. :p
Fixed it.
 

Tw0Face

Master Strategist
Veteran
Joined
Nov 12, 2018
Messages
430
Reaction score
370
First Language
German
Primarily Uses
RMVXA
Thank you very much. The Bomb Addon seems to work fine. You guys are great! :rock-right:

Now all I have to do is to find out how to use Arrow and Bomb together. At the moment, I have the Bomb or Arrow equipped automatically when an event is triggered, meaning they're items and I've to collect them from the map to use them. At the moment, it seems that the tools overwrite each other. If I collect a bomb, my arrow is gone. If I collect an arrow, then my previously collected bomb is gone as well. I'm sure that I can stop this behavior somehow.

@ Another Fen:
For example, at ARROW_DIST = 8 it should be impossible to hit a target from point blank range that is passing by at normal speed.
I don't think I understand what you mean by that. Do you mean that I can use the ARROW_DIST to calculate whether an Arrow hits or not?

Greetings,
Tw0Face
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.

Forum statistics

Threads
106,036
Messages
1,018,461
Members
137,821
Latest member
Capterson
Top