[Script] [RPGXP] script XP can giup do

sonlamsonlam Posts: 39Registered
Hiện tại script này sử dụng khung hội thoại mặc định của rpg xp.Giờ muốn thay khung đó bằng 1 bức hình thì sửa như thế nào ?ai giúp dùm mình với.[php]#=====================================================================#
# #*****************# Pescar en tiempo real 1.5 falcao script #
# #*** By Falcao ***# Permite pescar en los autotiles de agua #
# #*****************# situados en el mapa. #
# RMXP #
# makerpalace.onlinegoo.com #
#=====================================================================#

module FalcaoPesca
#
# * Charcas contenedoras de peces funsionan como las peceras de la vida real
# Solo poner los ID de items dentro de los corchetes separandolos por comas,
# al querer aumentar la probabilidad de atrapar un pez agregar su ID mas de
# una vez. Fijarse en los ejemplos.

# Charca terreno 5 (Terrain tag 5)
Pecera5 = [42,43,44,45,46,47]

# Charca terreno 6 (Terrain tag 6)
Pecera6 = [48,49,50,51,52]

# Charca terreno 7 (Terrain tag 7)
Pecera7 = [42,43,44,45,46,47,48,49,50,51,52]

#
# Dificultad de pesca por pecera(terreno) hay 3 tipos de dificultad
# 1 = Facil
# 2 = Normal
# 3 = Dificil

Difficulty = [pecera5 = 1, pecera6 = 2, pecera7 = 3]
#

# Tiempo en segundos en mostrar ventana de premio al agarrar un pez
RewardTime = 2

# Boton para tirar la carnada con la caña Tecla "Z" del teclado
RodKey = Input::R

# Boton para jalar el pez Tecla "C" del teclado
CatchingKey = Input::C

#
# * Vocabulario

NormalText = "H·y Trang BÞ CÇn C©u"

FishingText = "§ang Th¶ C©u..."

ReadyText = "C¸ C¾n C©u.NhÊn C Liªn Tôc"

EscapeText = "H·y Thay Måi"

WinnerText = "B¾t §­îc C¸!!"

NoBugs = "HÕt Måi C©u."
#
# * Sound

Throwing = "021-Dive01"

Picando = "022-Dive02"

Winner = "CauCa"

end

$falcaoscript = {} if $falcaoscript == nil
$falcaoscript["Pesca"] = true
$xrxs = {} if $xrxs == nil

#
# * Plugins Game_Party. Pure alias method, refreh antilag
#
class Game_Party
alias falcao13_gain_item gain_item
def gain_item(item_id, n)
falcao13_gain_item(item_id, n)
$falref = true
end
alias falcao13_lose_item lose_item
def lose_item(item_id, n)
falcao13_lose_item(item_id, n)
$falref = true
end
end

#
# * Plugins Game_Character. Make game player Stop. Pure alias method
#
class Game_Character
include FalcaoPesca
alias falcaomove_down move_down
def move_down(turn_enabled = true)
return if $game_player.buscando && self.is_a?(Game_Player) ||
$game_player.help_text == NoBugs
falcaomove_down(turn_enabled = true)
end
alias falcaomove_left move_left
def move_left(turn_enabled = true)
return if $game_player.buscando && self.is_a?(Game_Player) ||
$game_player.help_text == NoBugs
falcaomove_left(turn_enabled = true)
end
alias falcaomove_right move_right
def move_right(turn_enabled = true)
return if $game_player.buscando && self.is_a?(Game_Player) ||
$game_player.help_text == NoBugs
falcaomove_right(turn_enabled = true)
end
alias falcaomove_up move_up
def move_up(turn_enabled = true)
return if $game_player.buscando && self.is_a?(Game_Player) ||
$game_player.help_text == NoBugs
falcaomove_up(turn_enabled = true)
end
end

#
# * Game_Player. Script prinsipal de pesca aliased
#
class Game_Player < Game_Character
attr_accessor :fishing
attr_accessor :time_count
attr_accessor :lose_bug
attr_accessor :nobugs
attr_accessor :help_text
attr_accessor :show_reward
attr_accessor :reward_time
attr_accessor :pesca_rate
attr_accessor :falItem_id
attr_accessor :buscando
alias falcaofish_ini initialize
def initialize
falcaofish_ini
@catching = false
@catching_counter = 0.0
@time_count = 0
@fishing = false
@lose_bug = false
@nobugs = false
@help_text = NormalText
@show_reward = false
@reward_time = 0
@terrain_zone = 0
@pesca_rate = 150
@falItem_id = 0
@ganarTesoro = false
@buscando = false
@fset = false
end

