PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : "Suche(/Habe ein Problem) mit Script X"-Thread



Stray
14.07.2011, 22:10
Hallö,

Ich wollte mal einen Thread aufmachen, bei dem Scripts angefordert werden können und dann je nach Möglichkeit gesucht bzw. von Anderen gepostet werden.
Da ich zurzeit das Gefühl habe demnächst öfter nach kleinen Scripts, wenn nicht sogar nur nach Zeilen zu fragen, dachte ich mir, bevor ich für jede kleine Frage einen neuen Thread aufmache, mache ich lieber einen für alle Fragen gleichzeitig auf.


Diese Zeilen sollten reichen:
Code:
class Game_Event < Game_Character def set_name(p_new_name) @event.name = p_new_name endendWenn du also die Instanz von Game_Event hast kannst du ihr diesen Befehl übermitteln:
Code:
some_event.set_name("Irgend ein Name")Solltest du Probleme damit haben die Instanz von Game_Event zu finden welche ein Event im Maker repräsentiert so musst du folgendes tun:
Code:
some_event = $game_map.events[SOME_ID]wobei SOME_ID die ID darstellt welche dein Event im Maker besitzt.

Cornix
14.07.2011, 22:52
Diese Zeilen sollten reichen:

class Game_Event < Game_Character
def set_name(p_new_name)
@event.name = p_new_name
end
end

Wenn du also die Instanz von Game_Event hast kannst du ihr diesen Befehl übermitteln:

some_event.set_name("Irgend ein Name")

Solltest du Probleme damit haben die Instanz von Game_Event zu finden welche ein Event im Maker repräsentiert so musst du folgendes tun:

some_event = $game_map.events[SOME_ID]
wobei SOME_ID die ID darstellt welche dein Event im Maker besitzt.

Stray
15.07.2011, 00:18
Ich hab's mehrere Male probiert. Ich glaub' ich hab nicht so ganz verstanden wie man vorgeht.

Cornix
15.07.2011, 18:36
Hier, kopiere diese Zeilen von Code an irgendeine Stelle oberhalb von "Main" innerhalb der Scriptliste deines Projektes :

class Game_Event < Game_Character
def get_name
return @event.name
end
def set_name(p_new_name)
@event.name = p_new_name
end
end
Der Befehl "get_name" wird dir den Namen eines Game_Events zurück geben und der Befehl "set_name(parameter)" wird den Namen verändern.

Wenn du den Namen eines Events erhalten willst musst du folgenden Custom_Script verwenden:

$game_map.events[SOME_ID].get_name
Wobei SOME_ID eine Zahl darstellt, nämlich die ID welche dein Event im Maker besitzt.
Wenn du also den Namen des ersten Events auf der Karte erhalten willst musst du dieses Custom_Script eingeben:

$game_map.events[1].get_name
Die ID welche ein Event besitzt wird vom Maker festgelegt und zwar in der Reihenfolge wie die Events auf der Karte erstellt werden.
Wenn du den Namen eines Events schnell und einfach im Spiel überprüfen willst, zum Beispiel um zu testen ob der Code von mir funktioniert, dann musst du diese Zeilen als Custom script in ein Event schreiben:

e = $game_map.events[@event_id]
print(e.get_name)
Dadurch wird dir über den Print-Befehl der Name des Events ausgegeben welches gerade läuft.

Wenn du den Namen ändern willst läuft dies beinahe genauso ab:
Du benutzt das Custom_Script:

$game_map.events[SOME_ID].set_name(SOME_NAME)
Um den Namen von dem Event mit der ID SOME_ID zu SOME_NAME zu ändern.
Als Beispiel:

$game_map.events[@event_id].set_name("Hanz")
Dadurch würde das Event welches gerade läuft seinen Namen zu Hanz ändern.

$game_map.events[15].set_name("Roboter Nr.5")
Hiermit würde das Event mit der ID nummer 15 seinen Namen zu Roboter Nr.5 ändern.

Ich habe dies mit dem RPG-Maker XP ausprobiert und es hat wundervoll funktioniert, mit dem RPG-Maker VX sollte es genauso funktionieren aber ich kann dies nicht mit 100% Sicherheit sagen.

Stray
16.07.2011, 01:05
Gut, das klappt. Vielen Dank. :D

Schon das nächste Problem:

Es dürfte für Leute die sich gut mit Scripts auskennen nicht allzu schwer sein denke ich. Ich kann mich aber auch täuschen...

Ich habe mir ein Journal-Script besorgt. Also ein Script, welches sozusagen einen kleinen, wirklich simplen Merkzettel für Aufgaben anzeigt.
Es wird dadurch also lediglich ein kleines, neues, Fenster mit Textbox geöffnet welches sich über ESC wieder zum Hauptmenü verlassen lässt.
Dieses wird im Hauptmenü unter "Journal" abgerufen.

Folgendes Problem:

9136
So wie es ausieht. Ohne das neue Hauptmenü.

