Poszukuję Mouse system którym będziemy chodzić za pomocą myszki, a nie klawiatury. Potrzebuję też jakiegoś systemu walki w czasie rzeczywistym który pozwoli na atakowanie myszką lub zwykłego dobrego ABS. Mam pytanie jak zrobić tylko 1 bohatera gry? Czy istnieje skrypt który wprowadza rasy np. człowiek, krasnolud? Szukam skryptu który pozwoli wybrać na początku rasę i klasę postaci.
Rasa i klasa na zdarzeniach. Zmiana klas grafik itp.
Z ABS-em współpracującym z ABS-em nie słyszałem, ale
znalazłem jakiś dobry mouse system:
Spoiler:
Kod:
#===============================================================================
# Mouse System
# By Jet10985 (Jet)
# Some Code by: Woratana, Berka
# Uses: Modern Algebra's Path Finding Script
# Super Heavy Testing/Debug Help By: Nathanial (Beleren)
#===============================================================================
# This script will allow full use of the mouse inside of rmvx for various
# purposes.
# This script has: 5 customization options.
#===============================================================================
# Overwritten Methods:
# None
#-------------------------------------------------------------------------------
# Aliased methods:
# Scene_Map: update, terminate, update_transfer_player
# Input: update, trigger?, press?, repeat?
# Window_Selectable: update, top_row=
# Game_Player: move_type_custom, update
# Scene_File: update
# Window_NameInput: update
# Game_System: initialize
# Game_Temp: initialize
# Game_Event: initialize
#===============================================================================
#==============================================================================
# Path Finding
# Version: 2.0
# Author: modern algebra (rmrk.net)
# Date: April 10, 2008
#==============================================================================
# Thanks:
# Patrick Lester! For his tutorial on A* Pathfinding algorithm (found at:
# http://www.gamedev.net/reference/articles/article2003.asp) as well as
# another amazingly helpful tutorial on using binary heaps (found at:
# http://www.policyalmanac.org/games/binaryHeaps.htm). Without his excellent
# tutorials, this script would not exist. So major thanks to him.
# Zeriab, for tricking me into believing that this was an actual exercise.
# Also, his table printout actually makes Tables useable :P
#==============================================================================
# Instructions:
# To use, merely use this code in a script call INSIDE a Move Event:
#
# find_path (target_x, target_y, diagonal, max_iterations)
#
# where target_x and target_y are the target coordinates and diagonal is an
# optional boolean value (true or false) stating whether or not to allow
# diagonal movement. max_iterations is also optional, and you can set this if
# you want the algorithm to quit if it is taking too long. The number you set
# here refers to how many nodes you let it search through before cancelling
# the process. If this is set to 0, it will take as many iterations as
# necessary to find the shortest path.
#
# You can also set a default value for diagonal and max_iterations
# by call script with the codes:
#
# $game_system.pathfinding_diagonal = true/false # Allow diagonal movement
# $game_system.pathfinding_iterations = integer # When <= 0, no limit
#
# For scripters, you can force-move a character down a path via:
#
# character.force_path (x, y, diagonal, max_iterations)
#
# character is any Game_Character object, such as $game_player or an event.
#
# Then, when you do not specifically set diagonal or limit, it will default
# to the values you set in there
#==============================================================================
=begin
Showing text above event when mouse hovers:
If you want a message to appear over an event's head if the mouse is hovering
over the event, put this comment in the event:
MOUSE TEXT MESSAGE HERE
everything after TEXT will be the hovering display.
--------------------------------------------------------------------------------
Change mouse picture above event when mouse hovers:
If you want the mouse's picture to temporarily change whne over an event, put
this comment in the event
MOUSE PIC NAME/NUMBER
if you put a name, the mouse will become that picture, but if you put a number
then the mouse will become the icon that is the id number
--------------------------------------------------------------------------------
Specific mouse click movement routes:
If you want the player to land specifically in a square around an event when
they click to move on the event, put one of these comments in the event:
MOUSE MOVE UP/LEFT/RIGHT/DOWN
only put the direction that you want the player to land on.
--------------------------------------------------------------------------------
Click to activate:
If you want an event to automatically start when it is clicked on, place
this in an event comment:
MOUSE CLICK
--------------------------------------------------------------------------------
Control event with mouse:
If you want the player to control an event with the mouse, put this comment
in the event:
MOUSE CONTROL
the player must right-click on this event to take control. they can switch
control back to the main player by right-clicking the main player
--------------------------------------------------------------------------------
Don't stop the player when walking over a touch event:
By default, this script will stop a mouse-caused movement if the player walks
over/under a player touch/event touch event. If you want the event to activate,
but for the player to keep walking to their destination, put this comment in the
event:
To have an event be ignored when the mouse makes it's movement path (as if the
event isn't there), put this comment in the event:
MOUSE THROUGH
--------------------------------------------------------------------------------
Extra Notes:
In selectable windows that have more items than what's shown, players can
either put the mouse below the window to scroll down, OR use the mouse's
scroll wheel to scroll up/down.
You can activate action button events by standing next to the event and clicking
on it with the mouse.
=end
module JetMouse
# If you are using a graphic, this is it.
# It must be in the Graphics/System folder.
CURSOR_PICTURE = "cursor-mouse"
# If you aren't using a graphic, this icon will be the mouse.
# To use the icon, just put a non-existant picture as the above config
ICON_INDEX = 3
# Do you want the player to be able to move by clicking the mouse?
ALLOW_MOUSE_MOVEMENT = true
# Do you want mouse movement to do 8-dir walking?
DO_8DIR_WALKING = false
# Turning this switch on will make the mouse invisible and unusuable until
# the switch is turned off
TURN_MOUSE_OFF_SWITCH = 20
end
#===============================================================================
# DON'T EDIT FURTHER UNLESS YOU KNOW WHAT TO DO.
#===============================================================================
module Mouse
def click?(button)
return false if $game_switches[JetMouse::TURN_MOUSE_OFF_SWITCH]
return true if @keys.include?(button)
return false
end
def press?(button)
return false if $game_switches[JetMouse::TURN_MOUSE_OFF_SWITCH]
return true if @press.include?(button)
return false
end
def set_pos(x_pos = 0, y_pos = 0)
width,height = client_size
if (x_pos.between?(0, width) && y_pos.between?(0, height))
SetCursorPos.call(client_pos[0] + x_pos,client_pos[1] + y_pos)
end
end
def update
return if $game_switches[JetMouse::TURN_MOUSE_OFF_SWITCH]
@pos = Mouse.pos
@keys, @press = [], []
@keys.push(1) if GetAsyncKeyState.call(1)&0x01==1
@keys.push(2) if GetAsyncKeyState.call(2)&0x01==1
@keys.push(3) if GetAsyncKeyState.call(4)&0x01==1
@press.push(1) if pressed?(1)
@press.push(2) if pressed?(2)
@press.push(3) if pressed?(4)
end
def pressed?(key)
return true unless GetKeyState.call(key).between?(0, 1)
return false
end
def pos
return 0, 0 if $game_switches[JetMouse::TURN_MOUSE_OFF_SWITCH]
x, y = screen_to_client(*global_pos)
width, height = client_size
begin
x = 0 if x <= 0; y = 0 if y <= 0
x = width if x >= width; y = height if y >= height
return x, y
end
end
def screen_to_client(x, y)
return nil unless x && y
pos = [x, y].pack('ll')
ScreenToClient.call(@handle, pos) != 0 ?(return pos.unpack('ll')):(return nil)
end
def client_size
rect = [0, 0, 0, 0].pack('l4')
GetClientRect.call(@handle, rect)
right,bottom = rect.unpack('l4')[2..3]
return right, bottom
end
def client_pos
rect=[0, 0, 0, 0].pack('l4')
GetWindowRect.call(@handle, rect)
left, upper = rect.unpack('l4')[0..1]
return left + 4, upper + 30
end
def grid
return [-1, -1] if $game_switches[JetMouse::TURN_MOUSE_OFF_SWITCH]
return nil if @pos.nil?
return [(@pos[0]/32), (@pos[1]/32)]
end
def area?(x, y, width, height)
return false if $game_switches[JetMouse::TURN_MOUSE_OFF_SWITCH]
return false if @pos.nil?
return @pos[0].between?(x, width + x) && @pos[1].between?(y, height + y)
end
def scroll
msg="\0"*32;Get_Message.call(msg,0,0,0);r=wmcallback(unpack_msg(msg))
return r if !r.nil?
end
end
def change_cursor(cursor)
self.bitmap.dispose unless self.bitmap.nil?
self.bitmap = nil
begin
self.bitmap = Cache.system(cursor)
@current_cursor = cursor
@not_default = true
rescue
begin
self.bitmap = Bitmap.new(24, 24)
bitmap = Cache.system("Iconset")
rect = Rect.new(cursor % 16 * 24, cursor / 16 * 24, 24, 24)
self.bitmap.blt(0, 0, bitmap, rect)
@current_cursor = cursor
@not_default = true
rescue
create_cursor(CURSOR_PICTURE)
end
end
end
def update
if $game_switches[TURN_MOUSE_OFF_SWITCH]
self.opacity = 0 unless self.opacity == 0
end
self.opacity = 255 unless self.opacity == 255
super
x = self.x
y = self.y
self.x, self.y = Mouse.pos
self.x -= 8 if @not_default
self.y -= 8 if @not_default
end
def dispose
super
end
end
$cursor = Sprite_Cursor.new
module Input
class << self
alias jet5888_press? press? unless $@
def press?(arg)
if arg == Input::C
return true if Mouse.click?(1)
elsif arg == Input::B
return true if Mouse.click?(2)
end
jet5888_press?(arg)
end
alias jet5888_repeat? repeat? unless $@
def repeat?(arg)
if arg == Input::C
return true if Mouse.click?(1)
elsif arg == Input::B
return true if Mouse.click?(2)
end
jet5888_repeat?(arg)
end
alias jet5888_trigger? trigger? unless $@
def trigger?(arg)
if arg == Input::C
return true if Mouse.click?(1)
elsif arg == Input::B
return true if Mouse.click?(2)
end
jet5888_trigger?(arg)
end
alias jet8432_update update unless $@
def update
jet8432_update
if $game_switches[JetMouse::TURN_MOUSE_OFF_SWITCH] && $cursor.opacity != 0
$cursor.opacity = 0
end
$cursor.update unless $game_switches[JetMouse::TURN_MOUSE_OFF_SWITCH]
Mouse.update unless $game_switches[JetMouse::TURN_MOUSE_OFF_SWITCH]
end
end
end
class Game_System
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Public Instance Variables
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr_accessor :pathfinding_diagonal
attr_accessor :pathfinding_iterations
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias modalg_pathfinding_options_init_j5yt initialize unless $@
def initialize
modalg_pathfinding_options_init_j5yt
@pathfinding_diagonal = false
@pathfinding_iterations = 0
end
end
#==============================================================================
# ** Game_Character
#==============================================================================
# Summary of Changes:
# new methods - find_path
#==============================================================================
class Game_Character
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Find Path
# trgt_x, trgt_y : the target coordinates
# diagonal : Is diagonal movement allowed?
# max_iterations : maximum number of iterations
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def find_path (trgt_x, trgt_y, diagonal = $game_system.pathfinding_diagonal,
max_iterations = $game_system.pathfinding_iterations)
path = $game_map.find_path (self.x, self.y, trgt_x, trgt_y, diagonal,
max_iterations, self)
# Add the path to the move route being executed.
@move_route.list.delete_at (@move_route_index)
path.each { |i| @move_route.list.insert (@move_route_index, i) }
@move_route_index -= 1
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Force Path
# trgt_x, trgt_y : target coordinates
# diagonal : Is diagonal movement allowed?
# max_iterations : maximum number of iterations
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def force_path (trgt_x, trgt_y, diagonal = $game_system.pathfinding_diagonal,
max_iterations = $game_system.pathfinding_iterations)
path = $game_map.find_path (self.x, self.y, trgt_x, trgt_y, diagonal,
max_iterations, self)
# The path retrieved is actually backwards, so it must be reversed
return nil if path.empty?
return nil if trgt_x == self.x && trgt_y == self.y
path.reverse!
# Add an end ccommand
path.push (RPG::MoveCommand.new (0))
move_route = RPG::MoveRoute.new
move_route.list = path
move_route.repeat = false
force_move_route (move_route)
end
end
#==============================================================================
# ** Game_Map
#==============================================================================
# Summary of Changes:
# new method - removefrom_binaryheap, find_path
#==============================================================================
class Game_Map
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Remove from Heap
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def removefrom_binaryheap
@open_nodes[1] = @open_nodes[@listsize]
@listsize -= 1
v = 1
loop do
u = v
w = 2*u
# Check if it's cost is greater than that of it's children
if w + 1 <= @listsize # If both children exist
v = w if @total_cost[@open_nodes[u]] >= @total_cost[@open_nodes[w]]
v = w + 1 if @total_cost[@open_nodes[v]] >= @total_cost[@open_nodes[w + 1]]
elsif w <= @listsize # If only one child exists
v = w if @total_cost[@open_nodes[u]] >= @total_cost[@open_nodes[w]]
end
# Break if parent has less cost than it's children
if u == v
break
else
temp = @open_nodes[u]
@open_nodes[u] = @open_nodes[v]
@open_nodes[v] = temp
end
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Find Path
# src_x, src_y : the source coordinates
# trgt_x, trgt_y : the target coordinates
# diagonal : Is diagonal movement allowed?
# max_iterations : maximum number of iterations
# char : character to follow the path
#--------------------------------------------------------------------------
# Uses the A* method of pathfinding to find a path
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def find_path (src_x, src_y, trgt_x, trgt_y, diagonal, max_iterations, char)
# No possible path if the target itself is impassable
$game_temp.making_path = true
path = []
# Finished if Target Location is closed
return path if !char.passable? (trgt_x, trgt_y)
# Initialize
max_elements = width*height + 2
openx = Table.new (max_elements)
openy = Table.new (max_elements)
@open_nodes = Table.new (max_elements)
@total_cost = Table.new (max_elements)
heuristic = Table.new (max_elements)
step_cost = Table.new (width, height)
parent_x = Table.new (width, height)
parent_y = Table.new (width, height)
actual_list = Table.new (width, height)
# Add the source node to the open list
new_openid = 1
@open_nodes[1] = 1
openx[1] = src_x
openy[1] = src_y
dist = [(trgt_x - src_x).abs, (trgt_y - src_y).abs]
heuristic[1] = diagonal ? (dist.max*14) + (dist.min*10) : (dist[0] + dist[1])*10
@total_cost[1] = heuristic[1]
actual_list[src_x, src_y] = 1
@listsize = 1
count = 0
loop do
break if actual_list[trgt_x, trgt_y] != 0
count += 1
# Update Graphics every 500 iterations
Graphics.update if count % 500 == 0
return path if count == max_iterations
return path if @listsize == 0
node = @open_nodes[1]
# Set the x and y value as parent to all possible children
parent_xval, parent_yval = openx[node], openy[node]
actual_list[parent_xval, parent_yval] = 2
removefrom_binaryheap
# Check all adjacent squares
for i in 0...8
break if i > 3 && !diagonal
# Get the node
x, y = case i
when 0 then [parent_xval, parent_yval - 1] # UP
when 1 then [parent_xval, parent_yval + 1] # DOWN
when 2 then [parent_xval - 1, parent_yval] # LEFT
when 3 then [parent_xval + 1, parent_yval] # RIGHT
when 4 then [parent_xval - 1, parent_yval - 1] # UP LEFT
when 5 then [parent_xval + 1, parent_yval - 1] # UP RIGHT
when 6 then [parent_xval - 1, parent_yval + 1] # DOWN LEFT
when 7 then [parent_xval + 1, parent_yval + 1] # DOWN RIGHT
end
# Next if this node is already in the closed list
next if actual_list[x,y] == 2
# Next if this tile in impassable
next unless char.passable? (x, y) # Is the tile passable?
# Take into account diagonal passability concerns
if i > 3
next unless case i
when 4 then char.passable? (x + 1, y) || char.passable? (x, y + 1)
when 5 then char.passable? (x - 1, y) || char.passable? (x, y + 1)
when 6 then char.passable? (x + 1, y) || char.passable? (x, y - 1)
when 7 then char.passable? (x - 1, y) || char.passable? (x, y - 1)
end
end
# Check if this node already open
plus_step_cost = ((x - parent_xval).abs + (y - parent_yval).abs) > 1 ? 14 : 10
temp_step_cost = step_cost[parent_xval, parent_yval] + plus_step_cost
if actual_list[x,y] == 1
# If this is a better path to that node
if temp_step_cost < step_cost[x, y]
# Change Parent, step, and total cost
parent_x[x, y] = parent_xval
parent_y[x, y] = parent_yval
step_cost[x, y] = temp_step_cost
# Find index of this position
index = 1
while index < @listsize
index += 1
break if openx[@open_nodes[index]] == x &&
openy[@open_nodes[index]] == y
end
@total_cost[@open_nodes[index]] = temp_step_cost + heuristic[@open_nodes[index]]
else
next
end
else # If not on open nodes
# Add to open nodes
new_openid += 1 # New Id for new item
@listsize += 1 # Increase List Size
@open_nodes[@listsize] = new_openid
step_cost[x, y] = temp_step_cost
# Calculate Heuristic
d = [(trgt_x - x).abs, (trgt_y - y).abs]
heuristic[new_openid] = diagonal ? (d.max*14) + (d.min*10) : (d[0] + d[1])*10
@total_cost[new_openid] = temp_step_cost + heuristic[new_openid]
parent_x[x, y] = parent_xval
parent_y[x, y] = parent_yval
openx[new_openid] = x
openy[new_openid] = y
index = @listsize
actual_list[x, y] = 1
end
# Sort Binary Heap
while index != 1
temp_node = @open_nodes[index]
if @total_cost[temp_node] <= @total_cost[@open_nodes[index / 2]]
@open_nodes[index] = @open_nodes[index / 2]
index /= 2
@open_nodes[index] = temp_node
else
break
end
end
end
end
# Get actual target node
path_x, path_y = trgt_x, trgt_y
# Make an array of MoveRoute Commands
while path_x != src_x || path_y != src_y
# Get Parent x, Parent Y
prnt_x, prnt_y = parent_x[path_x, path_y], parent_y[path_x, path_y]
# DOWN = 1, LEFT = 2, RIGHT = 3, UP = 4, DL = 5, DR = 6, UL = 7, UR = 8
if path_x < prnt_x # LEFT
# Determine if upper, lower or direct left
code = path_y < prnt_y ? 7 : path_y > prnt_y ? 5 : 2
elsif path_x > prnt_x # RIGHT
# Determine if upper, lower or direct right
code = path_y < prnt_y ? 8 : path_y > prnt_y ? 6 : 3
else # UP or DOWN
code = path_y < prnt_y ? 4 : 1
end
path.push (RPG::MoveCommand.new (code))
path_x, path_y = prnt_x, prnt_y
end
$game_temp.making_path = false
return path
end
end
alias jet6742_initialize initialize unless $@
def initialize
jet6742_initialize
@move_because_of_mouse = true
@no_action_event_check = false
@making_path = false
end
end
class Window_Selectable
alias jet6742_update update unless $@
def update(*args)
jet6742_update(*args)
form_rect_array if @rect_array.nil?
update_mouse if self.active && self.visible && !@rect_array.nil?
end
alias jet7222_top_row top_row= unless $@
def top_row=(*args)
@last_cursor_move = 0 if @last_cursor_move.nil?
@last_cursor_move -= 1
return if @in_rect_loop || @last_cursor_move > 0
jet7222_top_row(*args)
@last_cursor_move = 10
end
def form_rect_array
@rect_array = []
orig_index = @index
@in_rect_loop = true
(0..@item_max - 1).each do |i|
@index = i
update_cursor
rect = self.cursor_rect
ix = self.x + 16 + rect.x
iy = self.y + 16 + rect.y
@rect_array.push(Rect.new(ix, iy, rect.width, rect.height))
end
@in_rect_loop = false
@index = orig_index
update
end
def update_mouse
f = Mouse.scroll
if !f.nil?
if f[2] < 0
if contents.height > self.height && self.oy - contents.height < -self.height + 32
self.top_row = self.top_row + 1
end
else
self.top_row = self.top_row - 1 if contents.height > self.height
end
end
original_index = @index
fake_index = -2
for rect in @rect_array
if Mouse.area?(rect.x - self.ox, rect.y - self.oy, rect.width, rect.height)
fake_index = @rect_array.index(rect)
break
end
end
@index = fake_index == -2 ? original_index : fake_index
update_cursor
end
end
class Window_NameInput < Window_Base
alias wor_winnam_upd_mouse update unless $@
def update
wor_winnam_upd_mouse
if self.active and self.visible
(0..TABLE[@mode].size - 1).each do |i|
irect = item_rect(i)
irx = self.x + 16 + irect.x - self.ox
iry = self.y + 16 + irect.y - self.oy
@index = i if Mouse.area?(irx, iry, irect.width, irect.height)
end
end
end
end
class Window_PartyCommand < Window_Command
def update_mouse
(0..@item_max - 1).each do |i|
irect = item_rect(i)
irx = self.viewport.ox + 16 + irect.x - self.ox
iry = 288 + 16 + irect.y - self.oy
self.index = i if Mouse.area?(irx, iry, irect.width, irect.height)
end
end
end
class Window_ActorCommand < Window_Command
def update_mouse
(0..@item_max - 1).each do |i|
irect = item_rect(i)
irx = self.viewport.ox + 288 + 16 + irect.x
iry = 288 + 16 + irect.y
self.index = i if Mouse.area?(irx, iry, irect.width, irect.height)
end
end
end
class Window_Message < Window_Selectable
def update_mouse
(0..@item_max - 1).each do |i|
irect = item_rect(i)
irx = self.x + 16 + irect.x - self.ox
iry = self.y + 16 + irect.y - self.oy + ($game_message.choice_start * WLH)
self.index = i if Mouse.area?(irx, iry, irect.width, irect.height)
end
end
end
class Window_ShopSell
def refresh
super
form_rect_array
end
end
class Scene_File < Scene_Base
alias wor_scefil_upd_mouse update unless $@
def update
(0..@item_max - 1).each do |i|
ix = @savefile_windows[i].x
iy = @savefile_windows[i].y
iw = @savefile_windows[i].width
ih = @savefile_windows[i].height
if Mouse.area?(ix, iy, iw, ih)
@savefile_windows[@index].selected = false
@savefile_windows[i].selected = true
@index = i
end
end
wor_scefil_upd_mouse
end
end
class Window_EventPopUp < Window_Base
def initialize(x, y, width, height, text)
super(x, y, width, height)
self.opacity = 0
@text = text
refresh
end
def refresh
self.contents.clear
self.contents.draw_text(0, 0, self.width, 24, @text)
end
end
def check_for_comment(regexp)
return false if @list.nil?
for item in @list
if item.code == 108 or item.code == 408
if !item.parameters[0][regexp].nil?
return $1.nil? ? true : $1
end
end
end
return false
end
def through
return true if check_for_comment(/MOUSE THROUGH/i) && $game_temp.making_path
return @through
end
end
class Scene_Map
alias jet6742_update update unless $@
def update
if !$game_message.visible
update_popup_windows
update_mouse_left_click
update_mouse_right_click
end
update_mouse_change
jet6742_update
end
alias jet7811_terminate terminate unless $@
def terminate
for event in $game_map.events.values
next if event.popup_window.nil?
event.popup_window.dispose unless event.popup_window.disposed?
event.popup_window = nil
end
$cursor.create_cursor(JetMouse::CURSOR_PICTURE) if ![JetMouse::CURSOR_PICTURE,
JetMouse::ICON_INDEX].include?($cursor.current_cursor)
$cursor.opacity = 0
jet7811_terminate
$cursor.opacity = 255 unless $game_switches[JetMouse::TURN_MOUSE_OFF_SWITCH]
end
alias jet8887_update_transfer_player update_transfer_player unless $@
def update_transfer_player
if $game_player.transfer?
$cursor.create_cursor(JetMouse::CURSOR_PICTURE) if ![JetMouse::CURSOR_PICTURE,
JetMouse::ICON_INDEX].include?($cursor.current_cursor)
end
jet8887_update_transfer_player
end
def update_popup_windows
add_x = $game_map.display_x / 256
add_y = $game_map.display_y / 256
for event in $game_map.events.values
if Mouse.grid[0] + add_x == event.x && Mouse.grid[1] + add_y == event.y
f = event.check_for_comment(/MOUSE TEXT (.+)/i)
if f != false
q = Bitmap.new(1, 1)
size = q.text_size(f)
x = event.screen_x - 16 - size.width / 2
y = event.screen_y - 52 - size.height / 2
if event.popup_window != nil
event.popup_window.dispose
event.popup_window = nil
end
event.popup_window = Window_EventPopUp.new(x, y,
size.width + 34, size.height + 34, f)
q.dispose
q = nil
end
else
if event.popup_window != nil
event.popup_window.dispose
event.popup_window = nil
end
end
end
end
def update_mouse_change
return if $game_switches[JetMouse::TURN_MOUSE_OFF_SWITCH]
if $game_message.visible || $game_map.screen.brightness == 0 ||
$game_map.screen.fadein_duration != 0 || $game_map.screen.fadeout_duration != 0
$cursor.create_cursor(JetMouse::CURSOR_PICTURE) if ![JetMouse::CURSOR_PICTURE,
JetMouse::ICON_INDEX].include?($cursor.current_cursor)
return
end
add_x = $game_map.display_x / 256
add_y = $game_map.display_y / 256
for event in $game_map.events.values
if Mouse.grid[0] + add_x == event.x && Mouse.grid[1] + add_y == event.y
f = event.check_for_comment(/MOUSE PIC (.+)/i)
if f != false
if f.to_i != 0
$cursor.change_cursor(f.to_i) unless $cursor.current_cursor == f.to_i
else
$cursor.change_cursor(f) unless $cursor.current_cursor == f
end
did_change = true
end
end
break if did_change
end
$cursor.create_cursor(JetMouse::CURSOR_PICTURE) if did_change.nil? &&
![JetMouse::CURSOR_PICTURE, JetMouse::ICON_INDEX].include?($cursor.current_cursor)
end
def parallel_move
for event in $game_map.events.values
next unless event.trigger == 4
next unless !event.interpreter.nil? && event.interpreter.running?
if !event.interpreter.moving_character.nil? &&
event.interpreter.moving_character.move_route_forcing
return true
end
end
return false
end
def do_closest_path_check(ev)
se = $game_temp.mouse_controlled_object
sx = se.x - ev.x
sy = se.y - ev.y
if sx != 0 or sy != 0
if sx.abs >= sy.abs
if sx >= 0
if $game_map.passable?(ev.x + 1, ev.y)
return [ev.x + 1, ev.y] unless $game_map.find_path(se.x, se.y,
ev.x + 1, ev.y, false, 0, se).empty?
end
if sy >= 0
if $game_map.passable?(ev.x, ev.y + 1)
return [ev.x, ev.y + 1] unless $game_map.find_path(se.x, se.y,
ev.x, ev.y + 1, false, 0, se).empty?
end
else
if $game_map.passable?(ev.x, ev.y - 1)
return [ev.x, ev.y - 1] unless $game_map.find_path(se.x, se.y,
ev.x, ev.y - 1, false, 0, se).empty?
end
end
if $game_map.passable?(ev.x - 1, ev.y)
return [ev.x - 1, ev.y] unless $game_map.find_path(se.x, se.y,
ev.x - 1, ev.y, false, 0, se).empty?
end
if sy < 0
if $game_map.passable?(ev.x, ev.y + 1)
return [ev.x, ev.y + 1] unless $game_map.find_path(se.x, se.y,
ev.x, ev.y + 1, false, 0, se).empty?
end
else
if $game_map.passable?(ev.x, ev.y - 1)
return [ev.x, ev.y - 1] unless $game_map.find_path(se.x, se.y,
ev.x, ev.y - 1, false, 0, se).empty?
end
end
elsif sx < 0
if $game_map.passable?(ev.x - 1, ev.y)
return [ev.x - 1, ev.y] unless $game_map.find_path(se.x, se.y,
ev.x - 1, ev.y, false, 0, se).empty?
end
if sy >= 0
if $game_map.passable?(ev.x, ev.y + 1)
return [ev.x, ev.y + 1] unless $game_map.find_path(se.x, se.y,
ev.x, ev.y + 1, false, 0, se).empty?
end
else
if $game_map.passable?(ev.x, ev.y - 1)
return [ev.x, ev.y - 1] unless $game_map.find_path(se.x, se.y,
ev.x, ev.y - 1, false, 0, se).empty?
end
end
if $game_map.passable?(ev.x + 1, ev.y)
return [ev.x + 1, ev.y] unless $game_map.find_path(se.x, se.y,
ev.x + 1, ev.y, false, 0, se).empty?
end
if sy < 0
if $game_map.passable?(ev.x, ev.y + 1)
return [ev.x, ev.y + 1] unless $game_map.find_path(se.x, se.y,
ev.x, ev.y + 1, false, 0, se).empty?
end
else
if $game_map.passable?(ev.x, ev.y - 1)
return [ev.x, ev.y - 1] unless $game_map.find_path(se.x, se.y,
ev.x, ev.y - 1, false, 0, se).empty?
end
end
end
else
if sy > 0
if $game_map.passable?(ev.x, ev.y + 1)
return [ev.x, ev.y + 1] unless $game_map.find_path(se.x, se.y,
ev.x, ev.y + 1, false, 0, se).empty?
end
if sx >= 0
if $game_map.passable?(ev.x + 1, ev.y)
return [ev.x + 1, ev.y] unless $game_map.find_path(se.x, se.y,
ev.x + 1, ev.y, false, 0, se).empty?
end
else
if $game_map.passable?(ev.x - 1, ev.y)
return [ev.x - 1, ev.y] unless $game_map.find_path(se.x, se.y,
ev.x - 1, ev.y, false, 0, se).empty?
end
end
if $game_map.passable?(ev.x, ev.y - 1)
return [ev.x, ev.y - 1] unless $game_map.find_path(se.x, se.y,
ev.x, ev.y - 1, false, 0, se).empty?
end
if sx < 0
if $game_map.passable?(ev.x + 1, ev.y)
return [ev.x + 1, ev.y] unless $game_map.find_path(se.x, se.y,
ev.x + 1, ev.y, false, 0, se).empty?
end
else
if $game_map.passable?(ev.x - 1, ev.y)
return [ev.x - 1, ev.y] unless $game_map.find_path(se.x, se.y,
ev.x - 1, ev.y, false, 0, se).empty?
end
end
elsif sy < 0
if $game_map.passable?(ev.x, ev.y - 1)
return [ev.x, ev.y - 1] unless $game_map.find_path(se.x, se.y,
ev.x, ev.y - 1, false, 0, se).empty?
end
if sx >= 0
if $game_map.passable?(ev.x + 1, ev.y)
return [ev.x + 1, ev.y] unless $game_map.find_path(se.x, se.y,
ev.x + 1, ev.y, false, 0, se).empty?
end
else
if $game_map.passable?(ev.x - 1, ev.y)
return [ev.x - 1, ev.y] unless $game_map.find_path(se.x, se.y,
ev.x - 1, ev.y, false, 0, se).empty?
end
end
if $game_map.passable?(ev.x, ev.y + 1)
return [ev.x, ev.y + 1] unless $game_map.find_path(se.x, se.y,
ev.x, ev.y + 1, false, 0, se).empty?
end
if sx < 0
if $game_map.passable?(ev.x + 1, ev.y)
return [ev.x + 1, ev.y] unless $game_map.find_path(se.x, se.y,
ev.x + 1, ev.y, false, 0, se).empty?
end
else
if $game_map.passable?(ev.x - 1, ev.y)
return [ev.x - 1, ev.y] unless $game_map.find_path(se.x, se.y,
ev.x - 1, ev.y, false, 0, se).empty?
end
end
end
end
end
return false
end
def update_mouse_left_click
return if $game_map.interpreter.running? or parallel_move or
$game_map.screen.brightness == 0 ||
$game_map.screen.fadein_duration != 0 || $game_map.screen.fadeout_duration != 0
add_x = $game_map.display_x / 256
add_y = $game_map.display_y / 256
if Mouse.click?(1)
for event in $game_map.events.values
if Mouse.grid[0] + add_x == event.x && Mouse.grid[1] + add_y == event.y
if event.check_for_comment(/MOUSE CLICK/i)
event.start
event_activated = true
elsif ($game_temp.mouse_controlled_object.x - event.x).abs +
($game_temp.mouse_controlled_object.y - event.y).abs == 1 &&
([0].include?(event.trigger) or [1, 2].include?(event.trigger) &&
![0, 2].include?(event.priority_type))&& !(event.list.nil? or event.list.size == 1)
if (event.y - $game_temp.mouse_controlled_object.y).abs >
(event.x - $game_temp.mouse_controlled_object.x).abs
if event.y - $game_temp.mouse_controlled_object.y > 0
$game_temp.mouse_controlled_object.turn_down
else
$game_temp.mouse_controlled_object.turn_up
end
else
if event.x - $game_temp.mouse_controlled_object.x > 0
$game_temp.mouse_controlled_object.turn_right
else
$game_temp.mouse_controlled_object.turn_left
end
end
$game_temp.ev_clicked_on = nil
event.start
event_activated = true
elsif [0, 2].include?(event.priority_type)
$game_temp.ev_clicked_on = nil
$game_temp.move_because_of_mouse = true
$game_temp.mouse_controlled_object.force_path(Mouse.grid[0] + add_x, Mouse.grid[1] + add_y,
JetMouse::DO_8DIR_WALKING) if JetMouse::ALLOW_MOUSE_MOVEMENT
event_activated = true
elsif event_activated.nil?
for i in ["UP", "DOWN", "RIGHT", "LEFT"]
if event.check_for_comment(/MOUSE MOVE #{i}/i)
event_activated = true
case i
when "UP"
$game_temp.ev_clicked_on = nil
$game_temp.no_action_event_check = true
$game_temp.mouse_controlled_object.force_path(event.x, event.y - 1,
JetMouse::DO_8DIR_WALKING) if JetMouse::ALLOW_MOUSE_MOVEMENT
when "DOWN"
$game_temp.ev_clicked_on = nil
$game_temp.no_action_event_check = true
$game_temp.mouse_controlled_object.force_path(event.x, event.y + 1,
JetMouse::DO_8DIR_WALKING) if JetMouse::ALLOW_MOUSE_MOVEMENT
when "LEFT"
$game_temp.ev_clicked_on = nil
$game_temp.no_action_event_check = true
$game_temp.mouse_controlled_object.force_path(event.x - 1, event.y,
JetMouse::DO_8DIR_WALKING) if JetMouse::ALLOW_MOUSE_MOVEMENT
when "RIGHT"
$game_temp.ev_clicked_on = nil
$game_temp.no_action_event_check = true
$game_temp.mouse_controlled_object.force_path(event.x + 1, event.y,
JetMouse::DO_8DIR_WALKING) if JetMouse::ALLOW_MOUSE_MOVEMENT
end
end
end
if event_activated.nil?
x = do_closest_path_check(event)
if x != false && !event.page.nil? && event.conditions_met?(event.page)
$game_temp.ev_clicked_on = nil
$game_temp.no_action_event_check = true
$game_temp.move_because_of_mouse = true
$game_temp.mouse_controlled_object.force_path(x[0], x[1],
JetMouse::DO_8DIR_WALKING) if JetMouse::ALLOW_MOUSE_MOVEMENT
event_activated = true
$game_temp.ev_clicked_on = event
end
end
end
end
end
if event_activated.nil? && JetMouse::ALLOW_MOUSE_MOVEMENT
$game_temp.no_action_event_check = true
if $game_temp.mouse_controlled_object.map_passable?(Mouse.grid[0] + add_x, Mouse.grid[1] + add_y)
$game_temp.ev_clicked_on = nil
$game_temp.move_because_of_mouse = true
$game_temp.mouse_controlled_object.force_path(Mouse.grid[0] + add_x, Mouse.grid[1] + add_y,
JetMouse::DO_8DIR_WALKING)
end
end
end
end
def update_mouse_right_click
if $game_map.interpreter.running? or parallel_move or
$game_map.screen.brightness == 0 ||
$game_map.screen.fadein_duration != 0 || $game_map.screen.fadeout_duration != 0
Mouse.update
return
end
add_x = $game_map.display_x / 256
add_y = $game_map.display_y / 256
if Mouse.click?(2)
if Mouse.grid[0] + add_x == $game_player.x && Mouse.grid[1] + add_y == $game_player.y
changed_mouse_ctrl = true if $game_temp.mouse_controlled_object != $game_player
$game_temp.mouse_controlled_object = $game_player
end
for event in $game_map.events.values
if Mouse.grid[0] + add_x == event.x && Mouse.grid[1] + add_y == event.y
if event.check_for_comment(/MOUSE CONTROL/i)
changed_mouse_ctrl = true if $game_temp.mouse_controlled_object != event
$game_temp.mouse_controlled_object = event
end
end
end
end
Mouse.update if changed_mouse_ctrl
end
end
class Game_Player
alias jet6753_update update unless $@
def update
jet6753_update
if $game_temp.mouse_controlled_object.nil?
$game_temp.mouse_controlled_object = $game_player
end
end
alias jet7583_check_action_event check_action_event unless $@
def check_action_event
if $game_temp.no_action_event_check
$game_temp.no_action_event_check = false
return false
end
jet7583_check_action_event
end
alias jet5742_force_move_route force_move_route unless $@
def force_move_route(*args)
@jet_did_move = true
jet5742_force_move_route(*args)
end
def pre_ev_check
result = false
for event in $game_map.events_xy(@x, @y)
if [1, 2].include?(event.trigger) and event.priority_type != 1
result = true
if event.check_for_comment(/MOUSE NOSTOP/i)
return false
end
end
end
front_x = $game_map.x_with_direction(@x, @direction)
front_y = $game_map.y_with_direction(@y, @direction)
for event in $game_map.events_xy(front_x, front_y)
if [1, 2].include?(event.trigger) and event.priority_type == 1
result = true
if event.check_for_comment(/MOUSE NOSTOP/i)
return false
end
end
end
if result == false and $game_map.counter?(front_x, front_y)
front_x = $game_map.x_with_direction(front_x, @direction)
front_y = $game_map.y_with_direction(front_y, @direction)
for event in $game_map.events_xy(front_x, front_y)
if [1, 2].include?(event.trigger) and event.priority_type == 1
result = true
if event.check_for_comment(/MOUSE NOSTOP/i)
return false
end
end
end
end
return result
end
def jet_mouse_event_checking
result = false
for event in $game_map.events_xy(@x, @y)
if [1, 2].include?(event.trigger) and event.priority_type != 1
result = true
if event.check_for_comment(/MOUSE NOSTOP/i)
event.start unless $game_map.interpreter.running?
return false
end
end
end
front_x = $game_map.x_with_direction(@x, @direction)
front_y = $game_map.y_with_direction(@y, @direction)
for event in $game_map.events_xy(front_x, front_y)
if [1, 2].include?(event.trigger) and event.priority_type == 1
event.start unless $game_map.interpreter.running?
result = true
if event.check_for_comment(/MOUSE NOSTOP/i)
return false
end
end
end
if result == false and $game_map.counter?(front_x, front_y)
front_x = $game_map.x_with_direction(front_x, @direction)
front_y = $game_map.y_with_direction(front_y, @direction)
for event in $game_map.events_xy(front_x, front_y)
if [1, 2].include?(event.trigger) and event.priority_type == 1
event.start unless $game_map.interpreter.running?
result = true
if event.check_for_comment(/MOUSE NOSTOP/i)
return false
end
end
end
end
return result
end
alias jet9999_move_type_custom move_type_custom unless $@
def move_type_custom(*args)
if $game_temp.move_because_of_mouse && Mouse.click?(1)
@jet_did_move = false
end
update_encounter if stopping? && $game_temp.move_because_of_mouse
if $game_temp.next_scene == "battle"
move_route = RPG::MoveRoute.new
move_route.list = [RPG::MoveCommand.new(0)]
move_route.repeat = false
@move_route = move_route
@move_route_index = 0
end
if Input.trigger?(Input::B) && $game_temp.move_because_of_mouse
Sound.play_decision
$scene = Scene_Menu.new
Input.update
end
do_stop = stopping?
jet9999_move_type_custom(*args)
if (do_stop && pre_ev_check)
was_true = true
end
if (@move_route.nil? or @move_route.list[@move_route_index].code == 0) ||
$game_temp.move_because_of_mouse && was_true && do_stop || @move_failed
if stopping? and @x * 256 == @real_x || @y * 256 == @real_y
if $game_temp.ev_clicked_on != nil && ($game_temp.ev_clicked_on.y - self.y).abs +
($game_temp.ev_clicked_on.x - self.x).abs == 1
if ($game_temp.ev_clicked_on.y - self.y).abs >
($game_temp.ev_clicked_on.x - self.x).abs
if $game_temp.ev_clicked_on.y - self.y > 0
self.turn_down
else
self.turn_up
end
else
if $game_temp.ev_clicked_on.x - self.x > 0
self.turn_right
else
self.turn_left
end
end
$game_temp.move_because_of_mouse = false
$game_temp.ev_clicked_on.start unless $game_map.interpreter.running? || $game_temp.ev_clicked_on.list.nil?
$game_temp.ev_clicked_on = nil
end
end
$game_temp.move_because_of_mouse = false
end
did_event = (do_stop && $game_temp.move_because_of_mouse) ? jet_mouse_event_checking : false
if ($game_temp.move_because_of_mouse or was_true) && was_true && !@jet_did_move
move_route = RPG::MoveRoute.new
move_route.list = [RPG::MoveCommand.new(0)]
move_route.repeat = false
@move_route = move_route
@move_route_index = 0
end
end
end
@Topic
Tak, jak było powiedziane zrób sobie na zdarzeniach najlepiej, bo zrobisz tego więcej niż w skrypcie. Chyba, że znajdziesz jakiś. Co do systemu walki musisz poszukać na necie, a jak nie będzie to jedynie pozostaje jakaś zmiana tego, który ci najbardziej pasuje na taki, który będzie współgrał z "myszką" :D
Co do jednego bohatera w grze to chyba chodzi ci o to, żeby było jednoosobowe menu?
KLIK!
Sprawdź czy dobre :)
Dziękuje wszystkim za pomoc. Po dłuższym namyśleniu chyba zrezygnuje z Mouse System.
Hmm. Potrzebuje jeszcze jakiegoś skryptu który na początku pozwoli wybrać:
-1 z 8 ras która każda będzie miała jakiś bonus np. elf większa ilość many, człowiek większy bonus do ataku, krasnolud większy bonus do ilości życia itp. itd.
-1 z 18 klas postaci które będą miały różne bonusy np. wojownik szybciej zdobywa expa o 10% i ma bonus do ataku, mag zadaje większe obrażenia magią o 5, czary zabierają mu o 25% mniej many i jego ataki wręcz są słabsze o 25% itp. itd. (To mniej więcej wiem jak zrobić, ale jak macie jakieś ułatwienie to walcie śmiało)
- na zdarzeniach za bardzo tego nie zrobię gdyż w grze będą Etapy coś w stylu lochów w starych dobrych grach
Wszyscy którzy wypowiedzią się (na temat) w tym wątku otrzymają pomógł.
Nie możesz pisać nowych tematów Nie możesz odpowiadać w tematach Nie możesz zmieniać swoich postów Nie możesz usuwać swoich postów Nie możesz głosować w ankietach Nie możesz załączać plików na tym forum Możesz ściągać załączniki na tym forum