alias falcaofish_update update
def update
falcaofish_update
update_sensor
update_force
if Input.press?(RodKey)
update_fish
elsif @fset == true
fclear
end
end

def fclear
actor = $game_party.actors[0]
@character_name = actor.character_name
@help_text = NormalText
$falref = true
@catching_counter = 0
@catching = false
@direction_fix = false
@tesoro_update = nil
@ganarTesoro = false
@buscando = false
@bugscounter = nil
@fset = false
end
# Empiezo de la scena pesca
def update_fish
case @direction
when 2
look_x = x
look_y = y + 1
when 4
look_x = x - 1
look_y = y
when 6
look_x = x + 1
look_y = y
when 8
look_x = x
look_y = y - 1
end
actor = $game_party.actors[0]
if actor.weapon_id != 0 and
$data_weapons[actor.weapon_id].element_set.include?(
$data_system.elements.index("ROD"))
case $game_map.terrain_tag(look_x,look_y)
when 0
return
when 5
@terrain_zone = 5
empezar
when 6
@terrain_zone = 6
empezar
when 7
@terrain_zone = 7
empezar
end
end
end

def empezar
@fset = true
return if moving? or @show_reward
unless @help_text == FishingText or @help_text == ReadyText or
@help_text == WinnerText
if @nobugs
@direction_fix = true
@help_text = NoBugs
$falref = true
return
end
end
check_bugs
@direction_fix = true
pescando
end

def check_bugs
if @bugscounter == nil
lose_bugs
if @nobugs
$game_system.se_play($data_system.buzzer_se)
return
else
Audio.se_play("Audio/Se/" + Throwing)
end
@bugscounter = 1
return if @nobugs
@help_text = FishingText
$falref = true
end
end
# perder culichas
def lose_bugs
for item in $data_items
if item != nil and
$data_items[item.id].element_set.include?(
$data_system.elements.index("BUG"))
$game_party.lose_item(item.id, 1)
end
end
end
# Sensor
def update_sensor
case @direction
when 2; look_x = x; look_y = y + 1
when 4; look_x = x - 1; look_y = y
when 6; look_x = x + 1; look_y = y
when 8; look_x = x; look_y = y - 1
end
case $game_map.terrain_tag(look_x,look_y)
when 5...8
apply_xas_compatibility
@fishing = true
@time_count = 50
else
if @fishing
clear_xas_compatibility
@fishing = false
end
end
end

def apply_xas_compatibility
if $xrxs_xas == true or $xrxs["xas"] == true
$game_switches[XAS_COMMAND::COMMAND_DISABLE_SWITCH] = true
$game_map.need_refresh = true
end
end

def clear_xas_compatibility
if $xrxs_xas == true or $xrxs["xas"] == true
$game_switches[XAS_COMMAND::COMMAND_DISABLE_SWITCH] = false
$game_map.need_refresh = true
end
end
# buscar peces
def pescando
return if @show_reward or @help_text == EscapeText or
@help_text == WinnerText
@buscando = true
case rand(@pesca_rate)
# Pez cae en el anzuelo
when 11
if @catching == false
@catching = true
@catching_counter = 40
Audio.se_play("Audio/Se/"+ Picando,80,130)
$game_screen.start_shake(8, 7, 15)
@help_text = ReadyText
$falref = true
end
end
if @catching
if Input.trigger?(CatchingKey)
@catching_counter -= 12 - Difficulty[0] if @terrain_zone == 5
@catching_counter -= 12 - Difficulty[1] if @terrain_zone == 6
@catching_counter -= 12 - Difficulty[2] if @terrain_zone == 7
if Difficulty[0] >= 3 or Difficulty[1] >= 3 or Difficulty[2] >= 3
@catching_counter -= 1.5
end
case rand
when 0...50
@catching_counter += 1 * Difficulty[0] if @terrain_zone == 5
@catching_counter += 1 * Difficulty[1] if @terrain_zone == 6
@catching_counter += 1 * Difficulty[2] if @terrain_zone == 7
end
else
@catching_counter += 1.2
end
# si lo agarra
if @catching_counter < 10
@catching_counter = 0
@reward_time = 0
@ganarTesoro = true
@catching = false
# se escapa
elsif @catching_counter > 70
@help_text = EscapeText
$falref = true
@catching_counter = 0
@catching = false
end
end
end