9135
Mit neuem Hauptmenü.
Hier sieht man, dass das Journal nicht angezeigt wird, weil sich die Scripts für das Journal und das des neuen Menüs nicht vertragen.

So wäre ich euch also dankbar wenn ihr folgendes hinbekommt:
> Am besten wäre es, wenn der Journal-Tab im neuen Hauptmenü aufgerufen wird.
> oder, wenn das nicht möglich ist, einfach mit einer bestimmten Taste aufgerufen wird, wie z.B. "J" für Journal während des Spielens.

9137
Die Scripts die das Problem ausmachen... (Standartscripts sind unverändert. Die eingefügten Scripts unterm Strich arbeiten selbstständig)

9138
Nützlich ist womöglich noch ein Fenster, das während des Testgames Fehler notiert.

Ich hab' alle Scripts in ein kleines Testprojekt reingesteckt, damit ihr es überprüfen und abändern könnt.
http://www.file-upload.net/download-3589174/ProjectDateien.zip.html

Ich bin jedem der mir dabei hilft extrem dankbar. Credits sind natürlich selbstverständlich.

Cornix
17.07.2011, 16:43
Die Projektdatei welche ich von dem von dir angegebenen Link gedownloaded habe funktioniert nicht.
Das Projekt funktioniert zwar schon, allerdings nicht das Menü. Es scheint so, als ob das Spiel, bei jedem Mal wo das Menü geöffnet werden soll, auf den Titelbildschirm zurückkehrt. Somit kann ich es auch leider nicht testen.

Allerdings um dein Problem zu lösen, das Journal-Script von dir besitzt bereits eine eingebaute Funktion um das Journal direkt von der Karte aus zu öffnen, es ist derzeit auf die "L"-Taste des Makers gelegt, standardmäßig sollte dies das Q auf einer herkömmlichen deutschen Tastatur sein.
Hier ist der entsprechende Part direkt aus dem Script kopiert:

class Scene_Map
alias journal_update update

def update
journal_update
if Input.trigger?(Input::L)
$scene = Scene_Journal.new(1)
end
end
end

Aber das Journal sollte sich theoretisch (ich konnte es wie gesagt nicht testen) auch recht leicht in das andere Menü einbauen lassen da es so wie es scheint das Standardmenü zu immitieren versucht.
Falls das Menü-Script bei dir funktioniert dann versuche einmal folgenden Code.

#============================================================================
# Enhanced Defualt Menu System (EDMS) v 1.0.0
# by WcW
#
# Introduction:
# I made this script just so I could actually make a useful script and get
# back used to RGSS. It has all the features of the defualt menu system, but
# also features icons, HP, SP, and EXP bars, the map as a background, and
# a slightly altered layout.
#
# Features:
# - Has all of the options of the defualt menu system, plus load
# - Has icons in the command window
# - Uses gradient bars
# - Features map as the background
# - Has Playtime, Real Time, and Gold displayed
# - Low chance of incompatibility
#
# Instructions:
# Just paste this below the defualt scripts and above Blizz's script and Main
# in your script editor.
# Also, you will need to have a file called "x-icon.png" in your
# Graphics/Icons folder. If you do not have this, you will get an error. This
# is the icon used for the "Exit" option in the menu.
#
# Compatiblity:
# Is probably incompatible with other CMS's. Tested with RTAB and Tons of
# Add-On's. If you find any compatibility problems, please post them at
# http://forums.chaos-project.com/.
#============================================================================

#----------------------------------------------------------------------------
# * Window Command (WcW)
# Displays options w/ icons. Feel free to use this in your own script.
#----------------------------------------------------------------------------
class Window_Command_WcW < Window_Selectable
#--------------------------------------------------------------------------
# * Initialize
#--------------------------------------------------------------------------
def initialize(x, y, width, commands)
# Calls original initialize method
super(x, y, width, commands.size * 32 + 32)
# Sets maximum items and commands variables
@item_max = commands.size
@commands = commands
# Initializes the @disabled array, which is used for drawing disabled items
@disabled = []; @commands.size.times { @disabled.push false }
# Creates a new bitmap for the contents
self.contents = Bitmap.new(width-32, commands.size * 32)
# Sets the index to 0
self.index = 0
# Draws contents
refresh
end
#--------------------------------------------------------------------------
# * Refreshes Contents
#--------------------------------------------------------------------------
def refresh
# Clears bitmap
self.contents.clear
# For each command in the @commands array....
@commands.size.times {|i|
# Get the icon from RPG::Cache
self.contents.blt(4, 32 * i + 4, RPG::Cache.icon(@commands[i][0]),
Rect.new(0, 0, 24, 24))
# If the disabled array has this down for this disabled, draw it as
# disabled, if not, draw it normal
self.contents.font.color = @disabled[i] ? disabled_color : normal_color
# Draw the command
self.contents.draw_text(34, 32 * i, self.contents.width - 34, 32,
@commands[i][1], 0)
}
end
#--------------------------------------------------------------------------
# * Disable Items
#--------------------------------------------------------------------------
def disable_items(*indexes)
# For each index in the given argument array,
indexes.each {|index|
# Set that index to disabled in the @disabled array
@disabled[index] = true
}
# Re-draw contents
refresh
end
#--------------------------------------------------------------------------
# * Enable Items
#--------------------------------------------------------------------------
def enable_items(*indexes)
# For each index in the given argument array,
indexes.each {|index|
# Set that index to enabled in the @disabled array
@disable[index] = false
}
# Red-draw contents
refresh
end
end

