Scripts varios by Clark-CLK [XP]
Script de progreso V1.1:
Script 8 direcciones V1.1:
Script movimiento aleatorio en 8 direcciones V1.0:
(substituir game character 3 por este otro)
WASD movement V1.1:
Correr V1.1:
Pequeño edit del Scene_menu V1.0
Todos estos scripts han sido creados por mi. Pido como minimo que se me reconozca como creador de ellos. Y a poder ser, créditos.
Wong Wong!!
Script de progreso V1.1:
Código:
#==============================================================================
# * Script: Progreso (progress check script)
# * Versión: 1.1
# * Evolución: V1.0 -> Script de progreso
# * V1.1 -> Independización del Game_PlayTime
# * Créditos: Clark-CLK
# * Fecha: v1.0 12.05.2011 (dd.mm.yyyy)
# * v1.1 12.05.2011 (dd.mm.yyyy)
# * Más scripts, tutoriales y RPG Maker en: <a href="http://ahoperpg-maker.ucoz.es" target="_blank">http://ahoperpg-maker.ucoz.es</a>
#----------------------------------------------------------------------------
# * Instrucciones:
# * -Copiar y pegar este script encima de Main.
# * -Acreditar al autor: Clark-CLK
# * -Para que el progreso del juego avanze, en un evento, pon la operación de
# * variable y súmele la cantidad del porcentaje deseada a la variable por
# * defecto numero 20. Tengan cuidado porque es fácil que la variable pase de
# * 100 si no se va con cuidado.
# * Gracias por usar este script.
# * Visita la web del autor: http://ahoperpg-maker.ucoz.es
#===============================================================================
class Window_PlayTime < Window_Base
alias progreso_update update
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = system_color
# - Aquí pueden cambiar el nombre de progreso por el que quieran.
self.contents.draw_text(4, 0, 120, 32, "Progreso:")
self.contents.font.color = normal_color
# Donde pone 20 entre [] pueden cambiarlo por el número que quieran, este
# numero se trata de la variable que habrán de ir modificando cada vez que
# quieran aumentar el porcentaje del progreso. Recuerden el numero de la
# variable.
self.contents.draw_text(4, 32, 120, 32, $game_variables[20].to_s + "%" )
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if Graphics.frame_count / Graphics.frame_rate != @total_sec
refresh
end
progreso_update
end
end
Script 8 direcciones V1.1:
Código:
#==============================================================================
#-------------------------------------------------------- ----------------------
# * Script: 8 direcciones (eight directions)
# * Versión: 1.1
# * Evolución: V1.0 -> Simple movimiento en 8 direcciones
# * V1.1 -> Independización del Game_player
# * Créditos: Clark-CLK
# * Fecha: v1.0 18.04.2011 (dd.mm.yyyy)
# * v1.1 20.04.2011 (dd.mm.yyyy)
# * Más scripts, tutoriales y RPG Maker en: <a href="http://ahoperpg-maker.ucoz.es" target="_blank">http://ahoperpg-maker.ucoz.es</a>
#------------------------------------------------------------------------------
#==================================================== ====== =====================
#------------------------------------------------------------------------------
# * Instrucciones:
# * -Tener los graficos de movimiento diagonal en la carpeta correspondiente.
# * -Copiar y pegar este script encima de Main.
# * -Acreditar al autor: Clark-CLK
# * Gracias por usar este script.
# * Visita la web del autor: http://ahoperpg-maker.ucoz.es
#------------------------------------------------------------------------------
#============================== ============================ =====================
class Game_Player < Game_Character
alias cl_8dir_update update
#--------------------------------------------------------------------------
# * Frame Update
# * Script: 8 direcciones (quarter move)
# * Versión: 1.1
# * Créditos: Clark-CLK
# * Fecha: 20.04.2011 (dd.mm.yyyy)
# * Más scripts, tutoriales y RPG Maker en: <a href="http://ahoperpg-maker.ucoz.es" target="_blank">http://ahoperpg-maker.ucoz.es</a>
#--------------------------------------------------------------------------
def update
# Remember whether or not moving in local variables
last_moving = moving?
# If moving, event running, move route forcing, and message window
# display are all not occurring
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing
# Move player in the direction the directional button is being pressed
case Input.dir8
when 1 # Move down and left
move_lower_left
when 2 # Move down
move_down
when 3 # Move down and right
move_lower_right
when 4 # Move left
move_left
when 6 # Move right
move_right
when 7 # Move up and left
move_upper_left
when 8 # Move up
move_up
when 9 # Move up and right
move_upper_right
end
end
cl_8dir_update
end
end
Script movimiento aleatorio en 8 direcciones V1.0:
(substituir game character 3 por este otro)
Código:
#==============================================================================
# ** Game_Character (part 3)
#===============================================================================
#--------------------------------------------------------------------------
# * Script: Move at Random 8 direcciones (quarter move)
# * Versión: 1.0
# * Créditos: Clark-CLK
# * Fecha: 20.04.2011 (dd.mm.yyyy)
# * Más scripts, tutoriales y RPG Maker en: <a href="http://ahoperpg-maker.ucoz.es" target="_blank">http://ahoperpg-maker.ucoz.es</a>
#--------------------------------------------------------------------------
#============================================================== =================
#------------------------------------------------------------------------------
# * Instrucciones:
# * -Copiar y pegar este script encima de Main.
# * -Acreditar al autor: Clark-CLK
# * Gracias por usar este script.
# * Visita la web del autor: http://ahoperpg-maker.ucoz.es
#------------------------------------------------------------------------------
#========================================================== =====================
#------------------------------------------------------------------------------
# This class deals with characters. It's used as a superclass for the
# Game_Player and Game_Event classes.
#==============================================================================
class Game_Character
#--------------------------------------------------------------------------
# * Move Down
# turn_enabled : a flag permits direction change on that spot
#--------------------------------------------------------------------------
def move_down(turn_enabled = true)
# Turn down
if turn_enabled
turn_down
end
# If passable
if passable?(@x, @y, 2)
# Turn down
turn_down
# Update coordinates
@y += 1
# Increase steps
increase_steps
# If impassable
else
# Determine if touch event is triggered
check_event_trigger_touch(@x, @y+1)
end
end
#--------------------------------------------------------------------------
# * Move Left
# turn_enabled : a flag permits direction change on that spot
#--------------------------------------------------------------------------
def move_left(turn_enabled = true)
# Turn left
if turn_enabled
turn_left
end
# If passable
if passable?(@x, @y, 4)
# Turn left
turn_left
# Update coordinates
@x -= 1
# Increase steps
increase_steps
# If impassable
else
# Determine if touch event is triggered
check_event_trigger_touch(@x-1, @y)
end
end
#--------------------------------------------------------------------------
# * Move Right
# turn_enabled : a flag permits direction change on that spot
#--------------------------------------------------------------------------
def move_right(turn_enabled = true)
# Turn right
if turn_enabled
turn_right
end
# If passable
if passable?(@x, @y, 6)
# Turn right
turn_right
# Update coordinates
@x += 1
# Increase steps
increase_steps
# If impassable
else
# Determine if touch event is triggered
check_event_trigger_touch(@x+1, @y)
end
end
#--------------------------------------------------------------------------
# * Move up
# turn_enabled : a flag permits direction change on that spot
#--------------------------------------------------------------------------
def move_up(turn_enabled = true)
# Turn up
if turn_enabled
turn_up
end
# If passable
if passable?(@x, @y, 8)
# Turn up
turn_up
# Update coordinates
@y -= 1
# Increase steps
increase_steps
# If impassable
else
# Determine if touch event is triggered
check_event_trigger_touch(@x, @y-1)
end
end
#--------------------------------------------------------------------------
# * Move Lower Left
#--------------------------------------------------------------------------
def move_lower_left
# If no direction fix
unless @direction_fix
# Face down is facing right or up
@direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction)
end
# When a down to left or a left to down course is passable
if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 4)) or
(passable?(@x, @y, 4) and passable?(@x - 1, @y, 2))
# Update coordinates
@x -= 1
@y += 1
# Increase steps
increase_steps
end
end
#--------------------------------------------------------------------------
# * Move Lower Right
#--------------------------------------------------------------------------
def move_lower_right
# If no direction fix
unless @direction_fix
# Face right if facing left, and face down if facing up
@direction = (@direction == 4 ? 6 : @direction == 8 ? 2 : @direction)
end
# When a down to right or a right to down course is passable
if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 6)) or
(passable?(@x, @y, 6) and passable?(@x + 1, @y, 2))
# Update coordinates
@x += 1
@y += 1
# Increase steps
increase_steps
end
end
#--------------------------------------------------------------------------
# * Move Upper Left
#--------------------------------------------------------------------------
def move_upper_left
# If no direction fix
unless @direction_fix
# Face left if facing right, and face up if facing down
@direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)
end
# When an up to left or a left to up course is passable
if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 4)) or
(passable?(@x, @y, 4) and passable?(@x - 1, @y, 8))
# Update coordinates
@x -= 1
@y -= 1
# Increase steps
increase_steps
end
end
#--------------------------------------------------------------------------
# * Move Upper Right
#--------------------------------------------------------------------------
def move_upper_right
# If no direction fix
unless @direction_fix
# Face right if facing left, and face up if facing down
@direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction)
end
# When an up to right or a right to up course is passable
if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 6)) or
(passable?(@x, @y, 6) and passable?(@x + 1, @y, 8))
# Update coordinates
@x += 1
@y -= 1
# Increase steps
increase_steps
end
end
#--------------------------------------------------------------------------
# * Move at Random
#--------------------------------------------------------------------------
def move_random
case rand(4)
when 0 # Move down
move_down(false)
when 1 # Move left
move_left(false)
when 2 # Move right
move_right(false)
when 3 # Move up
move_up(false)
when 4 # Move up left
move_upper_left
when 5 # Move up right
move_upper_rigt
when 6 # Move down left
move_lower_left
when 7 # Move down right
move_lower_right
end
end
#--------------------------------------------------------------------------
# * Move toward Player
#--------------------------------------------------------------------------
def move_toward_player
# Get difference in player coordinates
sx = @x - $game_player.x
sy = @y - $game_player.y
# If coordinates are equal
if sx == 0 and sy == 0
return
end
# Get absolute value of difference
abs_sx = sx.abs
abs_sy = sy.abs
# If horizontal and vertical distances are equal
if abs_sx == abs_sy
# Increase one of them randomly by 1
rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
end
# If horizontal distance is longer
if abs_sx > abs_sy
# Move towards player, prioritize left and right directions
sx > 0 ? move_left : move_right
if not moving? and sy != 0
sy > 0 ? move_up : move_down
end
# If vertical distance is longer
else
# Move towards player, prioritize up and down directions
sy > 0 ? move_up : move_down
if not moving? and sx != 0
sx > 0 ? move_left : move_right
end
end
end
#--------------------------------------------------------------------------
# * Move away from Player
#--------------------------------------------------------------------------
def move_away_from_player
# Get difference in player coordinates
sx = @x - $game_player.x
sy = @y - $game_player.y
# If coordinates are equal
if sx == 0 and sy == 0
return
end
# Get absolute value of difference
abs_sx = sx.abs
abs_sy = sy.abs
# If horizontal and vertical distances are equal
if abs_sx == abs_sy
# Increase one of them randomly by 1
rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
end
# If horizontal distance is longer
if abs_sx > abs_sy
# Move away from player, prioritize left and right directions
sx > 0 ? move_right : move_left
if not moving? and sy != 0
sy > 0 ? move_down : move_up
end
# If vertical distance is longer
else
# Move away from player, prioritize up and down directions
sy > 0 ? move_down : move_up
if not moving? and sx != 0
sx > 0 ? move_right : move_left
end
end
end
#--------------------------------------------------------------------------
# * 1 Step Forward
#--------------------------------------------------------------------------
def move_forward
case @direction
when 2
move_down(false)
when 4
move_left(false)
when 6
move_right(false)
when 8
move_up(false)
end
end
#--------------------------------------------------------------------------
# * 1 Step Backward
#--------------------------------------------------------------------------
def move_backward
# Remember direction fix situation
last_direction_fix = @direction_fix
# Force directino fix
@direction_fix = true
# Branch by direction
case @direction
when 2 # Down
move_up(false)
when 4 # Left
move_right(false)
when 6 # Right
move_left(false)
when 8 # Up
move_down(false)
end
# Return direction fix situation back to normal
@direction_fix = last_direction_fix
end
#--------------------------------------------------------------------------
# * Jump
# x_plus : x-coordinate plus value
# y_plus : y-coordinate plus value
#--------------------------------------------------------------------------
def jump(x_plus, y_plus)
# If plus value is not (0,0)
if x_plus != 0 or y_plus != 0
# If horizontal distnace is longer
if x_plus.abs > y_plus.abs
# Change direction to left or right
x_plus < 0 ? turn_left : turn_right
# If vertical distance is longer, or equal
else
# Change direction to up or down
y_plus < 0 ? turn_up : turn_down
end
end
# Calculate new coordinates
new_x = @x + x_plus
new_y = @y + y_plus
# If plus value is (0,0) or jump destination is passable
if (x_plus == 0 and y_plus == 0) or passable?(new_x, new_y, 0)
# Straighten position
straighten
# Update coordinates
@x = new_x
@y = new_y
# Calculate distance
distance = Math.sqrt(x_plus * x_plus + y_plus * y_plus).round
# Set jump count
@jump_peak = 10 + distance - @move_speed
@jump_count = @jump_peak * 2
# Clear stop count
@stop_count = 0
end
end
#--------------------------------------------------------------------------
# * Turn Down
#--------------------------------------------------------------------------
def turn_down
unless @direction_fix
@direction = 2
@stop_count = 0
end
end
#--------------------------------------------------------------------------
# * Turn Left
#--------------------------------------------------------------------------
def turn_left
unless @direction_fix
@direction = 4
@stop_count = 0
end
end
#--------------------------------------------------------------------------
# * Turn Right
#--------------------------------------------------------------------------
def turn_right
unless @direction_fix
@direction = 6
@stop_count = 0
end
end
#--------------------------------------------------------------------------
# * Turn Up
#--------------------------------------------------------------------------
def turn_up
unless @direction_fix
@direction = 8
@stop_count = 0
end
end
#--------------------------------------------------------------------------
# * Turn 90° Right
#--------------------------------------------------------------------------
def turn_right_90
case @direction
when 2
turn_left
when 4
turn_up
when 6
turn_down
when 8
turn_right
end
end
#--------------------------------------------------------------------------
# * Turn 90° Left
#--------------------------------------------------------------------------
def turn_left_90
case @direction
when 2
turn_right
when 4
turn_down
when 6
turn_up
when 8
turn_left
end
end
#--------------------------------------------------------------------------
# * Turn 180°
#--------------------------------------------------------------------------
def turn_180
case @direction
when 2
turn_up
when 4
turn_right
when 6
turn_left
when 8
turn_down
end
end
#--------------------------------------------------------------------------
# * Turn 90° Right or Left
#--------------------------------------------------------------------------
def turn_right_or_left_90
if rand(2) == 0
turn_right_90
else
turn_left_90
end
end
#------------------------------------------------------------- -------------
# * Turn at Random
#--------------------------------------------------------------------------
def turn_random
case rand(4)
when 0
turn_up
when 1
turn_right
when 2
turn_left
when 3
turn_down
end
end
#--------------------------------------------------------------------------
# * Turn Towards Player
#--------------------------------------------------------------------------
def turn_toward_player
# Get difference in player coordinates
sx = @x - $game_player.x
sy = @y - $game_player.y
# If coordinates are equal
if sx == 0 and sy == 0
return
end
# If horizontal distance is longer
if sx.abs > sy.abs
# Turn to the right or left towards player
sx > 0 ? turn_left : turn_right
# If vertical distance is longer
else
# Turn up or down towards player
sy > 0 ? turn_up : turn_down
end
end
#--------------------------------------------------------------------------
# * Turn Away from Player
#--------------------------------------------------------------------------
def turn_away_from_player
# Get difference in player coordinates
sx = @x - $game_player.x
sy = @y - $game_player.y
# If coordinates are equal
if sx == 0 and sy == 0
return
end
# If horizontal distance is longer
if sx.abs > sy.abs
# Turn to the right or left away from player
sx > 0 ? turn_right : turn_left
# If vertical distance is longer
else
# Turn up or down away from player
sy > 0 ? turn_down : turn_up
end
end
end
WASD movement V1.1:
Código:
#==============================================================================
# * Script: WASD movement
# * Versión: 1.1
# * Evolución: V1.0 -> Simple movimiento en 4 direcciones con las teclas WASD.
# * V1.1 -> Independización del game_player con el uso de alias.
# * Créditos: Clark-CLK
# * Fecha: v1.0 29.04.2011 (dd.mm.yyyy)
# * v1.1 29.04.2011 (dd.mm.yyyy)
# * Agradecimientos especiales: SilentWalker
# * Más scripts, tutoriales y RPG Maker en: <a href="http://ahoperpg-maker.ucoz.es" target="_blank">http://ahoperpg-maker.ucoz.es</a>
#----------------------------------------------------------------------------
# * Instrucciones:
# * -Copiar y pegar este script encima de Main.
# * -Acreditar al autor: Clark-CLK
# * Gracias por usar este script.
# * Visita la web del autor: http://ahoperpg-maker.ucoz.es
#===============================================================================
class Game_Player < Game_Character
alias cl_4dir_WASD_update update
def update
# Remember whether or not moving in local variables
last_moving = moving?
# Move player in the direction the directional button is being pressed
# Move player in the direction the directional button is being pressed
if Input.press? (Input::Y) # Move down
move_down
elsif Input.press? (Input::X) # Move left
move_left
elsif Input.press? (Input::Z) # Move right
move_right
elsif Input.press? (Input::R) # Move up
move_up
end
cl_4dir_WASD_update
end
end
Correr V1.1:
Código:
#==============================================================================
#------------------------------------------------------------------------------
# * Script: Correr (Heroes_move_run)
# * Versión: 1.1
# * Evolución: V1.0 -> Simple movimiento de correr
# * V1.1 -> Independización del Game_player
# * Créditos: Clark-CLK
# * Fecha: v1.0 20.04.2011 (dd.mm.yyyy)
# * v1.1 20.04.2011 (dd.mm.yyyy)
# * Más scripts, tutoriales y RPG Maker en: <a href="http://ahoperpg-maker.ucoz.es" target="_blank">http://ahoperpg-maker.ucoz.es</a>
#------------------------------------------------------------------------------
#========================================================== =====================
#===============================================================================
#------------------------------------------------------------------------------
# * Instrucciones:
# * -Copiar y pegar este script encima de Main.
# * -Acreditar al autor: Clark-CLK
# * Gracias por usar este script.
# * Visita la web del autor: http://ahoperpg-maker.ucoz.es
#------------------------------------------------------------------------------
#========================================================== =====================
class Game_Player < Game_Character
alias cl_hero_move_run_update update # Alias que independiza del Game_Player
def update
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing
if Input.press?(Input::C) # Condicional: al pulsar tecla C)
@move_speed = 5 # Cambia la Velocidad del héroe. Cambiar 5 por un número del 1 a 5
else
@move_speed = 4 # Cuando no se pulsa la tecla, cambia la velocidad a 4. (velocidad normal)
end
end
cl_hero_move_run_update
end
end
Pequeño edit del Scene_menu V1.0
Código:
#==============================================================================
# ■ Scene_Menu
# CMS de Cambid
# Editado por Clark-CLK
# Créditos: Cambrid
# Versiión: 1.0
#------------------------------------------------------------------------------
class Scene_Menu
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#--------------------------------------------------------------------------
def main
# コマンドウィンドウを作成
s1 = $data_system.words.item
s2 = $data_system.words.skill
s3 = $data_system.words.equip
s4 = "Estado"
s5 = "Guardar"
s6 = "Salir"
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
@spriteset = Spriteset_Map.new
@command_window.index = @menu_index
if $game_party.actors.size == 0
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
if $game_system.save_disabled
@command_window.disable_item(4)
end
@playtime_window = Window_PlayTime.new
@playtime_window.x = 150
@playtime_window.y = 0
@status_window = Window_MenuStatus.new
@status_window.x = 470
@status_window.y = 25
@money_window = Window_Gold.new
@money_window.x = 320
@money_window.y = 400
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@command_window.dispose
@playtime_window.dispose
@status_window.dispose
@money_window.dispose
end
#--------------------------------------------------------------------------
def update
@command_window.update
@playtime_window.update
@status_window.update
@money_window.update
if @command_window.active
update_command
return
end
if @status_window.active
update_status
return
end
end
#--------------------------------------------------------------------------
def update_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
if $game_party.actors.size == 0 and @command_window.index < 4
$game_system.se_play($data_system.buzzer_se)
return
end
case @command_window.index
when 0
$game_system.se_play($data_system.decision_se)
$scene = Scene_Item.new
when 1
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 2
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 3
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 4
if $game_system.save_disabled
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Save.new
when 5
$game_system.se_play($data_system.decision_se)
$scene = Scene_End.new
end
return
end
end
#--------------------------------------------------------------------------
def update_status
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
if Input.trigger?(Input::C)
case @command_window.index
when 1
if $game_party.actors[@status_window.index].restriction >= 2
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Skill.new(@status_window.index)
when 2
$game_system.se_play($data_system.decision_se)
$scene = Scene_Equip.new(@status_window.index)
when 3
$game_system.se_play($data_system.decision_se)
$scene = Scene_Status.new(@status_window.index)
end
return
end
end
end
Todos estos scripts han sido creados por mi. Pido como minimo que se me reconozca como creador de ellos. Y a poder ser, créditos.
Wong Wong!!