Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

RTAB Script...

I need help with this script:

class Game_Enemy
#--------------------------------------------------------------------------
#note type = 1 for item 2 for weapon and 3 for armor
def get_item_ids
hash = Hash.new([nil, nil, nil])
#hash[id] = [id, type, chance]
hash[24] = [4,1,20] #[item_id, item_type, chance]
hash[23] = [4,1,20]
return hash[self.id]
end
#--------------------------------------------------------------------------
def get_rare_ids
hash = Hash.new([nil, nil, nil])
#hash[id] = [id, type, chance]
hash[24] = [9,1,10] #[item_id, item_type, chance]
hash[23] = [9,1,10]
return hash[self.id]
end
end

#===================================================
# â–¼ CLASS Scan_Window Begins
#===================================================
class Scan_Window < Window_Base
def initialize(battler)
super(80,0,480,320)
self.contents = Bitmap.new(width - 32, height - 32)
@battler = battler
self.back_opacity = 160
refresh
end

def refresh
self.contents.clear
draw_scan(@battler)
end

def draw_scan(battler)
y = 0
self.contents.draw_text(0,y,120,32,battler.name)
self.contents.font.color = system_color
cx = contents.text_size("HP:").width
self.contents.draw_text(128,y,120,32,"HP:")
self.contents.draw_text(288,y,120,32,"SP:")
self.contents.font.color = normal_color
self.contents.draw_text(128+cx+8,y,120,32,"#{battler.hp}/#{battler.maxhp}")
self.contents.draw_text(288+cx+8,y,120,32,"#{battler.sp}/#{battler.maxsp}")
draw_battler(battler,0,y+32,128,128)
for i in 0..9
draw_parameter(battler,160*(i%2)+128,i/2 * 32 + 32, max_width, i)
end
draw_battler_items(battler,0,y+192)
draw_battler_elements(battler,0,y+224)
end

def draw_battler_items(battler,x,y)
cx = contents.text_size("Items:").width
self.contents.draw_text(x,y,cx,32,"Items:")
item = [battler.item_id, battler.weapon_id, battler.armor_id]
id = item.max
type = item.index(id)
type_array = ["items","weapons","armors"]
item_name = eval("$data_#{type_array[type]}[id].name") + " "
width = contents.text_size(item_name).width if item_name != nil
width = 0 if item_name == nil
self.contents.draw_text(x+cx+8,y,width,32,item_name)
total_width = cx+16+width
sec = battler.get_item_ids
if not sec.compact.empty?
sec_type = sec[1] - 1
sec_id = sec[0]
sec_name = eval("$data_#{type_array[sec_type]}[sec_id].name") + " "
width = contents.text_size(sec_name).width if sec_name != nil
self.contents.draw_text(x+total_width,y,width,32,sec_name)
total_width += 8+width
end
rare = battler.get_rare_ids
if not rare.compact.empty?
rare_type = rare[1] - 1
rare_id = rare[0]
rare_name = eval("$data_#{type_array[rare_type]}[rare_id].name")
width = contents.text_size(rare_name).width if rare_name != nil
self.contents.font.color = Color.new(255,224,32)
self.contents.draw_text(x+total_width,y,width,32,rare_name)
self.contents.font.color = normal_color
end
end

def draw_battler(battler,x,y,width,height)
bitmap = RPG::Cache.battler(battler.battler_name, battler.battler_hue)
w = bitmap.width
h = bitmap.height
zoom_x = w
zoom_y = h
if (w > width) or (h > height)
zoom_x = width if w > width
zoom_y = height if h > height
end
dest_rect = Rect.new(x, y, zoom_x, zoom_y)
src_rect = Rect.new(0, 0, w, h)
self.contents.stretch_blt(dest_rect, bitmap, src_rect, 255)
end

def draw_parameter(battler, x, y, width, type)
array = ["atk","pdef","mdef","str","dex","agi","int","eva","gold","exp"]
if not ["eva","exp"].include?(array[type])
name = eval("$data_system.words.#{array[type]}")
else
name = array[type].capitalize
end
value = eval("battler.#{array[type]}")
self.contents.font.color = system_color
self.contents.draw_text(x, y, width, 32, "#{name}")
self.contents.font.color = normal_color
self.contents.draw_text(x + width, y, 36, 32, "#{value}",2)
end

def max_width
array = ["atk","pdef","mdef","str","dex","agi","int","gold"]
max = 0
for i in 0..7
stat_name = eval("$data_system.words.#{array}")
if max < contents.text_size(stat_name).width
max = contents.text_size(stat_name).width
end
end
return max
end

def draw_battler_elements(battler, x, y)
elements = battler.weaknesses
string = "Weaknesses: "
if not elements.empty?
for element in elements
string += $data_system.elements[element] + " "
end
else
string += "None"
end
self.contents.draw_text(x, y, self.width, 32, string)
elements = battler.resistance
string = "Resists: "
if not elements.empty?
for element in elements
string += $data_system.elements[element] + " "
end
else
string += "None"
end
self.contents.draw_text(x, y+32, self.width, 32, string)
end
end

#===================================================
# â–² CLASS Scan_Window Ends
#===================================================



I get an Error everytime, It says that a method error I think. No method for Name...
 
Okay... I recognize this as PART of Trickster's Steal/Scan v6... and I'm assuming it's the RTAB variant. First and foremost, let me check my demo:

In order of appearance:
RTAB
RTab Add-Ons (with Connected Attacking last... if present at all)
Non-Official Add-Ons (Anim Batlrs / Minto's Config Screen...) (all optional)
Finally, Trickster's Scripts in this order:
* Steal_Constants
* Customizations (class game_enemy / class scan_window)
* Steal System
* Mods to Classes (class game_battleaction / class game_enemy)
* Trickster Module
* Scene_Title Edit
* Scan Fix for Animated Battlers (If using Animated Battlers)

Also, that you have a copy of Skills2.rxdata by Trickster in your Data folder (though if that was missing, you'd get an error in Scene_Title).
 
The error is actually caused by a small bug if the monster doesn't have a drop item and its a pretty hard error to spot and fix since its in a eval command

Code:
item = [battler.item_id, battler.weapon_id, battler.armor_id]
id = item.max
type = item.index(id)
if id != 0
  type_array = ["items","weapons","armors"]
  item_name = eval("$data_#{type_array[type]}[id].name") + " "
  width = contents.text_size(item_name).width if item_name != nil
  width = 0 if item_name == nil
  self.contents.draw_text(x+cx+8,y,width,32,item_name)
  total_width = cx+16+width
end

@DerVVulfman
Buzzer, Wrong...
The Skills2.rxdata is created from Skills.rxdata + Steal.rxdata. Steal.rxdata needs to go into the data folder if the user wants to edit the skill through the text file since I've gotten compliants that the skill was too hard to edit throught the data base, if they had copied the Skills2.rxdata and then encrpyt their game or didn't have Steal.rxdata then all of their skills will be replaced by the ones in Skills2.rxdata

Also I don't like my steal script being referred to by the name RTAB Script :-/, but oh well the error has been resolved
 
OOF! Forgot all about steal.rxdata! ':|

Oh, and I didn't mean to imply that your steal script is an RTAB script in anyway, only that if he's using your steal/scan system with RTAB, that he's using the 'one' script (the edited/patched one for RTAB) WITH all your others properly (even though I forgot about steal.rxdata myself). -_-
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top