#----------------------------------------------------------------------------
# * Status Window (Menu)
# Displays actor sprtie, name, level, HP (w/ graident), SP (w/ gradient),
# XP (w/ gradient), and state. This is specifically designed for this CMS
# and probably will not fit in anywhere else.
#----------------------------------------------------------------------------
class Window_MenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# * Initialize
#--------------------------------------------------------------------------
def initialize
super(160, 16, 464, $game_party.actors.size*80+32)
self.contents = Bitmap.new(432, $game_party.actors.size*80)
@item_max = $game_party.actors.size
self.index = -1
refresh
end
#--------------------------------------------------------------------------
# * Draw Gradient Bar
# Draws a white slant, then a slant on top of that made with a black-to-
# gray gradient, then tops it off with another gradient made of the two
# given colors that's width is multiplied times fill.
#--------------------------------------------------------------------------
def draw_gradient_bar(x, y, width, height, c1, c2, fill)
# Sets white, black, and gray colors
white = Color.new(255, 255, 255, 255)
black = Color.new(0, 0, 0, 255)
gray = Color.new(100, 100, 100, 255)
# For every row of pixels...
height.times {|i|
# Draw white slant
self.contents.fill_rect(x+(height-i-1), y+i, width-height, 1, white)
# Unless it is the last row
unless i == height - 1
# Draws black-gray gradient slant
red = black.red + ((gray.red - black.red) / height * i)
green = black.green + ((gray.green - black.green) / height * i)
blue = black.blue + ((gray.blue - black.blue) / height * i)
self.contents.fill_rect(x+(height-i), y+i, width-height-1, 1,
Color.new(red, green, blue, 255))
# Draws main slant
red = c1.red + ((c2.red - c1.red) / height * i)
green = c1.green + ((c2.green - c1.green) / height * i)
blue = c1.blue + ((c2.blue - c1.blue) / height * i)
self.contents.fill_rect(x+(height-i), y+i, (width-height-1).to_f*fill,
1, Color.new(red, green, blue, 255))

end
}
end
#--------------------------------------------------------------------------
# * Draw Actor Bar
# Draws the specified text, then draws a gradient bar based on the given
# stat with the specified colors. If "status" is true, then it will also
# change the font color if, say, HP or SP critical or knocked out, if not
# it will only use the normal font color, which is used for XP.
#--------------------------------------------------------------------------
def draw_actor_bar(x, y, text, stat1, stat2, c1, c2, status=true)
# Sets font color to the system color and makes it bold
self.contents.font.color = system_color
self.contents.font.bold = true
# Draws the specified text
self.contents.draw_text(x, y, 28, 32, text, 0)
# Changes font color to critical or knockout if "status" is true
self.contents.font.color = ! status ? normal_color :
stat1 == 0 && stat1 != stat2 ? knockout_color :
stat1 <= stat2 / 4 ? crisis_color : normal_color
# Un-bolds the text
self.contents.font.bold = false
# Sets array of the words to be drawn
words = [stat1.to_s, "/", stat2.to_s]
# Draws everything within the "words" array
3.times {|i| self.contents.draw_text(x+40, y, 106, 16, words[i], i) }
# Sets fill
fill = stat1 == 0 ? 0.0 : stat1.to_f / stat2.to_f
# Draws gradient bar
draw_gradient_bar(x+40, y+18, 106, 8, c1, c2, fill)
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# clears contents
self.contents.clear
# for each actor in the party
$game_party.actors.size.times {|i|
# Draws actor sprite
character = RPG::Cache.character($game_party.actors[i].character_name,
$game_party.actors[i].character_hue)
self.contents.blt(0, i*80+8, character, Rect.new(0, 0,
character.width / 4, character.height / 4))
# Draws actor name
self.contents.font.size = 20
self.contents.font.bold = true
self.contents.font.color = normal_color
self.contents.draw_text(36, i*80, 92, 32, $game_party.actors[i].name, 0)
# Draws actor level
self.contents.draw_text(36, i*80+32, 92, 32,
"Lvl #{$game_party.actors[i].level.to_s}", 0)
# Draws actor HP
draw_actor_bar(132, i*80, "LP", $game_party.actors[i].hp,
$game_party.actors[i].maxhp, Color.new(80, 0, 0, 255),
Color.new(255, 0, 0, 255))
# Draws actor SP
draw_actor_bar(286, i*80, "MP", $game_party.actors[i].sp,
$game_party.actors[i].maxsp, Color.new(0, 0, 80, 255),
Color.new(0, 0, 255, 255))
# Draws actor XP
draw_actor_bar(132, i*80+32, "EXP", $game_party.actors[i].exp,
$game_party.actors[i].next_exp_s.to_i, Color.new(0, 80, 0, 255),
Color.new(0, 255, 0, 255), false)
# Draws actor state
state = ''
last_rating = 0
$game_party.actors[i].states.each {|s|
if $data_states[s].rating > 0 && $data_states[s].rating >= last_rating
state = $data_states[s].name
last_rating = $data_states[s].rating
end
}
state = state == '' ? 'Normal' : state
self.contents.font.color = $game_party.actors[i].hp == 0 ?
knockout_color : normal_color
self.contents.draw_text(286, i*80+32, 146, 32, state, 0)
}
end
#--------------------------------------------------------------------------
# * Update Cursor Rect
#--------------------------------------------------------------------------
def update_cursor_rect
# If inactive...
if @index < 0
# Get rid of that nasty cursor rect
self.cursor_rect.empty
else
# Set the cursor rect to the index
self.cursor_rect.set(0, @index * 80, self.width - 32, 80)
end
end
end