def update_force
if @help_text == ReadyText
@reward_time += 1
case @reward_time
when 60; get_effect
when 110; get_effect
when 140; get_effect; @reward_time = -10
end
@tesoro_update == nil ? get_tesoro : gain_pez(@tesoro_update)
end
end

def get_effect
Audio.se_play("Audio/Se/"+ Picando,50,140)
$game_screen.start_shake(3, 5, 20)
end
# calcular los tamaños de las peceras
def get_tesoro
case @terrain_zone
when 5
for i in 0...Pecera5.size
@radom = i + 1
end
gain_pez(Pecera5[rand(@radom)])
when 6
for i in 0...Pecera6.size
@radom = i + 1
end
gain_pez(Pecera6[rand(@radom)])
when 7
for i in 0...Pecera7.size
@radom = i + 1
end
gain_pez(Pecera7[rand(@radom)])
end
$falref = true
end
# Ganar el pez
def gain_pez(type)
@tesoro_update = type
item = $data_items[@tesoro_update]
if item != nil
if @ganarTesoro
$game_party.gain_item(item.id, 1)
show_pez
@tesoro_update = nil
end
@falItem_id = item.id
end
end

def show_pez
@help_text = WinnerText
$falref = true
@show_reward = true
@pesca_rate += 50
Audio.me_play("Audio/Me/" + Winner)
end
end

#
# * Make windows object.
#
class Window_Bug < Window_Base
def initialize
super(0, 0, 95, 55)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 190
refresh
end
def refresh
self.contents.clear
self.contents.font.size = 19
self.contents.font.name = ".VnArial"
draw_bugs
end
#dibujar insectos
def draw_bugs
for item in $data_items
if item != nil and
$data_items[item.id].element_set.include?(
$data_system.elements.index("BUG"))
icon = RPG::Cache.icon(item.icon_name) rescue nil
self.contents.blt(0, 0, icon, Rect.new(0, 0, 32, 32), 255) rescue nil
number = $game_party.item_number(item.id)
self.contents.draw_text(35, -15, 608, 50,number.to_s)
if $game_party.item_number(item.id) == 0
$game_player.nobugs = true
else
$game_player.nobugs = false
end
end
end
end
end

class Help_Pesca < Window_Base
def initialize
super(0, 0, 250, 55)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 190
refresh
end
def refresh
self.contents.clear
self.contents.font.size = 18
self.contents.font.name = ".VnArial"
text = $game_player.help_text
self.contents.draw_text(8, -15, 608, 50,text)
end
end

class Recompensa < Window_Base
def initialize
super(0, 0, 250, 120)
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 190
refresh
end
def refresh
self.contents.clear
self.contents.font.size = 18
self.contents.font.name = ".VnArial"
draw_items
draw_location
end
def draw_items
if $game_player.falItem_id != 0
item = $data_items[$game_player.falItem_id]
icon = RPG::Cache.icon(item.icon_name) rescue nil
self.contents.blt(0, 30, icon, Rect.new(0, 0, 40, 40), 255) rescue nil
self.contents.draw_text(0, -15, 608, 50,item.name)
end
end
def draw_location
data = load_data("Data/MapInfos.rxdata")
cx = contents.text_size(data[$game_map.map_id].name).width
self.contents.draw_text(200-cx, 60, cx, 32, data[$game_map.map_id].name)
self.contents.draw_text(0, 60, 150, 32, "§Þa §iÓm:")
end
end

