# = Benutzung = #
# Grafik #
# Bild in Ordner Pictures kopieren und den Namen in WORLDMAP_NAME eintragen.
# Zielpunkte #
# Unter POINTS, können Zielpunkte eingetrategn werden. Dise sind wiefolgt zu
# definieren:
# "Name des Zielpunktes" => [icon_id,x-koordinate,y-koordinate,animation]
# Name des Zielpunktes, spielt keine Rolle. Es wird ledeglich zur indifizierung
# verwendet.
# icon_id muss natürlich mit der ID des Icons ersetzt werden.
# x- und y-koordinate sind die Koordinaten des Ziels auf der Weltkarte.
# (Beachte, dass man von der Dimension der Weltkarte spricht)
# animation ist eine Zahl zwischen 0 und 2.
# 0 = keine Animation | 1 = Springen | 2 = Kreisen
# Nachdem man Ziele definiert hat, kann man diese via Call Script freischalten.
# Dies tut man mit folgendem Call Script:
# add_worldmap_point(zielname)
# zielname wird jetzt mit dem oben genannten "Name des Zielpunktes" ersetzt.
# Will mal ein Ziel aus der Karte entfernen, so benutzt man das oben genannte
# Prinzip, allerdings mit folgendem Call Script:
# remove_worldmap_point(zielname)
# Character #
# Jede Map, die betreten wird, aktualisiert die Koordinaten des Helden auf der
# Weltkarte. Um diese zu bestimmen, muss folgendes in den Namen der Map
# vorkommen:
# \X[x-koordinate]
# \Y[y-koordinate]
# Auch hier sollte nicht vergessen werden, dass wir uns in der Dimension der
# Weltkarte befinden, also die Koordinaten innherlab der Masse der Grafik liegen
# können.
# Die Koordinaten können aber auch manuel via Call Script festgelegt werden.
# Dafür wird der Befehl:
# setup_worldmap_coordinates(x,y) benötigt.
# x und y müssen dabei mit den gewünschten Koordinaten ersetzt werden.
# Zuletzt, das Aufruffen der Weltkarte erfolgt durch den Befehl:
# call_worldmap
# der via Call Script ausgeführt werden muss.
module Deity
module WorldMap
# Points
POINTS = {
"Ziel1" => [23,700,550,0],
"Ziel1.2" => [24,700,550,0],
"Ziel2" => [23,2190,1440,0],
"Ziel3" => [23,1070,1415,0],
"Ziel3.2" => [24,1070,1415,0],
"Ziel4" => [23,900,480,0],
"Ziel4.2" => [24,900,480,0],
"Ziel5" => [23,1900,540,0],
"Ziel5.2" => [24,1900,540,0],
"Block1" => [27,830,588,0],
"Block2" => [27,2030,583,0],
"Block2.2" => [25,2030,583,0],
"Block3" => [28,2131,1310,0],
"Weg1" => [25,1900,580,0],
} # <= Do not delete!
# Einstellungen
TARGET_COLOR = Color.new(50,50,50,0) # Schriftfarbe
WORLDMAP_NAME = "WORLDMAP_NAME" # Name der Weltkartengrafik
HELP_TEXT = "Pfeiltasten = Scrollen L/R Zoomen" # Hilfetext
ZOOM_MAX = 2.0 # Maximaler Zoom(in) (2.0 = 200%|1.2 = 120%)
ZOOM_MIN = 0.5 # Minimaler Zoom(out) (0.5 = 50%)
ZOOM_SPEED = 0.1 # Zoom nach dem Betätigen der Taste (+/-)
ZOOM_DURATION = 20 # Frameanzahl zum Zoomen
SCROLL_SPEED = 10 # Scrollgeschwindigkeit durch drücken der Pfeiltasten
LAST_SCENE = "Scene_Item"
LAST_SCENE_PARAMETER = 1
end
end
include Deity::WorldMap
#==============================================================================
# ** Game_System
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :worldmap_data
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
alias initialize_worldmap initialize unless $@
def initialize
initialize_worldmap
@worldmap_data = [[0,0],[]]
end
end
#==============================================================================
# ** Game_Map
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# * Return name of current map
#--------------------------------------------------------------------------
def name
return load_data("Data/MapInfos.rvdata")[@map_id].name
end
#--------------------------------------------------------------------------
# * Setup
#--------------------------------------------------------------------------
alias setup_worldmap setup unless $@
def setup(*args)
setup_worldmap(*args)
name.sub!(/\\X\[([0-9]+)\]/i) { "" }
$game_system.worldmap_data[0][0] = $1.to_i
name.sub!(/\\Y\[([0-9]+)\]/i) { "" }
$game_system.worldmap_data[0][1] = $1.to_i
end
end
#==============================================================================
# ** Game_Interpreter
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# * Add points
#--------------------------------------------------------------------------
def add_worldmap_point(point=nil)
return if point.nil?
$game_system.worldmap_data[1].push(point) if !$game_system.worldmap_data[1].include?(point)
end
#--------------------------------------------------------------------------
# * Remove added points
#--------------------------------------------------------------------------
def remove_worldmap_point(point=nil)
return if point.nil?
$game_system.worldmap_data[1].delete(point) if $game_system.worldmap_data[1].include?(point)
end
#--------------------------------------------------------------------------
# * Open the WorldMap Scene
#--------------------------------------------------------------------------
def open_worldmap
$scene = Scene_WorldMap.new()
end
#--------------------------------------------------------------------------
# * Setup Coordinates
#--------------------------------------------------------------------------
def setup_worldmap_coordinates(x=nil,y=nil)
$game_system.worldmap_data[0][0] = x.nil? ? $game_system.worldmap_data[0][0] : x
$game_system.worldmap_data[0][1] = y.nil? ? $game_system.worldmap_data[0][1] : y
end
end
#==============================================================================
# ** Scene_WorldMap
#==============================================================================
class Scene_WorldMap < Scene_Base
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
# Helptextwindow
@viewport = Viewport.new(0,0,544,416)
@help = Window_Help.new
@help.set_text(HELP_TEXT,1)
# Worldmap
@worldmap_sprite = Sprite.new(@viewport)
@worldmap_sprite.bitmap = Bitmap.new("Graphics/Pictures/#{WORLDMAP_NAME}")
@duration = 0
# Character
@character_sprite = Sprite_AnimatedCharacter.new(@viewport,$game_party.members[0])
@character_sprite.x = @worldmap_sprite.x + $game_system.worldmap_data[0][0]-(@character_sprite.width/2)
@character_sprite.y = @worldmap_sprite.y + $game_system.worldmap_data[0][1]-(@character_sprite.height/2)
# Icons & Text
@icon_sprites = []
@worldmap_sprite.bitmap.font.bold = true
@worldmap_sprite.bitmap.font.size = 17
@worldmap_sprite.bitmap.font.color = TARGET_COLOR
for d in $game_system.worldmap_data[1]
point = POINTS[d]
@icon_sprites.push(Sprite_AnimatedIcon.new(@viewport,point[0],point[1],point[2],point[3]))
width = @worldmap_sprite.bitmap.text_size(d).width
@worldmap_sprite.bitmap.font.bold = true
@worldmap_sprite.bitmap.font.size = 17
@worldmap_sprite.bitmap.draw_text(point[1]-width/2,point[2]-36,width,17,d,1)
end
end
#--------------------------------------------------------------------------
# * Return to last Scene
#--------------------------------------------------------------------------
def return_scene
Sound.play_cancel
$scene = eval("#{LAST_SCENE}.new(#{LAST_SCENE_PARAMETER})")
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Character Update
@character_sprite.update
@character_sprite.x = ($game_system.worldmap_data[0][0] - (@character_sprite.width/2))*@worldmap_sprite.zoom_x + @worldmap_sprite.x
@character_sprite.y = ($game_system.worldmap_data[0][1] - (@character_sprite.height/2))*@worldmap_sprite.zoom_y + @worldmap_sprite.y
# Icon Update
for i in 0...@icon_sprites.size
@icon_sprites.x = (@icon_sprites.koords[0])*@worldmap_sprite.zoom_x + @worldmap_sprite.x
@icon_sprites.y = (@icon_sprites.koords[1])*@worldmap_sprite.zoom_y + @worldmap_sprite.y
@icon_sprites.update
end
# Zurück
if Input.trigger?(Input::B)
return_scene
end
# Correct
if @worldmap_sprite.x > 0
@worldmap_sprite.x = 0
end
if @worldmap_sprite.y > 0
@worldmap_sprite.y = 0
end
if @worldmap_sprite.width*@worldmap_sprite.zoom_x < 544
@worldmap_sprite.x = (544-@worldmap_sprite.width*@worldmap_sprite.zoom_x)/2
elsif @worldmap_sprite.x + @worldmap_sprite.width*@worldmap_sprite.zoom_x < 544
@worldmap_sprite.x = 544 - @worldmap_sprite.width*@worldmap_sprite.zoom_x
end
if @worldmap_sprite.height*@worldmap_sprite.zoom_x < 416
@worldmap_sprite.y = (416-@worldmap_sprite.height*@worldmap_sprite.zoom_x)/2
elsif @worldmap_sprite.y + @worldmap_sprite.height*@worldmap_sprite.zoom_x < 416
@worldmap_sprite.y = 416 - @worldmap_sprite.height*@worldmap_sprite.zoom_x
end
# Scrollen
if Input.trigger?(Input::LEFT) || Input.press?(Input::LEFT)
@worldmap_sprite.x = @worldmap_sprite.x + SCROLL_SPEED > 0 ? 0 : @worldmap_sprite.x + SCROLL_SPEED
end
if Input.trigger?(Input::RIGHT) || Input.press?(Input::RIGHT)
w = @worldmap_sprite.x + (@worldmap_sprite.width*@worldmap_sprite.zoom_x) - SCROLL_SPEED
@worldmap_sprite.x = w < 544 ? 544 - (@worldmap_sprite.width*@worldmap_sprite.zoom_x) : @worldmap_sprite.x - SCROLL_SPEED
end
if Input.trigger?(Input::DOWN) || Input.press?(Input::DOWN)
@worldmap_sprite.y = @worldmap_sprite.y - SCROLL_SPEED + (@worldmap_sprite.height*@worldmap_sprite.zoom_x) < 416 ? 416 - (@worldmap_sprite.height*@worldmap_sprite.zoom_x) : @worldmap_sprite.y - SCROLL_SPEED
end
if Input.trigger?(Input::UP) || Input.press?(Input::UP)
@worldmap_sprite.y = @worldmap_sprite.y + SCROLL_SPEED > 0 ? 0 : @worldmap_sprite.y + SCROLL_SPEED
end
# Zoomen
if Input.trigger?(Input::L)
if @worldmap_sprite.zoom_x < ZOOM_MAX
@worldmap_sprite.zoom_x = @worldmap_sprite.zoom_x + ZOOM_SPEED
@worldmap_sprite.zoom_y = @worldmap_sprite.zoom_y + ZOOM_SPEED
@character_sprite.zoom_x = @worldmap_sprite.zoom_x + ZOOM_SPEED
@character_sprite.zoom_y = @worldmap_sprite.zoom_y + ZOOM_SPEED
for i in 0...@icon_sprites.size
@icon_sprites.zoom_x = @icon_sprites.zoom_x + ZOOM_SPEED
@icon_sprites.zoom_y = @icon_sprites.zoom_y + ZOOM_SPEED
end
end
elsif Input.trigger?(Input::R)
if @worldmap_sprite.zoom_x > ZOOM_MIN
@worldmap_sprite.zoom_x = @worldmap_sprite.zoom_x - ZOOM_SPEED
@worldmap_sprite.zoom_y = @worldmap_sprite.zoom_y - ZOOM_SPEED
@character_sprite.zoom_x = @worldmap_sprite.zoom_x - ZOOM_SPEED
@character_sprite.zoom_y = @worldmap_sprite.zoom_y - ZOOM_SPEED
for i in 0...@icon_sprites.size
@icon_sprites.zoom_x = @icon_sprites.zoom_x - ZOOM_SPEED
@icon_sprites.zoom_y = @icon_sprites.zoom_y - ZOOM_SPEED
end
end
end
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
@worldmap_sprite.dispose
@help.dispose
@character_sprite.dispose
for i in 0...@icon_sprites.size
@icon_sprites.dispose
end
end
end
#==============================================================================
# ** Sprite_AnimatedCharacter
#==============================================================================
class Sprite_AnimatedCharacter < Sprite
def initialize(viewport,character)
super(viewport)
@character = character
@frames = 15
@pattern = 0
self.x = 100
self.y = 100
update
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
if @frames <= 0
@frames = 15
@pattern = @pattern < 3 ? @pattern + 1 : 0
else
@frames -= 1
end
@character_index = @character.character_index
self.bitmap = Cache.character(@character.character_name)# if self.bitmap.nil?
sign = @character.character_name[/^[\!\$]./]
if sign != nil and sign.include?('$')
@cw = bitmap.width / 3
@ch = bitmap.height / 4
else
@cw = bitmap.width / 12
@ch = bitmap.height / 8
end
self.ox = @cw / 2
self.oy = @ch
index = @character.character_index
pattern = [1,2,1,0][@pattern]
sx = (index % 4 * 3 + pattern) * @cw
sy = (index / 4 * 4 / 2) * @ch
self.src_rect.set(sx, sy, @cw, @ch)
end
end
#==============================================================================
# ** Sprite_AnimatedIcon
#==============================================================================
class Sprite_AnimatedIcon < Sprite
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :koords
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(viewport,icon_id,x,y,animation = 0)
super(viewport)
@icon_id = icon_id
@animation_kind = animation
@frames = 0
@down = false
@koords = [x,y]
update
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
self.bitmap = Cache.system("IconSet")# if self.bitmap.nil?
self.src_rect.set(@icon_id % 16 * 24, @icon_id / 16 * 24, 24, 24)
self.ox,self.oy = self.width/2,self.height/2
case @animation_kind
when 0 # No animation
return
when 1 # Jump
if @down
@frames -= 1
@down = @frames == 0 ? false : true
elsif !@down
@frames += 1
@down = @frames == 24 ? true : false
end
self.y += @frames
when 2 # Spin
self.angle += 1
end
end
end
=begin
Ich hab mich mal an deinem Auftrag versucht, falls du weitere Funktionen wünschst oder dir
das Script nicht gefällt, kontaktiere mich einfach.
MfG PDM
=end
module DeinMenü
#Hier kannst du deine Einstellungen vornehmen:
#Zuerst die "Vokabeln":
VocPlay = "Weiterspielen"
VocLoad = "Laden"
VocStatus = "Status"
VocKarte = "Karte"
VocShutDown = "Spiel beenden"
#Die Switchzahl, die verwendet wird:
StatusAusSwitch = 20
KarteAusSwitch = 21
#Die Namen der Faces:
FaceSet = "Actor1"
Face100to80 =0 # <-Index
Face79to60 = 1
Face59to40 = 2
Face39to20 = 3
Face19to0 = 4
#Variable für die HP:
VarHP = 20
end
##############################################################################
class Scene_Menu < Scene_Base
def initialize(menu_index = 0)
@menu_index = menu_index
end
def start
super
create_menu_background
create_command_window
end
def terminate
super
dispose_menu_background
@command_window.dispose
end
def update
super
update_menu_background
@command_window.update
update_command_selection
end
def create_command_window
s1 = "#{DeinMenü::VocPlay}"
s2 = "#{DeinMenü::VocLoad}"
s3 = "#{DeinMenü::VocStatus}"
s4 = "#{DeinMenü::VocKarte}"
s5 = "#{DeinMenü::VocShutDown}"
@command_window = Window_Command.new(200, [s1, s2, s3, s4, s5])
@command_window.x = (544 - @command_window.width) / 2
@command_window.y = (416 - @command_window.height) / 2
@command_window.index = @menu_index
if $game_switches[DeinMenü::StatusAusSwitch]
@command_window.draw_item(2, false)
end
if $game_switches[DeinMenü::KarteAusSwitch]
@command_window.draw_item(3, false)
end
end
def update_command_selection
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
if $game_switches[DeinMenü::StatusAusSwitch] and @command_window.index == 2
Sound.play_buzzer
return
elsif $game_switches[DeinMenü::KarteAusSwitch] and @command_window.index == 3
Sound.play_buzzer
return
end
Sound.play_decision
case @command_window.index
when 0
$scene = Scene_Map.new
when 1
$scene = Scene_File.new(false, false, true)
when 2
$scene = Scene_DeinStatus.new
when 3
$scene = Scene_WorldMap.new
when 4
$scene = Scene_End.new
end
end
end
end
#############################################################################
class Scene_DeinStatus < Scene_Base
def initialize(actor_index = 0)
@actor_index = actor_index
end
def start
super
create_menu_background
@actor = $game_party.members[@actor_index]
@status_window = Window_DeinStatus.new(@actor)
@viewport = Viewport.new(0, 0, 544, 416)
@help_window = Window_HelpItem.new(0, 416 - (24 * 3 + 32), 544, 24 * 3 + 32)
@help_window.viewport = @viewport
@item_window = Window_Item.new(168, 56, 330, 360 - (24 * 3 + 32))
@item_window.viewport = @viewport
@item_window.help_window = @help_window
@item_window.active = false
@target_window = Window_MenuStatus.new(0, 0)
hide_target_window
end
def terminate
super
dispose_menu_background
@status_window.dispose
@viewport.dispose
@help_window.dispose
@item_window.dispose
@target_window.dispose
end
def return_scene
$scene = Scene_Menu.new
end
def update
update_menu_background
@status_window.update
@help_window.update
@item_window.update
@target_window.update
if @item_window.active
update_item_selection
elsif @target_window.active
update_target_selection
end
super
end
def update_item_selection
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::C)
@item = @item_window.item
if @item != nil
$game_party.last_item_id = @item.id
end
if $game_party.item_can_use?(@item)
Sound.play_decision
determine_item
else
Sound.play_buzzer
end
end
end
def determine_item
if @item.for_friend?
show_target_window(@item_window.index % 2 == 0)
if @item.for_all?
@target_window.index = 99
else
if $game_party.last_target_index < @target_window.item_max
@target_window.index = $game_party.last_target_index
else
@target_window.index = 0
end
end
else
use_item_nontarget
end
end
def update_target_selection
if Input.trigger?(Input::B)
Sound.play_cancel
if $game_party.item_number(@item) == 0
@item_window.refresh
end
hide_target_window
elsif Input.trigger?(Input::C)
if not $game_party.item_can_use?(@item)
Sound.play_buzzer
else
determine_target
end
end
end
def determine_target
used = false
if @item.for_all?
for target in $game_party.members
target.item_effect(target, @item)
used = true unless target.skipped
end
else
$game_party.last_target_index = @target_window.index
target = $game_party.members[@target_window.index]
target.item_effect(target, @item)
used = true unless target.skipped
end
if used
use_item_nontarget
else
Sound.play_buzzer
end
end
def show_target_window(right)
@item_window.active = false
width_remain = 544 - @target_window.width
@target_window.x = right ? width_remain : 0
@target_window.visible = true
@target_window.active = true
if right
@viewport.rect.set(0, 0, width_remain, 416)
@viewport.ox = 0
else
@viewport.rect.set(@target_window.width, 0, width_remain, 416)
@viewport.ox = @target_window.width
end
end
def hide_target_window
@item_window.active = true
@target_window.visible = false
@target_window.active = false
@viewport.rect.set(0, 0, 544, 416)
@viewport.ox = 0
end
def use_item_nontarget
Sound.play_use_item
$game_party.consume_item(@item)
@item_window.draw_item(@item_window.index)
@target_window.refresh
if $game_party.all_dead?
$scene = Scene_Gameover.new
elsif @item.common_event_id > 0
$game_temp.common_event_id = @item.common_event_id
$scene = Scene_Map.new
end
end
end
###############################################################################
class Window_DeinStatus < Window_Base
def initialize(actor)
super(50 -16, 96 -16, 96 + 32, 96 + 32)
@actor = actor
refresh
end
def refresh
self.contents.clear
draw_actor_faceHP(@actor, 0, 0)
end
end
################################################################################
class Window_Base
def draw_actor_faceHP(actor, x, y, size = 96)
if $game_variables[DeinMenü::VarHP] <= 19
draw_faceHP(DeinMenü::FaceSet, DeinMenü::Face19to0, x, y, size)
elsif $game_variables[DeinMenü::VarHP] <= 39
draw_faceHP(DeinMenü::FaceSet, DeinMenü::Face39to20, x, y, size)
elsif $game_variables[DeinMenü::VarHP] <= 59
draw_faceHP(DeinMenü::FaceSet, DeinMenü::Face59to40, x, y, size)
elsif $game_variables[DeinMenü::VarHP] <= 79
draw_faceHP(DeinMenü::FaceSet, DeinMenü::Face79to60, x, y, size)
elsif $game_variables[DeinMenü::VarHP] <= 100
draw_faceHP(DeinMenü::FaceSet, DeinMenü::Face100to80, x, y, size)
end
end
def draw_faceHP(face_name, face_index, x, y, size = 96)
bitmap = Cache.face(face_name)
rect = Rect.new(0, 0, 0, 0)
rect.x = face_index % 4 * 96 + (96 - size) / 2
rect.y = face_index / 4 * 96 + (96 - size) / 2
rect.width = size
rect.height = size
self.contents.blt(x, y, bitmap, rect)
bitmap.dispose
end
def draw_item_name(item, x, y, enabled = true)
if item != nil
draw_icon(item.icon_index, x, y, enabled)
self.contents.font.color = normal_color
self.contents.draw_text(x + 24, y, 172, WLH, item.name)
end
end
end
################################################################################
class Window_HelpItem < Window_Base
def initialize(x, y, w, z)
super(x, y, w, z)
end
def set_text(text, align = 0)
if text != @text or align != @align
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, self.width - 40, WLH, text, align)
@text = text
@align = align
end
end
end