#----------------------------------------------------------------------------
# * Gold Window (Menu)
# Resized and set to position.
#----------------------------------------------------------------------------
class Window_MenuGold < Window_Base
#--------------------------------------------------------------------------
# * Initialize
#--------------------------------------------------------------------------
def initialize
# Call original method
super(16, 392, 192, 64)
# Create a new bitmap 160 x 32
self.contents = Bitmap.new(160, 32)
# Draw Contents
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# clears bitmap
self.contents.clear
# Set font color to system color
self.contents.font.color = system_color
# Get the width it would take to draw the gold word set in the database
width = self.contents.text_size($data_system.words.gold).width
# Draw the above-mentioned gold word
self.contents.draw_text(160-width, 0, width, 32, $data_system.words.gold,
2)
# Set font color to normal
self.contents.font.color = normal_color
# Draw current amount of gold
self.contents.draw_text(0, 0, 160-width, 32, $game_party.gold.to_s, 2)
end
end

#----------------------------------------------------------------------------
# * Time Window (Menu)
# Draws the real world time. Of my own design, with a small amount of code
# borrowed from the defualt Window_PlayTime.
#----------------------------------------------------------------------------
class Window_MenuTime < Window_Base
#--------------------------------------------------------------------------
# * Initialize
#--------------------------------------------------------------------------
def initialize
# Call original Method
super(224, 392, 192, 64)
# Create new 160 x 32 bitmap
self.contents = Bitmap.new(160, 32)
# Draws contents
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# Clears bitmap
self.contents.clear
# Sets font color to system color
self.contents.font.color = system_color
# Draws the word "Time:"
self.contents.draw_text(0, 0, 160, 32, "Zeit:", 0)
# Sets the font color to the normal color
self.contents.font.color = normal_color
# Gets the current time
time = Time.now
# Draws current time
self.contents.draw_text(0, 0, 160, 32, sprintf("%02d:%02d:%02d", time.hour,
time.min, time.sec), 2)
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
# call original
super()
# redraw contents
refresh
end
end

#----------------------------------------------------------------------------
# * Playtime Window
# A resized and positioned version of the original
#----------------------------------------------------------------------------
class Window_PlayTime < Window_Base
#--------------------------------------------------------------------------
# * Initialize
#--------------------------------------------------------------------------
def initialize
# Calls original method
super(432, 392, 192, 64)
# Creates new 160 x 32 bitmap
self.contents = Bitmap.new(160, 32)
# Get the current number of seconds
@total_sec = Graphics.frame_count / Graphics.frame_rate
# Draw contents
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# Clears bitmap
self.contents.clear
# *sigh* You should know this by now.
self.contents.font.color = system_color
# writes "Playtime:"
self.contents.draw_text(0, 0, 160, 32, 'Spielzeit:', 0)
# If you don't know this after reading it commented half a dozen times,
# you fail as a scripter.
self.contents.font.color = normal_color
# Gets the current number of seconds AGAIN
@total_sec = Graphics.frame_count / Graphics.frame_rate
# Turns it into numbers
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
# Draws the numbers
self.contents.draw_text(0, 0, 160, 32,
sprintf("%02d:%02d:%02d", hour, min, sec), 2)
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
# Calls original method
super()
# Redraws contents if the playtime has changed
refresh if Graphics.frame_count / Graphics.frame_rate != @total_sec
end
end

#----------------------------------------------------------------------------
# * Load Scene (Menu)
# Modified so that it goes back to the menu, instead of the title screen.
#----------------------------------------------------------------------------
class Scene_LoadMenu < Scene_Load
#--------------------------------------------------------------------------
# * On Cancel
# Called when you exit the scene.
#--------------------------------------------------------------------------
def on_cancel
# Plays buzzer SE
$game_system.se_play($data_system.buzzer_se)
# Goes back to the menu, with the cursor set to Load
$scene = Scene_Menu.new(5)
end
end

