• Anmelden

DieErdnuss

Ankömmling

  • »DieErdnuss« ist der Autor dieses Themas

Motto: Let's Rock & Ride!

  • Nachricht senden

1

Montag, 1. Februar 2010, 22:16

Probleme mit Teamwechselskript

Hallo Leute,
bin gerade neu in die Maker-Community gekommen und hoffe, dass ihr mir bei meinem Problem weiterhelfen könnt.

Ich habe das Teamwechselskript von Caesar in mein Spiel eingebaut.

Soweit funktioniert alles auch ganz gut. Am Anfang hab ich nur einen Helden, der kann auch nicht ausgetauscht werden.
Wenn ich Leute über ein Event der Party hinzufüge funktioniert auch noch alles. Wenn ich diese dann aber über das Menü entferne, sind sie weg! Ich kann sie auch nicht zurückholen.
Zweites Problem ist, wenn ich bereits 4 Leute in der Party habe, wird die 5te Person nicht in die "Reserve" geschickt, sondern ganz einfach ignoriert.

Kann mir da eventuell jemand weiterhelfen?

Hier ist noch der Quelltext:
Spoiler

#//////////////////////////////////////////Teamwechsel//////////////////////////////////////
#~~~~~~~~~~~~~~~~~~~~by Caesar~~~~~~~~~~~~~~~~~
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
class Scene_Party
def main
@left = $game_party.actors.collect { |actor| actor.id}
@right = $game_temp.selectable_actors - $game_party.actors.collect{|i| i.id}
@window_actor = Window_ActorInfo.new
@help_window = Window_Help.new
@help_window.set_text(remove_actor_text, 1)
@window_left = Window_Command.new(320, @left.collect{
|i| $data_actors.name})
@window_left.y = 64
@window_left.height = 268
if @right.size == 0
@window_right = Window_Command.new(320,[""])
else
@window_right = Window_Command.new(320, @right.collect{
|i| $data_actors[i].name})
end
@window_right.x = 320
@window_right.y = 64
@window_right.height = 268
set_inactive(@window_right)
@old_index = -1
Graphics.transition
loop do
Graphics.update
Input.update
update
break unless $scene == self
end
Graphics.freeze
@window_actor.dispose
@help_window.dispose
@window_left.dispose
@window_right.dispose
end
#---------------
def update
@window_actor.update
@help_window.update
@window_left.update
@window_right.update
@window_right.cursor_rect.empty if @right.size == 0
#::::::::::::::
if Input.trigger?(Input::B)
if @left.size <= 0
$game_system.se_play($data_system.buzzer_se)
@help_window.set_text(no_actors_text, 1)
elsif @left.size > 4
$game_system.se_play($data_system.buzzer_se)
@help_window.set_text(too_many_actors_text, 1)
else
$game_party.actors.clear
@left.each {|i| $game_party.add_actor(i)}
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
end
end
#:::::::::::::::::
if Input.trigger?(Input::C)
if @window_left.active and @left[@window_left.index] == 1
$game_system.se_play($data_system.buzzer_se)
@help_window.set_text("Damien kann nicht aus dem Team entfernt werden!", 1)
return
end
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
if @window_left.active
unless @window_left.index == 0 then
@right.push(@left.delete_at(@window_left.index))
@old_index = -1
if @left.size <= 0
@help_window.set_text(remove_actor_text, 1)
set_inactive(@window_left)
set_active(@window_right)
end
end
else
@left.push(@right.delete_at(@window_right.index))
@old_index = -1
if @right.size <= 0
@help_window.set_text(add_actor_text, 1)
set_inactive(@window_right)
set_active(@window_left)
end
end
@window_left.commands = @left.collect{|i| $data_actors[i].name}
@window_right.commands = @right.collect{|i| $data_actors[i].name}
end
#::::::::::::::::::
if Input.trigger?(Input::LEFT) and @window_right.active
if @left.size > 0
@old_index = -1
@help_window.set_text(remove_actor_text, 1)
$game_system.se_play($data_system.cursor_se)
set_inactive(@window_right)
set_active(@window_left)
else
$game_system.se_play($data_system.buzzer_se)
end
end
#:::::::::::::::::
if Input.trigger?(Input::RIGHT) and @window_left.active
if @right.size > 0
@old_index = -1
@help_window.set_text(add_actor_text, 1)
$game_system.se_play($data_system.cursor_se)
set_inactive(@window_left)
set_active(@window_right)
else
$game_system.se_play($data_system.buzzer_se)
end
end
#::::::::::::::::::
if Input.repeat?(Input::L) and @window_left.active
unless @window_left.index == 1 then
@left.swap_up!(@window_left.index)
@window_left.swap_up
end
end
#::::::::::::::::::
if Input.repeat?(Input::R) and @window_left.active
@left.swap_down!(@window_left.index)
unless @window_left.index == 0 then
@window_left.swap_down
end
end
#::::::::::::::::::
index = @window_left.active ? @window_left.index : @window_right.index
if index != @old_index
@old_index = index
update_actor_info
end
end
#--------------------
def update_actor_info
if @window_left.active
index = @window_left.index
@window_actor.actor = $game_actors[@left[index]] if index != -1
else
index = @window_right.index
@window_actor.actor = $game_actors[@right[index]] if index != -1
end
end
#--------------------
def set_active(window)
window.active = true
window.opacity = 255
window.contents_opacity = 255
end
#--------------------
def set_inactive(window)
window.active = false
window.opacity = 160
window.contents_opacity = 160
end
#--------------------
def add_actor_text
"Helden dem Team hinzufügen"
end
#--------------------
def remove_actor_text
"Helden aus dem Team entfernen"
end
#--------------------
def too_many_actors_text
"Es sind zu viele Helden im Team!"
end
#--------------------
def no_actors_text
"Im Team muss sich mindestens ein Held befinden!"
end
end
#==================
class Window_ActorInfo < Window_Base
attr_reader :actor
#----------------
def initialize(actor=nil)
super(0, 332, 640, 148 )
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#-----------------
def refresh
self.contents.clear
return if @actor.nil?
x = 140
draw_actor_graphic(@actor, x - 40, 80)
draw_actor_name(@actor, x, 0)
draw_actor_class(@actor, x + 144, 0)
draw_actor_level(@actor, x, 32)
draw_actor_state(@actor, x + 90, 32)
draw_actor_exp(@actor, x, 64)
draw_actor_hp(@actor, x + 236, 32)
draw_actor_sp(@actor, x + 236, 64)
end
#-----------------
def actor=(actor)
@actor = actor
refresh
end
end
#=========================
class Window_Command < Window_Selectable
attr_reader :commands
#--------------
def commands=(commands)
if commands.size != @commands.size
@item_max = commands.size
self.contents = Bitmap.new(width - 32, @item_max * 32) if @item_max > 0
@index -= 1 if @index >= @item_max
@index = 0 if @item_max == 1
end
@commands = commands
refresh
end
#---------------
def swap_up
$game_system.se_play($data_system.cursor_se)
@commands = @commands.swap_up(@index)
if @index > 0
@index -= 1
refresh
end
end
#-----------------
def swap_down
$game_system.se_play($data_system.cursor_se)
@commands = @commands.swap_down(@index)
if @index < @commands.size-1
@index += 1
refresh
end
end
end
#========================
class Array
def swap_up(index)
arr = dup
return arr unless index > 0
arr[index] = self[index-1]
arr[index-1] = self[index]
return arr
end
#------------------
def swap_down(index)
arr = dup
return arr unless index < size-1
arr[index] = self[index+1]
arr[index+1] = self[index]
return arr
end
#----------------
def swap_up!(index)
return unless index > 0
temp = self[index]
self[index] = self[index-1]
self[index-1] = temp
end
#----------------
def swap_down!(index)
return unless index < size-1
temp = self[index]
self[index] = self[index+1]
self[index+1] = temp
end
end
#========================
class Game_Temp
attr_accessor :selectable_actors
#--------------
alias actors_init initialize
def initialize
actors_init
@selectable_actors = [1]
end
end

zum Lesen den Text mit der Maus markieren

DieErdnuss

Ankömmling

  • »DieErdnuss« ist der Autor dieses Themas

Motto: Let's Rock & Ride!

  • Nachricht senden

2

Montag, 1. Februar 2010, 22:24

Sry, ist beim Falschen RPG-Maker Forum gelandet, bitte zum XP verschieben.

Social Bookmarks