For the Dir problem, the script's author completely forgot that in Ruby there exists a module called Dir, which one of the XPA scripts relies on. They essentially wiped out the existence of that module by making a configuration option for it:
Dir = 0 # Direccion del Chara (2:abajo, 4:izq, 6:dch, 8:arriba)
This is bad design on their part. You can quickly correct this by renaming the variable to something else (like
Direction) and updating the line
$game_temp.player_new_direction = Dir
accordingly.
EDIT: Actually, you might run into issues with this script again down the road, so let me just fix it up entirely:
#===========================================
# Script por: Kotfire
# Versión : 1.1
#-------------------------------------------------------------------------- ---
# -Instrucciones-
# Pegar encima de main y disfrutar
# Editar las condiciones (abajo)
# Si en algún mapa quieres quitarlo call script: $game_temp.battle_gameover = true
#-------------------------------------------------------------------------- ---
module NoGameover
RecoverAll = false # Recuperar hp, mp, estados...?
Teleport = true # Teletransportar a un mapa concreto?
X = 20 # Coord X del mapa
Y = 7 # Coord Y del mapa
ID = 28 # Id del mapa
Direction = 0 # Direccion del Chara (2:abajo, 4:izq, 6:dch, 8:arriba)
Exp = false # Perder Exp?
Exp_lost = 0 # Cantidad de Exp a perder
Gold = false # Perder Dinero?
Gold_lost = 0 # Cantidad de Dinero a perder
GameOver = false # Ir al GameOver
Nada = false # Si no eliges nada, activa este para que no esten muertos
end
#========================================================================== ====
# ¦ Game_Temp
#========================================================================== ====
class Game_Temp
#---------------------------------------------------------------------- ----
attr_accessor :battle_gameover
#---------------------------------------------------------------------- ----
alias initialize_kot initialize
def initialize
@battle_gameover = false
initialize_kot
end
end
#========================================================================== ====
# ¦ Scene_Battle (1)
#========================================================================== ====
class Scene_Battle
#--------------------------------------------------------------------------
def judge
if $game_party.all_dead? or $game_party.actors.size == 0
if $game_temp.battle_can_lose
$game_system.bgm_play($game_temp.map_bgm)
battle_end(2)
return true
elsif !$game_temp.battle_gameover
$game_system.bgm_play($game_temp.map_bgm)
battle_end(2)
for actor in $game_party.actors
if NoGameover::RecoverAll
actor.recover_all
end
if NoGameover::Exp
actor.exp -= NoGameover::Exp_lost
end
if NoGameover::Nada
actor.hp += 0
end
end
if NoGameover::Teleport
$game_temp.player_transferring = true
$game_temp.player_new_map_id = NoGameover::ID
$game_temp.player_new_x = NoGameover::X
$game_temp.player_new_y = NoGameover::Y
$game_temp.player_new_direction = NoGameover::Direction
$game_variables[13] += 1
$game_variables[17] += 1
end
if NoGameover::Gold
$game_party.lose_gold(NoGameover::Gold_lost)
end
if NoGameover::GameOver
$game_temp.gameover = true
end
return true
end
end
for enemy in $game_troop.enemies
if enemy.exist?
return false
end
end
start_phase5
return true
end
end
For the draw_triangle problem, it has now occurred to me that Kernel methods can be called from another class, but will result in it being a private method. I guess I learned something new today.
Anyways, looks to be like an oversight the script's author missed completely. The draw_triangle method should be contained within the Bitmap class, like so
#==============================================================================
# Bitmap
#==============================================================================
class Bitmap
#--------------------------------------------------------------------------
# * Draw Line
#--------------------------------------------------------------------------
def draw_elemental_line(start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
distance = (start_x - end_x).abs + (start_y - end_y).abs
if end_color == start_color
(1..distance).each {|i|
x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
if width == 1
self.set_pixel(x, y, start_color)
else
self.fill_rect(x, y, width, width, start_color)
end
}
else
(1..distance).each {|i|
x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
r = start_color.red * (distance-i)/distance + end_color.red * i/distance
g = start_color.green * (distance-i)/distance + end_color.green * i/distance
b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
if width == 1
self.set_pixel(x, y, Color.new(r, g, b, a))
else
self.fill_rect(x, y, width, width, Color.new(r, g, b, a))
end
}
end
end
# Elemental Star Settings
#--------------------------------------------------------------------------
# Element Star made by Tsu, based on Prefix's Element Wheel
#--------------------------------------------------------------------------
#----------------------------------------------------------------------------
# Draws a triangle that passes (angle-wise) from start to end color
#----------------------------------------------------------------------------
def draw_triangle(cx, cy, start_x, start_y, end_x, end_y, start_color, width = 1, end_color = start_color)
distance = (start_x - end_x).abs + (start_y - end_y).abs
(1..distance).each {|i|
x = (start_x + 1.0 * (end_x - start_x) * i / distance).to_i
y = (start_y + 1.0 * (end_y - start_y) * i / distance).to_i
r = start_color.red * (distance-i)/distance + end_color.red * i/distance
g = start_color.green * (distance-i)/distance + end_color.green * i/distance
b = start_color.blue * (distance-i)/distance + end_color.blue * i/distance
a = start_color.alpha * (distance-i)/distance + end_color.alpha * i/distance
draw_elemental_line(cx, cy, x, y, Color.new(r, g, b, a), width, Color.new(r, g, b, a))
}
end
end