#----------------------------------------------------------------------------
# * Menu Scene
# The scene that launches the menu.
#----------------------------------------------------------------------------
class Scene_Menu
#--------------------------------------------------------------------------
# * Initialize
#--------------------------------------------------------------------------
def initialize(index = 0)
# Sets the @index variable to the given index
@index = index
end
#--------------------------------------------------------------------------
# * Main
#--------------------------------------------------------------------------
def main
# Create map background
@map = Spriteset_Map.new
# Create command window
@command = Window_Command_WcW.new(16, 16, 128, [["032-Item01",
$data_system.words.item], ["044-Skill01", $data_system.words.skill],
["001-Weapon01", $data_system.words.equip], ["050-Skill07", "Status"],
["044-Skill01", "Journal"],["047-Skill04", "Sichern"], ["048-Skill05", "Laden"], ["x-icon","Beenden"]
])
# Set command window opacity
@command.back_opacity = 200
# Set command index
@command.index = @index
# Disable options if party size is zero
if $game_party.actors.size <= 0
@command.disable_items(0, 1, 2, 3)
end
# Disable save if forbidden
if $game_system.save_disabled
@command.disable_items(4)
end
# Create status window
@status = Window_MenuStatus.new
# Set status window opacity
@status.back_opacity = 200
# Creates gold window
@gold = Window_MenuGold.new
# Set gold window opacity
@gold.back_opacity = 200
# Creates menu time window
@time = Window_MenuTime.new
# Set time window opacity
@time.back_opacity = 200
# *sigh* creates playtime window and set opacity...
@playtime = Window_PlayTime.new
@playtime.back_opacity = 200
# Transitions screen
Graphics.transition
# Main loop
loop do
# Frame update
Graphics.update
Input.update
# Updates map & windows
@map.update
@command.update
@status.update
@gold.update
@time.update
@playtime.update
# Update command or status
update
# Ends loop if scene no longer is self
if $scene != self
break
end
end
# Freezes graphics
Graphics.freeze
# Disposes map and windows
@map.dispose
@command.dispose
@status.dispose
@gold.dispose
@time.dispose
@playtime.dispose
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
# Updates @command or @status processing depending on which is active
if @command.active
update_command
return
end
if @status.active
update_status
return
end
end
#--------------------------------------------------------------------------
# * Update Command
#--------------------------------------------------------------------------
def update_command
# If you pressed B, it plays the cancel SE and exits the menu, then goes
# back to the map.
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
end
# Check to see if you pressed C or not
if Input.trigger?(Input::C)
# Does stuff based on the index of @command when you pressed C
case @command.index
when 0
# Plays decision SE if there are Actors in the party, then opens item
# menu.
if $game_party.actors.size >= 1
$game_system.se_play($data_system.decision_se)
$scene = Scene_Item.new
# Plays buzzer if the party has no actors
else
$game_system.se_play($data_system.buzzer_se)
end
when 1
# Same as above, but goes into picking actor
if $game_party.actors.size >= 1
$game_system.se_play($data_system.decision_se)
@command.active = false
@status.active = true
@status.index = 0
else
$game_system.se_play($data_system.buzzer_se)
end
when 2
# Same as above, but goes into picking actor
if $game_party.actors.size >= 1
$game_system.se_play($data_system.decision_se)
@command.active = false
@status.active = true
@status.index = 0
else
$game_system.se_play($data_system.buzzer_se)
end
when 3
# Same as above, but goes into picking actor
if $game_party.actors.size >= 1
$game_system.se_play($data_system.decision_se)
@command.active = false
@status.active = true
@status.index = 0
else
$game_system.se_play($data_system.buzzer_se)
end
when 4 # journal
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to journal scene
$scene = Scene_Journal.new
when 5
# Plays buzzer SE if save is disabled, opens save if it isn't
if $game_system.save_disabled
$game_system.se_play($data_system.buzzer_se)
else
$game_system.se_play($data_system.decision_se)
$scene = Scene_Save.new
end
when 6
# Goes to the slightly modded load menu and plays decision SE
$game_system.se_play($data_system.decision_se)
$scene = Scene_LoadMenu.new
when 7
# ENDS THE GAME
$game_system.se_play($data_system.decision_se)
$scene = Scene_End.new
end
end
end
#--------------------------------------------------------------------------
# * Update Status
#--------------------------------------------------------------------------
def update_status
# Goes back to command window if B is pressed.
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command.active = true
@status.active = false
@status.index = -1
end
# Does stuff based on index
if Input.trigger?(Input::C)
case @command.index
when 1
# Opens skill menu
if $game_party.actors[@status.index].restriction >= 2
$game_system.se_play($data_system.buzzer_se)
else
$game_system.se_play($data_system.decision_se)
$scene = Scene_Skill.new(@status.index)
end
when 2
# opens equip menu
$game_system.se_play($data_system.decision_se)
$scene = Scene_Equip.new(@status.index)
when 3
# opens status menu
$game_system.se_play($data_system.decision_se)
$scene = Scene_Status.new(@status.index)
end
end
end
end
Ich habe zwei Veränderungen vorgenommen, an diesen beiden Stellen:

if Input.trigger?(Input::C)
# Does stuff based on the index of @command when you pressed C
case @command.index
when 0
# Plays decision SE if there are Actors in the party, then opens item
# menu.
if $game_party.actors.size >= 1
$game_system.se_play($data_system.decision_se)
$scene = Scene_Item.new
# Plays buzzer if the party has no actors
else
$game_system.se_play($data_system.buzzer_se)
end
when 1
# Same as above, but goes into picking actor
if $game_party.actors.size >= 1
$game_system.se_play($data_system.decision_se)
@command.active = false
@status.active = true
@status.index = 0
else
$game_system.se_play($data_system.buzzer_se)
end
when 2
# Same as above, but goes into picking actor
if $game_party.actors.size >= 1
$game_system.se_play($data_system.decision_se)
@command.active = false
@status.active = true
@status.index = 0
else
$game_system.se_play($data_system.buzzer_se)
end
when 3
# Same as above, but goes into picking actor
if $game_party.actors.size >= 1
$game_system.se_play($data_system.decision_se)
@command.active = false
@status.active = true
@status.index = 0
else
$game_system.se_play($data_system.buzzer_se)
end
when 4 # journal
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to journal scene
$scene = Scene_Journal.new
when 5
# Plays buzzer SE if save is disabled, opens save if it isn't
if $game_system.save_disabled
$game_system.se_play($data_system.buzzer_se)
else
$game_system.se_play($data_system.decision_se)
$scene = Scene_Save.new
end
when 6
# Goes to the slightly modded load menu and plays decision SE
$game_system.se_play($data_system.decision_se)
$scene = Scene_LoadMenu.new
when 7
# ENDS THE GAME
$game_system.se_play($data_system.decision_se)
$scene = Scene_End.new
end
end
Dieses Stück Code aus der Update-Methode entscheided wie bei der Eingabe von "C", der "Bestätigen"-Taste im Maker, vorgegangen werden soll.
Ich habe diese Stelle:

when 4 # journal
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to journal scene
$scene = Scene_Journal.new
(kopiert aus dem Journal-Script)
An die entsprechende Stelle eingefügt.
(Zeilen 542 - 546)

Dieses Stück Code aus der Main-Methode regelt die Menü-Optionen des Command-Windows, also dem Fenster welches die Auswahl und Eingabe des Spielers ermöglicht.

@command = Window_Command_WcW.new(16, 16, 128, [["032-Item01",
$data_system.words.item], ["044-Skill01", $data_system.words.skill],
["001-Weapon01", $data_system.words.equip], ["050-Skill07", "Status"],
["044-Skill01", "Journal"],["047-Skill04", "Sichern"], ["048-Skill05", "Laden"], ["x-icon","Beenden"]
])
Ich habe diese Eingabe hinzugefügt:

["044-Skill01", "Journal"]
Der erste String, nämlich: "044-Skill01" stellt den Namen des Bitmaps dar welches als Icon vor die Option gestellt werden soll.
Der zweite String, "Journal" stellt den Namen der Option selbst dar.

Die Zeilen hierfür sind: 411 - 415.

Versuche einmal ob es soweit funktioniert, falls nicht, solltest du vielleicht einmal ein anderes Projekt hochladen an welchem ich die Einstellungen selber testen kann.

Stray
18.07.2011, 19:50
Vielen Dank.

Leider funzt es nicht so ganz. Das Enhanced Default Menu System funktioniert nur, wenn man alle Journal Scripts rausnimmt.
Dann steht nun auch das Journal in der Liste beim neuen Menü, aber ohne Journal lässt sich da natürlich nichts öffnen.
Mit Q lässt sich, sofern vorhanden das Journal aber schon öffnen (hätt ich wirklich früher merken sollen).