class Fish_Icon < Window_Base
def initialize
super(0, 0, 640, 480)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents_opacity = 100
self.opacity = 0
refresh
end
def refresh
self.contents.clear
draw_fish_icon
end
def draw_fish_icon
if $game_player.help_text == FalcaoPesca::ReadyText
item = $data_items[$game_player.falItem_id]
icon = RPG::Cache.icon(item.icon_name) rescue nil
case $game_player.direction
when 2
x = $game_player.screen_x - 30
y = $game_player.screen_y + 3
when 4
x = $game_player.screen_x - 74
y = $game_player.screen_y - 16
when 6
x = $game_player.screen_x + 5
y = $game_player.screen_y - 20
when 8
x = $game_player.screen_x - 35
y = $game_player.screen_y - 76
end
self.contents.blt(x, y, icon, Rect.new(0, 0, 32, 32), 255) rescue nil
end
end
end
#
# * Scene_Map. Pure alias method
#
class Scene_Map
include FalcaoPesca
alias falcaofishing_main main
def main
@bug_window = Window_Bug.new
@bug_window.x = 127
@bug_window.y = 80
@bug_window.visible = false
@pesca_help = Help_Pesca.new
@pesca_help.x = 220
@pesca_help.y = 80
@pesca_help.visible = false
@recompensa = Recompensa.new
@recompensa.x = 225
@recompensa.y = 200
@recompensa.visible = false
@carnada = Sprite.new
@carnada.bitmap = RPG::Cache.icon("carne") rescue nil
@carnada.x = 0
@carnada.y = 0
@carnada.z = 1000
@carnada.opacity = 0
@iconfish = Fish_Icon.new
falcaofishing_main
dispose
end
def dispose
@bug_window.dispose
@pesca_help.dispose
@recompensa.dispose
@carnada.dispose
@iconfish.dispose
end
alias falcaofishing_update update
def update
falcaofishing_update
update_bug
update_carnada
end
def update_bug
if $game_player.fishing
@bug_window.visible = true
@pesca_help.visible = true
else
$game_player.time_count -= 1 if $game_player.time_count > 0
if $game_player.time_count <= 0
@bug_window.visible = false
@pesca_help.visible = false
$game_player.time_count = 0
end
end
if $falref == true
@bug_window.refresh
@pesca_help.refresh
@iconfish.refresh
$falref = false
end
if $game_player.show_reward
@recompensa.refresh
@recompensa.visible = true
$game_player.reward_time += 1
if $game_player.reward_time == 40 * RewardTime
@recompensa.visible = false
$game_player.reward_time = 0
$game_player.show_reward = false
end
end
end
def update_carnada
@carnada.opacity = 0 if $game_player.help_text == EscapeText or
$game_player.help_text == NoBugs or $game_player.help_text == WinnerText
if Input.press?(Input::A) and $game_player.buscando
@carnada.opacity += 4 if @carnada.opacity < 190
case $game_player.direction
when 2
@carnada.x = $game_player.screen_x - 10
@carnada.y = $game_player.screen_y + 5
when 4
@carnada.x = $game_player.screen_x - 50
@carnada.y = $game_player.screen_y - 16
when 6
@carnada.x = $game_player.screen_x + 30
@carnada.y = $game_player.screen_y - 20
when 8
@carnada.x = $game_player.screen_x - 10
@carnada.y = $game_player.screen_y - 70
end
else
@carnada.opacity = 0
end
end
alias falcaofishing_transfer_player transfer_player
def transfer_player
falcaofishing_transfer_player
$game_player.pesca_rate = 150
end
end

#
# * Sprite caña. Falcao easy system.
#
class Sprite_Rod < RPG::Sprite
attr_accessor :character
def initialize(viewport, character = nil)
super(viewport)
@character = character
create_bitmap
update
end

def mierda_log
log = ["Falcao script log: Please import Fish_rod to character folder",
"Por favor Importe el grafico Fish_Rod a la carpeta character"]; p log
end

def update
super
update_src_rect
update_direction
end

def create_bitmap
self.bitmap = RPG::Cache.character("Fish_rod",0) rescue mierda_log
@cw = bitmap.width / 4
@ch = bitmap.height / 4
self.ox = @cw / 2
self.oy = @ch
self.visible = false
end

def update_src_rect
sx = @character.pattern * @cw
sy = (@character.direction - 2) / 2 * @ch
self.src_rect.set(sx, sy, @cw, @ch)
if $game_player.buscando || $game_player.help_text == FalcaoPesca::NoBugs
self.visible = true
else
self.visible = false
end
end

def update_direction
self.x = @character.screen_x
self.y = @character.screen_y
self.z = @character.screen_z(@ch)
self.opacity = @character.opacity
self.blend_type = @character.blend_type
self.bush_depth = @character.bush_depth
end
end
#
# * Spriteset_Map update sprites aliased
#
class Spriteset_Map
alias falcosprites_ini initialize
def initialize
falcosprites_ini
@plugin = true
@fish_rod_sprites = []
@fish_rod_sprites.push(Sprite_Rod.new(@viewport1, $game_player))
end
alias falcosprites_dispose dispose
def dispose
falcosprites_dispose
for rod in @fish_rod_sprites
rod.dispose
@plugin = false
end
end
alias falcaosprites_update update
def update
falcaosprites_update
if @plugin
for rod in @fish_rod_sprites
rod.update
end
end
end
end[/php]

