Zetaraptor03
Member
Mr. Mo's SBABS has been around for awhile, but it still has some errors. If you change the party leader and then save, this error message is displayed.
Script 'o SDK Part III' line 1773: TypeError occured.
no marshal_dump is defined for class Sprite.
I traced the code and found line 1773 in the SDK:
1773: Marshal.dump($game_actors, file)
These pieces of code from Mr. Mo's ABS might be the problem...
The problem occurs only after the party leader is switched to one of the allies using the code in Game_Party.
The code for moving forward or backward through the party members may be messing something up.
Mr. Mo's SBABS can be found here:
http://www.rmxp.org/forums/showthread.php?t=19797
Unfortunately, Mr. Mo has moved on to commercial scripting, so I couldn't get his help. I would appreciate any help in fixing this.
Script 'o SDK Part III' line 1773: TypeError occured.
no marshal_dump is defined for class Sprite.
I traced the code and found line 1773 in the SDK:
1773: Marshal.dump($game_actors, file)
These pieces of code from Mr. Mo's ABS might be the problem...
Code:
#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
# This class handles the party. It includes information on amount of gold
# and items. Refer to "$game_party" for the instance of this class.
#==============================================================================
class Game_Party
attr_accessor :items
#--------------------------------------------------------------------------
alias mrmo_sbabs_gm_ssm setup_starting_members
#--------------------------------------------------------------------------
# * Initial Party Setup
#--------------------------------------------------------------------------
def setup_starting_members
mrmo_sbabs_gm_ssm
$game_player.actor = $game_party.actors[0]
# Game Allies
for i in 1..@actors.size
next if @actors[i] == nil
$game_allies[i] = Game_Ally.new(i)
$game_allies[i].refresh
end
end
#--------------------------------------------------------------------------
# * Add an Actor
# actor_id : actor ID
#--------------------------------------------------------------------------
def add_actor(actor_id)
# Get actor
actor = $game_actors[actor_id]
# If the party has less than 4 members and this actor is not in the party
if @actors.size < $ABS.MAX_ACTORS and not @actors.include?(actor)
# Add actor
@actors.push(actor)
# Refresh player
$game_player.refresh
# Get Id
id = @actors.size-1
# Add Ally
$game_allies[id] = Game_Ally.new(id)
$game_allies[id].refresh
$game_allies[id].moveto($game_player.x,$game_player.y)
# Add Ally to screen
$scene.add_ally($game_allies[id]) if $scene.is_a?(Scene_Map)
end
end
#--------------------------------------------------------------------------
# * Remove Actor
# actor_id : actor ID
#--------------------------------------------------------------------------
def remove_actor(actor_id)
# Delete Ally
for ally in $game_allies
next if ally.nil?
if $game_actors[actor_id] == ally.actor
$game_allies.delete(ally)
ally.dispose
break
end
end
# Delete actor
@actors.delete($game_actors[actor_id])
# Refresh player
$game_player.refresh
# Refresh Sprites in Spriteset_Map
$scene.refresh_sprites if $scene.is_a?(Scene_Map)
end
#--------------------------------------------------------------------------
# * Move Forward
#--------------------------------------------------------------------------
def move_forward
# Return if allies not in map.
for ally in $game_allies
next if ally == nil or ally.map_id == $game_map.map_id
return
end
# Return if party size is 1
return if @actors.size == 1
# Record current actor.
actor = @actors[0]
# Remove actor
@actors.delete(actor)
@actors.compact
# Check if everyone except leader is dead
if all_dead?
@actors.insert(0,actor)
return
end
$game_player.end_animate_mo
for i in $game_allies
next if i == nil
i.end_animate_mo
end
# Insert leader to last place
@actors.push(actor)
# Loop members until alive
for a in @actors
next if a == nil
if a.dead?
ally = a
@actors.delete(a)
@actors.push(a)
else
for i in $game_allies
next if i == nil or i.actor != a
ally = i
end
break
end
end
allies = []
# Record other positons
for a in $game_allies
next if a == nil
allies.push(a)
end
# Delete new leader from list
allies.delete(ally)
allies.push($game_player)
allies.compact
# Redo Game_Allies
for i in 1..@actors.size
next if @actors[i] == nil
$game_allies[i] = Game_Ally.new(i)
$game_allies[i].refresh
$game_allies[i].moveto(allies[i-1].x,allies[i-1].y)
if !allies[i-1].is_a?(Game_Player)
$game_allies[i].map_id = allies[i-1].map_id
else
$game_allies[i].map_id = $game_map.map_id
end
$game_allies[i].stay if $game_party.stay?
$game_allies[i].direction = allies[i-1].direction
end
# Refreshe game player
$game_player.moveto(ally.x,ally.y)
$game_player.refresh
# Refresh Sprites in Spriteset_Map
$scene.refresh_sprites if $scene.is_a?(Scene_Map)
end
#--------------------------------------------------------------------------
# * Move Backward
#--------------------------------------------------------------------------
def move_backward
# Return if allies not in map.
for ally in $game_allies
next if ally == nil or ally.map_id == $game_map.map_id
return
end
# Return if party size is 1
return if @actors.size == 1
# Record current actor.
actor = @actors[0]
# Remove actor
@actors.delete(actor)
@actors.compact
# Check if everyone except leader is dead
if all_dead?
@actors.insert(0,actor)
return
else
@actors.insert(0,actor)
end
$game_player.end_animate_mo
for i in $game_allies
next if i == nil
i.end_animate_mo
end
# Loop members until alive
for a in @actors.reverse
next if a == nil
if a.dead?
ally = a
@actors.delete(a)
@actors.insert(0,a)
else
# Insert to a head
@actors.delete(a)
@actors.insert(0,a)
@actors.compact
for i in $game_allies
next if i == nil or i.actor != a
ally = i
end
break
end
end
allies = []
# Record other positons
for a in $game_allies
next if a == nil
allies.push(a)
end
# Delete new leader from list
allies.delete(ally)
allies.insert(0,$game_player)
allies.compact
# Redo Game_Allies
for i in 1..@actors.size
next if @actors[i] == nil
$game_allies[i] = Game_Ally.new(i)
$game_allies[i].refresh
$game_allies[i].moveto(allies[i-1].x,allies[i-1].y)
$game_allies[i].direction = allies[i-1].direction
if !allies[i-1].is_a?(Game_Player)
$game_allies[i].map_id = allies[i-1].map_id
else
$game_allies[i].map_id = $game_map.map_id
end
$game_allies[i].stay if $game_party.stay?
end
# Refreshe game player
$game_player.moveto(ally.x,ally.y)
$game_player.refresh
# Refresh Sprites in Spriteset_Map
$scene.refresh_sprites if $scene.is_a?(Scene_Map)
end
#--------------------------------------------------------------------------
# * Ally check
#--------------------------------------------------------------------------
def ally_pos(x,y)
for ally in $game_allies
next if ally.nil?
return ally if ally.x == x and ally.y == y
end
return false
end
#--------------------------------------------------------------------------
# * Stay?
#--------------------------------------------------------------------------
def stay?
for ally in $game_allies
next if ally == nil or !ally.stay?
return true
end
return false
end
end
Code:
#============================================================================
# * Scene Save
#============================================================================
class Scene_Save < Scene_File
#--------------------------------------------------------------------------
alias mrmo_sbabs_scene_save_write_data write_data
#--------------------------------------------------------------------------
def write_data(file)
sprite2 = []
# Game Ally Command Sprite
for i in 0..$game_allies.size
next if $game_allies[i].nil?
sprite2[i] = $game_allies[i].command_sprite
$game_allies[i].command_sprite = nil
end
mrmo_sbabs_scene_save_write_data(file)
sprite = $ABS.display_sprite
$ABS.display_sprite = nil
Marshal.dump($ABS, file)
Marshal.dump($game_allies,file)
$ABS.display_sprite = sprite
# Game Ally Command Sprite
for i in 0..$game_allies.size
next if $game_allies[i].nil?
$game_allies[i].command_sprite = sprite2[i]
end
end
end
The problem occurs only after the party leader is switched to one of the allies using the code in Game_Party.
The code for moving forward or backward through the party members may be messing something up.
Mr. Mo's SBABS can be found here:
http://www.rmxp.org/forums/showthread.php?t=19797
Unfortunately, Mr. Mo has moved on to commercial scripting, so I couldn't get his help. I would appreciate any help in fixing this.