Hier noch mal ein Testgame mit allen Scripts. Hier sind die Journals mit drin. Also, wenn sie weg sind, funktioniert auch das Menü.
http://www.file-upload.net/download-3595823/TestgameFuerScript.rar.html
(http://www.file-upload.net/download-3595823/TestgameFuerScript.rar.html)Deine Verbesserungen sind mit dabei.

EDIT:
Wegen den Namen eines Events ändern... ich brauch es unbedingt so, dass der Name bleibt.
Wenn ich die Map verlasse, und wieder zurück komme, ist der Name wieder der selbe wie zuvor.

Und wer ein Script hat, welches Animationen unter einem bestimmten Terrain versteckt, dem wäre ich auch sehr dankbar.

Stray
22.07.2011, 20:04
bump

(es gibt doch bestimmt eine Sache davon die man so recht schnell lösen kann(?))

Cornix
23.07.2011, 12:33
Ich glaube nicht, dass es einfach so möglich ist den Namen eines Events permanent zu ändern da dieser nicht im Speicherstand sondern in der Karte gespeichert wird. Und wie wir wissen wird nicht für jeden Speicherstand die gesamte Menge aller Karten einmal kopiert.
Aber vielleicht erzählst du uns einmal wofür du diese Möglichkeit überhaupt brauchst und dann könnten wir dir wahrscheinlich einen besseren Weg zeigen welcher einfacher umzusetzen sein wird.

Stray
27.07.2011, 20:49
Um den Namen einer Figur im Spiel zu erfahren muss man erst dannach fragen.
Der Name steht jeweils über der Textbox und wird automatisch durch's Hermes Script über der Textbox angezeigt.
Deswegen müsste er permanent verändert werden, da der Name, der über der Textbox steht aus dem Event-Namen geholt wird.

Cornix
27.07.2011, 23:52
Soll das ein Witz sein?
Verändere einfach das andere Script um den Namen manuell in der Textbox ändern zu können.
Du könntest einfach einen Hash anlegen welcher die Kombination aus Event_ID und Map_ID in einem Array als Key mit einem Namen mappt. Darüber hast du dann jederzeit vollen Zugriff darauf welche Namen für welches Event angezeigt werden würden und es wäre sehr einfach in einen Speicherstand einbaubar.

Stray
29.07.2011, 21:24
Ich hab leider kaum Ahnung vom Scripten. Ich kann manches gerade mal lesen bzw. entziffern.

Cornix
29.07.2011, 21:53
Hier, dies wäre eine Art Template für so eine Namensdatabase.

class Game_Event < Game_Character
attr_reader :map_id
attr_reader :id
end

class Database_Names

def initialize
@data_hash = {}
end

def set_name_of_event(event, value)
key = [event.map_id, event.id]
@data_hash[key] = value
end

def set_name_of_id(map_id, event_id, value)
key = [map_id, event_id]
@data_hash[key] = value
end

def get_name_of_event(event)
key = [event.map_id, event.id]
name = @data_hash[key]
if name == nil
return ""
end
return name
end

def get_name_of_id(map_id, event_id)
key = [map_id, event_id]
name = @data_hash[key]
if name == nil
return ""
end
return name
end

end

class Scene_Title
def command_new_game
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Stop BGM
Audio.bgm_stop
# Reset frame count for measuring play time
Graphics.frame_count = 0
# Make each type of game object
$game_temp = Game_Temp.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
$database_names = Database_Names.new
# Set up initial party
$game_party.setup_starting_members
# Set up initial map position
$game_map.setup($data_system.start_map_id)
# Move player to initial position
$game_player.moveto($data_system.start_x, $data_system.start_y)
# Refresh player
$game_player.refresh
# Run automatic change for BGM and BGS set with map
$game_map.autoplay
# Update map (run parallel process event)
$game_map.update
# Switch to map screen
$scene = Scene_Map.new
end
end
class Scene_Save < Scene_File
def write_save_data(file)
# Make character data for drawing save file
characters = []
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
characters.push([actor.character_name, actor.character_hue])
end
# Write character data for drawing save file
Marshal.dump(characters, file)
# Wrire frame count for measuring play time
Marshal.dump(Graphics.frame_count, file)
# Increase save count by 1
$game_system.save_count += 1
# Save magic number
# (A random value will be written each time saving with editor)
$game_system.magic_number = $data_system.magic_number
# Write each type of game object
Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
Marshal.dump($database_names, file)
end
end

class Scene_Load < Scene_File
def read_save_data(file)
# Read character data for drawing save file
characters = Marshal.load(file)
# Read frame count for measuring play time
Graphics.frame_count = Marshal.load(file)
# Read each type of game object
$game_system = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_screen = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)
$database_names = Marshal.load(file)
# If magic number is different from when saving
# (if editing was added with editor)
if $game_system.magic_number != $data_system.magic_number
# Load map
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
# Refresh party members
$game_party.refresh
end
end

Lass dich von der Größe nicht zu sehr einschüchtern. Der größte Teil hiervon ist eine Kopie der Standardfunktionen zum erstellen eines neuen Speicherstandes und dem Laden und Speichern eines Spielstandes, modifiziert damit sie eine Namensdatabase enthalten.

Der Code für die Database selbst ist lediglich dieser Teil:

class Database_Names

def initialize
@data_hash = {}
end

def set_name_of_event(event, value)
key = [event.map_id, event.id]
@data_hash[key] = value
end

def set_name_of_id(map_id, event_id, value)
key = [map_id, event_id]
@data_hash[key] = value
end

def get_name_of_event(event)
key = [event.map_id, event.id]
name = @data_hash[key]
if name == nil
return ""
end
return name
end

def get_name_of_id(map_id, event_id)
key = [map_id, event_id]
name = @data_hash[key]
if name == nil
return ""
end
return name
end

end
Und es ist auch eigentlich nicht mehr als ein Wrapper um einen Hash.