Comments

  • kumuzukumuzu Posts: 669Registered
    trời script này đâu phải script hội thoại mặc định đâu script này hiện khung câu cá đấy chứ muốn thay hình hội thoại bằng hình chưa hiểu cho cái hình ví dụ được ko :dodgy:
  • sonlamsonlam Posts: 39Registered
    kumuzu wrote:
    trời script này đâu phải script hội thoại mặc định đâu script này hiện khung câu cá đấy chứ muốn thay hình hội thoại bằng hình chưa hiểu cho cái hình ví dụ được ko :dodgy:

    script này đúng là script câu cá.Nhưng mặc định của script là khi câu cá hoặc khi thả cần câu xuống sẽ hiện popup thông báo câu được loại cá nào.v.v.v..Nay mình muốn bỏ cái khung mặc định đó thay bằng 1 cái hình design cho đẹp mắt 1 tí.(vẫn hiện ra 1 cái khung nhưng là khung do mình design chứ ko phải khung mặc định
  • chechaochechao Posts: 164Registered
    đã từng có 1 hướng dẫn bằng hình cách làm điều này bằng cả script lẫn event trong forum
  • sonlamsonlam Posts: 39Registered
    chechao wrote:
    đã từng có 1 hướng dẫn bằng hình cách làm điều này bằng cả script lẫn event trong forum
    làm ơn chỉ dùm vì đang cần lắm CheChao ơi:D.tối qua mày mò làm hoài chẳng đc nên mới lên đây nhờ ai cao thủ script chỉ giúp.
  • sonlamsonlam Posts: 39Registered
    sao ko ai giúp hết vậy?hic hic
  • kumuzukumuzu Posts: 669Registered
    giảm opacity xuống show draw picture hoặc gọi luôn winskins khác cũng được
  • sonlamsonlam Posts: 39Registered
    kumuzu wrote:
    giảm opacity xuống show draw picture hoặc gọi luôn winskins khác cũng được

    hiện tại winskins ko hiện ra vì mình tắt hẳn rùi.Nhưng làm sao show hình ra?
  • kumuzukumuzu Posts: 669Registered
    su dung lenh show picture trong hoi thoai messger can toa do dung hoac trong script:
    @anh = sprite.new
    @anh.bitmap = RPG::Cache.picture("anh")
    @anh.x=0
    @anh.y=0
    @anh.z=0
  • WinKeyWinKey Posts: 188Registered
    Em củng muốn giúp, nhưng khổ nổi là em phế võ công với mất hết trí nhớ rồi :(
  • sonlamsonlam Posts: 39Registered
    WinKey wrote:
    Em củng muốn giúp, nhưng khổ nổi là em phế võ công với mất hết trí nhớ rồi :(

    hix.phế hết võ công rùi àh?Ko biết NgọaHổ hay Long Kiếm có rãnh hok ta?Giúp a 1 tí
  • Dang_KhoaDang_Khoa Posts: 3,861Administrators
    kumuzu wrote:
    su dung lenh show picture trong hoi thoai messger can toa do dung hoac trong script:
    @anh = sprite.new
    @anh.bitmap = RPG::Cache.picture("anh")
    @anh.x=0
    @anh.y=0
    @anh.z=0

    Anh làm theo hướng dẫn của kumuzu nè ^^
  • sonlamsonlam Posts: 39Registered
    Dang_Khoa wrote:
    kumuzu wrote:
    su dung lenh show picture trong hoi thoai messger can toa do dung hoac trong script:
    @anh = sprite.new
    @anh.bitmap = RPG::Cache.picture("anh")
    @anh.x=0
    @anh.y=0
    @anh.z=0

    Anh làm theo hướng dẫn của kumuzu nè ^^
    có thể sửa trực tiếp trên script ko Khoa?vì a ko phải dân lập trình,làm theo vẫn bị lỗi.keke
  • CryingWOLFCryingWOLF Posts: 1,766Registered
    sonlam wrote:
    WinKey wrote:
    Em củng muốn giúp, nhưng khổ nổi là em phế võ công với mất hết trí nhớ rồi :(

    hix.phế hết võ công rùi àh?Ko biết NgọaHổ hay Long Kiếm có rãnh hok ta?Giúp a 1 tí

    2 người đó đâu còn sống :uynhnhau:
  • MeoDenLuoiMeoDenLuoi Posts: 1,425Registered
    ngọa hổ thỉnh thoảng vẫn thấy on nhưng hình như ổng chỉ lướt qua thui :3
Sign In or Register to comment.