Jump to content
Sign in to follow this  
Ninkoro

Something in this short addon is messing up the save function...Help?

Recommended Posts

After fighting a battle using the Theo Battle system - http://forums.rpgmakerweb.com/index.php?/topic/29231-theolized-sideview-battle-system-version-14-patch/
the save function wont work, and it only plays a buzzer.
 
So, after about a half-hour of using the process of elimination, I found out that one of its add-on scripts is screwing up the save function. Could anyone who knows Ruby syntax help me out here and look through this real quick? It's not too long I promise.

 

 

#==============================================================================
# TSBS Addon - Basename Changer
# Version : 1.0
# Language : English
# Requires : Theolized SBS version 1.4
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Contact :
#------------------------------------------------------------------------------
# *> http://www.rpgmakerid.com
# *> http://www.rpgmakervxace.net
# *> http://theolized.blogspot.com
#==============================================================================
($imported ||= {})[:TSBS_BaseName] = true
#==============================================================================
# Change Logs:
# -----------------------------------------------------------------------------
# 2014.10.13 - Finished
#==============================================================================
%Q{

=================
||Introduction ||
-----------------
Started from some people who bugging me, "Hey, can you make the battler image
changes when it equipped with different weapon?". At first I refused it since
I believe it will be troublesome. Until I found the 'best' way to overcome
this problem

Well, this script was intended to change the actor graphics when they changed
their equip. Though, I ended up making the actor can be changed when they
met a certain condition. That said, I named this script as 'Basename Changer'

================
|| How to use ||
----------------
Simply put this script below TSBS implementation
Edit the configuration as you fit. Instruction provided below

===================
|| Terms of use ||
-------------------
Credit me, TheoAllen. You are free to edit this script by your own. As long
as you don't claim it yours. For commercial purpose, don't forget to give me
a free copy of the game.

}
#==============================================================================
# Konfigurasi
#==============================================================================
module TSBS
#------------------------------------------------------------------------------
ActorBaseName = {} # <-- Keramat. Jangan disentuh!
#------------------------------------------------------------------------------
# To use this configuration, you must first write is
#
# ActorBaseName [actor_id] = {}
# Replace 'actor_id' with actor ID in the database that you want fluctuates
#
# Then enter the condition in the {} with a format like this
# "Condition" => "battlername"
#
# Example:
# ActorBaseName [1] = {
# 'Weapon_id == 1' => 'EricSword'
#}
#
# If the first actor to bring the weapon with ID 1 then the name will essentially be replaced
# Be EricSword_1, EricSword_2 etc ...
#
# In addition to 'weapon_id' you can also use some other conditions such as
# > shield_id
# > helmet_id
# > armor_id
# > acc_id
#------------------------------------------------------------------------------

#Ninkoro
ActorBaseName[2] = {
"weapon_id == 3" => "NinkoroDSword",
"weapon_id == 4" => "NinkoroDStaff",
"weapon_id == 5" => "NinkoroDShield",
}

#Tomm
ActorBaseName[3] = {
"weapon_id == 1" => "TommUltima",
}

end
#==============================================================================
# Akhir dari konfigurasi
#==============================================================================
#------------------------------------------------------------------------------
# Optimized eval formula ~
#------------------------------------------------------------------------------
def proc_eval(f, id)
(@proc ||= {})[f] ||= eval("lambda { #{f} }")
begin
@proc[f].call
rescue StandardError => err
ErrorSound.play
text = "Theolized SBS : \nBasename Changer Condition check error on Actor" +
" ID : #{id}\n\n" + err.to_s
msgbox text
exit
end
end

if $imported[:TSBS]
class Game_Actor

alias tsbs_ori_base_name base_battler_name
def base_battler_name
return tsbs_ori_base_name unless ActorBaseName.include?(self.id)
namecase = ActorBaseName[id]
namecase.each do |condition, name|
return name if proc_eval(condition, id)
end
return tsbs_ori_base_name
end
#----------------------------------------------------------------------------
# Additional helper methods. Most likely won't works for heavily modified
# custom equip slots
#----------------------------------------------------------------------------
def weapon_id(slot = 0)
return 0 unless weapons[slot]
return weapons[slot].id
end

def weapon_type(slot = 0)
return 0 unless weapons[slot]
return weapons[slot].wtype_id
end

def shield_id
shield = armors.find {|armor| armor && armor.etype_id == 1}
return 0 unless shield
return shield.id
end

def shield_type
shield = armors.find {|armor| armor && armor.etype_id == 1}
return 0 unless shield
return shield.atype_id
end

def helmet_id
helm = armors.find {|armor| armor && armor.etype_id == 2}
return 0 unless helm
return helm.id
end

def helmet_type
helm = armors.find {|armor| armor && armor.etype_id == 2}
return 0 unless helm
return helm.atype_id
end

def armor_id
body = armors.find {|armor| armor && armor.etype_id == 3}
return 0 unless body
return body.id
end

def armor_type
body = armors.find {|armor| armor && armor.etype_id == 3}
return 0 unless body
return body.atype_id
end

def acc_id
acc = armors.find {|armor| armor && armor.etype_id == 4}
return 0 unless acc
return acc.id
end

def acc_type
acc = armors.find {|armor| armor && armor.etype_id == 4}
return 0 unless acc
return acc.atype_id
end

end

end # $imported[:TSBS]

 

 

EDIT: Not only that, but this addon is also causing this error when I try to equip a weapon after participating in a battle:

 

"Script 'Window_EquipItem' line 73: TypeError occurred.

 

no marshal_dump is defined for class Proc"

 

 

 

Thanks for anyone willing to take a look at this!

Edited by Ninkoro

Share this post


Link to post
Share on other sites

some suspicion is at the proc_eval method...

from quick glance there's nothing that should affect save.

but in case that method that caused the problem...

try changing

 

  def base_battler_name
    return tsbs_ori_base_name unless ActorBaseName.include?(self.id)
    namecase = ActorBaseName[id]
    namecase.each do |condition, name|
      return name if proc_eval(condition, id)
    end
    return tsbs_ori_base_name
  end

to

 

  def base_battler_name
    return tsbs_ori_base_name unless ActorBaseName.include?(self.id)
    namecase = ActorBaseName[id]
    namecase.each do |condition, name|
      return name if eval(condition)
    end
    return tsbs_ori_base_name
  end

 

 

also...

did you load the save file or you start new game after inserting the script above?

did you try using only theo's sbs and the script above. it might be incompatibility with other script?

Share this post


Link to post
Share on other sites
...

 

Yes I copied Theo's stuff onto a blank projected and isolated the problem, use newgame, I've done all the necessary measures as I've researched this problem extensivley before creating my own topic.

 

Anyways, that fixed it! Wow thank you so much! This literally saved me.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×