Du hast damit folgende vier Funktionen:

set_name_of_event(event, value)
Damit kannst du einem Event direkt einen Namen zuweisen.


set_name_of_id(map_id, event_id, value)
Damit kannst du einen Namen einem Event auf einer derzeit nicht geladenen Karte zuweisen, zum Beispiel gibst du die map_id 1 und die Event_id 4 an um dem vierten Event auf der ersten Karte deines Projektes einen Namen zu geben.

Equivalent zu dem speichern von Namen kannst du mit den Funktionen:

get_name_of_event(event) und

get_name_of_id(map_id, event_id)
Den Namen eines Events wiedergeben lassen.

Ich weis natürlich nicht welche anderen Scripte du derzeit in deinem Projekt verwendest daher kann ich dir auch nicht ganz genau sagen was du zu tun hast um diese Database in dein Projekt einzubauen.

Stray
30.07.2011, 01:09
Auf allefälle sehr hilfreich. Danke, ich werd's versuchen.



Wer ein Script hat, welches Animationen unter einem bestimmten Terrain (oder der Priorität 5) versteckt, dem wäre ich auch sehr dankbar.

Hendy
01.08.2011, 12:18
Hallo ,
wie ist es möglich parallele Ereignisse zu erstellen?

Hatte irgendwas mit "Threads" gelesen gehabt.

Bei RPG::CommonEvent klasse weiß ich nicht wie das funktioniert.

Ich möchte halt nur parallel zwei oder mehrere Ereignisse laufen haben.

Stray
31.08.2011, 00:38
Du führst irgendwo auf der Map einen Doppelklick aus, dann klickst du im zweiten Kasten von unten Links auf:

"Action Button"
"Player Touch"
"Event Touch"
"Autorun"
"Parallel Process" <<< Genau dasHier geht's übrigens um Scripts.
--- --- --- --- --- ---


Das folgende Laufgeräusch-Script soll um einen Schritt-Sound abzuspielen
nicht mehr ablesen, wann der Held sich bewegt, sondern wann dieser von
einem zum nächsten Kästchen wechselt bzw. wann er die Position X Y wechselt.

Wer kann helfen, weil er so nett ist und Scripting drauf hat? :3
Ich brauch's, weil ein anderes Script bereits die Bewegungen des Helden eingenommen haben.



SOUND =[
RPG::AudioFile.new("SCHRITT.wav",100,100),#terrain 1
RPG::AudioFile.new("",12,110),#terrain 2
RPG::AudioFile.new("",12,110),#terrain 3
RPG::AudioFile.new("",100,100),#terrain 4
RPG::AudioFile.new("",100,100),#terrain 5
RPG::AudioFile.new("",100,100),#terrain 6
RPG::AudioFile.new("",100,100),#terrain 7
]
CHARACTER = 0
#1 = nur player
#2 = nur events
#0 = beide
class Game_Character
def lautlos
return @lautlos
end
def lautlos=(n)
@lautlos = n
end
def geraeusch
return if self.lautlos
return if terrain_tag == 0
return if CHARACTER == 2 and self.is_a?(Game_Player)
return if CHARACTER == 1 and self.is_a?(Game_Event)
$game_system.se_play(SOUND[terrain_tag-1])
end
def move_down(turn_enabled = true)
if turn_enabled
turn_down
end
if passable?(@x, @y, 2)
geraeusch
turn_down
@y += 1
increase_steps
else
check_event_trigger_touch(@x, @y+1)
end
end
def move_left(turn_enabled = true)
if turn_enabled
turn_left
end
if passable?(@x, @y, 4)
geraeusch
turn_left
@x -= 1
increase_steps
else
check_event_trigger_touch(@x-1, @y)
end
end
def move_right(turn_enabled = true)
if turn_enabled
turn_right
end
if passable?(@x, @y, 6)
geraeusch
turn_right
@x += 1
increase_steps
else
check_event_trigger_touch(@x+1, @y)
end
end
def move_up(turn_enabled = true)
if turn_enabled
turn_up
end
if passable?(@x, @y, 8)
geraeusch
turn_up
@y -= 1
increase_steps
else
check_event_trigger_touch(@x, @y-1)
end
end
end
class Game_Event
alias sound_refresh refresh
def refresh
@lautlos = false
sound_refresh
return if @list.nil?
for command in @list
if command.code == 108 or command.code == 408
@lautlos = true if command.parameters.to_s.upcase == "LAUTLOS"
end
end
end
end
class Game_Player
def lautlos
return false
end
end

Stray
05.09.2011, 01:27
bump

EDIT: Problem gelöst

Stray
30.11.2011, 18:42
Gibt es ein Script, mit dem man ein (noch nicht vorhandenes!) Event über den Helden und andere Events legen kann, sobald sie ein bestimmtes Terrain passieren, z.B. hohes Gras, um nicht diesen "Körper-bis-zu-1/3-Transparent"-Effekt verwenden zu müssen?