Ich hab ein anderes Skript gefunden, das einen Fähigkeitenladen einführt: "BurritoSkillShop".
Theoretisch muss man eine Klasse erstellen, die alle Fähigkeiten, die verkauft werden sollen, in der Liste bei Stufenaufstiegen erlernen kann. In der ersten Zeile muss man dann die ID dieser Klasse angeben.
Jede Klasse muss außerdem alle Fähigkeiten, die sie kaufen können soll, in der Liste bei Stufenaufstiegen lernen können. Am stellt man dafür Stufe 99 ein, da kommt eh niemand hin.
Achtung! So wie das Skript momentan ist, funktioniert es nicht! Es taucht im Spiel ein Fehler auf, ich kann ihn aber nicht beheben und habe auch da, wo das Skript beschrieben wurde, keine Lösung gefunden (Ich glaub sogar, das war irgendwo in diesem Forum
)! Ich schreibe das Skript jetzt trotzdem aber mal, vielleicht kann jemand den Fehler beheben.
Das wäre aber echt gut, wenn jemand den skill shop von Trickster hätte... Ich bräuchte es auch!
Theoretisch muss man eine Klasse erstellen, die alle Fähigkeiten, die verkauft werden sollen, in der Liste bei Stufenaufstiegen erlernen kann. In der ersten Zeile muss man dann die ID dieser Klasse angeben.
Jede Klasse muss außerdem alle Fähigkeiten, die sie kaufen können soll, in der Liste bei Stufenaufstiegen lernen können. Am stellt man dafür Stufe 99 ein, da kommt eh niemand hin.
Achtung! So wie das Skript momentan ist, funktioniert es nicht! Es taucht im Spiel ein Fehler auf, ich kann ihn aber nicht beheben und habe auch da, wo das Skript beschrieben wurde, keine Lösung gefunden (Ich glaub sogar, das war irgendwo in diesem Forum
)! Ich schreibe das Skript jetzt trotzdem aber mal, vielleicht kann jemand den Fehler beheben.|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 |
module BurritoSkillshop
SKILLPRICE_CLASS_ID = 6
end
class Scene_Skillshop
def initialize(skill_ids)
@skills = []
skill_ids.each { |id| @skills.push($data_skills[id]) }
end
def main
build_view
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
Graphics.freeze
cleanup
end
def build_view
@help_window = Window_Help.new
@gold_window = Window_Gold.new
@gold_window.x = 480
@gold_window.y = 64
@command_window = Window_SkillshopCommand.new
@command_window.active = true
@left_window = Window_SkillshopLeft.new(@skills)
@left_window.help_window = @help_window
@left_window.active = false
@right_window = Window_SkillshopRight.new
@right_window.active = false
@help_window.set_text("")
end
def update
@help_window.update
@gold_window.update
@command_window.update
@left_window.update
@right_window.update
if @command_window.active
update_command
return
end
if @left_window.active
update_left
return
end
if @right_window.active
update_right
return
end
end
def update_command
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
case @command_window.index
when 0
@command_window.active = false
@left_window.active = true
when 1
$scene = Scene_Map.new
end
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
end
end
def update_left
@right_window.skill = @left_window.skill
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@left_window.active = false
@command_window.active = true
@help_window.set_text("")
@left_window.index = 0
end
if Input.trigger?(Input::C)
if @left_window.price > $game_party.gold
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
@left_window.active = false
@right_window.active = true
@right_window.index = 0
end
end
def update_right
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@left_window.active = true
@right_window.active = false
@right_window.index = -1
end
if Input.trigger?(Input::C)
if not @right_window.ok?
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$game_party.lose_gold(@left_window.price)
@right_window.actor.learn_skill(@left_window.skill.id)
@right_window.refresh
@gold_window.refresh
@left_window.refresh
end
end
def cleanup
@help_window.visible = false
@help_window.dispose
@gold_window.visible = false
@gold_window.dispose
@command_window.visible = false
@command_window.dispose
@left_window.visible = false
@left_window.dispose
@right_window.visible = false
@right_window.dispose
end
end
class Window_SkillshopCommand < Window_Selectable
def initialize
super(0, 64, 480, 64)
self.contents = Bitmap.new(width - 32, height - 32)
@item_max = 2
@column_max = 3
@commands = ["Kaufen", "Verlassen"]
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
x = 4 + index * 160
self.contents.draw_text(x, 0, 128, 32, @commands[index])
end
end
class Window_SkillshopLeft < Window_Selectable
def initialize(skills)
super(0, 128, 368, 352)
@data = skills
set_prices
refresh
self.index = 0
end
def set_prices
@prices = {}
$data_classes[BurritoSkillshop::SKILLPRICE_CLASS_ID].learnings.each do |learning|
@prices[learning.skill_id] = learning.level * 10
end
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
# If item count is not 0, make a bit map and draw all items
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
def skill
return @data[self.index]
end
def price
return @prices[self.skill.id]
end
def draw_item(index)
skill = @data[index]
# If price is less than money in possession, then set to normal text color.
# Otherwise set to disabled color
if @prices[skill.id] <= $game_party.gold
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4
y = index * 32
rect = Rect.new(x, y, self.width - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, skill.name, 0)
self.contents.draw_text(x + 240, y, 88, 32, @prices[skill.id].to_s, 2)
end
def update_help
@help_window.set_text(self.skill == nil ? "" : self.skill.description)
end
end
class Window_SkillshopRight < Window_Selectable
def initialize
super(368, 128, 272, 352)
self.contents = Bitmap.new(width - 32, height - 32)
@skill = nil
@index = -1
refresh
end
def refresh
self.contents.clear
@item_max = $game_party.actors.size
self.contents.font.color = normal_color
for i in 0 ... $game_party.actors.size
actor = $game_party.actors
draw_actor_graphic(actor, 16, 64 + 64 * i)
self.contents.draw_text(64, 16 + 64 * i, 120, 32, actor.name)
end
return if @skill == nil
@learn_ok = []
for i in 0 ... $game_party.actors.size
actor = $game_party.actors
text = "Nicht möglich"
color = disabled_color
ok = false
$data_classes[actor.class_id].learnings.each do |l|
if l.skill_id == @skill.id
text = "Nicht erlernt"
color = normal_color
ok = true
end
end
actor.skills.each do |s|
if s == @skill.id
text = "Bereits erlernt"
color = disabled_color
ok = false
end
end
@learn_ok.push(ok)
self.contents.font.color = color
self.contents.draw_text(64, 32 + 64 * i, 120, 32, text)
end
end
def skill=(skill)
if @skill != skill
@skill = skill
refresh
end
end
def ok?
return @learn_ok[self.index]
end
def actor
return $game_party.actors[self.index]
end
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, 16 + 64 * @index, self.width - 32, 64)
end
end
end |
zum Lesen den Text mit der Maus markieren
Das wäre aber echt gut, wenn jemand den skill shop von Trickster hätte... Ich bräuchte es auch!

YAams
Random Signatur