Fraktionen ala WoW per Events zu kompliziert und aufwendig? Kein Problem... Mit dem Fame System von HamsterHai ist dies möglich... Einfach Script einfügen und den Events die Befehle geben.
#-------------------------------------------------------------------------------
#
# Ruf System
# code by HamsterHai aka. Sartekk
# Released 13.08.2010
# version 1.1
#
#-------------------------------------------------------------------------------
# * Veränderbarer Teil...
#
# MAX_RUF = Maximaler Ruf-Wert
# MIN_RUF = Minimaler Ruf-Wert
# FAME_VOCAB = Verwendeter Ruf-Name
# MAP_BUTTON = Taste zum aufrufen des Ruf-Status (Nichtim Menü aufrufbar!!)
# POPUP_SIZE = Schriftgröße des Popups bei Rufzuwachs/verlust
# POPUP_DURATION = Dauer der Anzeige
# FRAKTIONEN = Liste aller Fraktionen
# TITEL = Liste aller Statustitel der Fraktionen
#
#-------------------------------------------------------------------------------
# * Befehle...
#
# $fame.gain_fame(faction_id,wert)
# Erhöht den Ruf der Fraktion aus Fraktionen um wert
#
# $fame.lose_fame(faction_id,wert)
# Verringert den Ruf der Fraktion aus Fraktionen um wert
#
# $fame.discover(faction_id)
# Macht die Fraktion für die Liste sichtbar
#
# $fame.discovered?(faction_id)
# Gibt die Sichtbarkeit der Fraktion in der Liste wieder
#
# $fame.current_fame?(faction_id)
# Gibt den Ruf-Wert der Fraktion wieder
#
# $fame.current_title?(faction_id)
# Gibt den itel der Fraktion wieder
#
#-------------------------------------------------------------------------------
module Rufconfig
MAX_RUF = 35000
MIN_RUF = -35000
FAME_VOCAB = "Ruf"
MAP_BUTTON = Input::Z
POPUP_SIZE = 22
POPUP_DURATION = 60
FRAKTIONEN = [
# ["Name", Start-Ruf, Start-Titel, Start-Sichtbarkeit]
[nil,nil,nil,nil], #Don't remove!!
["Maghar",0,"Neutral",true],
["Frakti2",23000,"Respektvoll",false],
]
TITEL = [
# ["Titel-Name", Ab welchem Ruf]
["Hasserfüllt",-10000],
["Unfreundlich", -3000],
["Neutral",0],
["Freundlich",3000],
["Wohlwollend",10000],
["Respektvoll",16000],
["Ehrfürchtig",35000],
]
end
#-------------------------------------------------------------------------------
# * NICHT Veränderbarer Teil... Punkt!!
#
#-------------------------------------------------------------------------------
class Ruf_System
attr_accessor :faction
attr_accessor :title
attr_accessor :visible
def initialize
@faction = Rufconfig::FRAKTIONEN
@title = Rufconfig::TITEL
@visible = []
for i in 1..@faction.size-1
if @faction[i][3] == true
@visible.push(i)
end
end
end
def gain_fame(faction,val)
if @faction[faction][1] <= Rufconfig::MAX_RUF - val
@faction[faction][1] += val
else
@faction[faction][1] = Rufconfig::MAX_RUF
end
$fame_popup.show_fame_popup(true,@faction[faction],val)
update
end
def lose_fame(faction,val)
if @faction[faction][1] >= Rufconfig::MIN_RUF + val
@faction[faction][1] -= val
else
@faction[faction][1] = Rufconfig::MIN_RUF
end
$fame_popup.show_fame_popup(false,@faction[faction],val)
update
end
def discover(faction)
if !@faction[faction][3] == true
@faction[faction][3] = true
@visible.push(faction)
@visible.sort!
update
end
end
def current_fame?(faction)
return @faction[faction][1]
end
def current_title?(faction)
return @faction[faction][2]
end
def discovered?(faction)
return @faction[faction][3]
end
def update
for j in 1..@faction.size-1
for i in 0..@title.size-1
if @faction[j][1] >= @title[i][1]
@faction[j][2] = @title[i][0]
end
end
end
end
end
#-------------------------------------------------------------------------------
class Scene_Ruf < Scene_Base
def start
super
@ruf_win = Ruf_Window.new
@page = 0
end
def terminate
super
@ruf_win.dispose
end
def update
super
@ruf_win.update
update_input
end
def update_input
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::DOWN)
Sound.play_cursor
if $fame.visible.size > (@page+1)*8
@page += 1
@ruf_win.refresh(@page)
end
elsif Input.trigger?(Input::UP)
Sound.play_cursor
if @page > 0
@page -= 1
@ruf_win.refresh(@page)
end
end
end
end
#-------------------------------------------------------------------------------
class Ruf_Window < Window_Base
def initialize
super(0,0,544,416)
refresh
end
def refresh(page=0)
self.contents.clear
@item_max = $fame.visible.size
old_size = self.contents.font.size; self.contents.font.size = 40
self.contents.font.bold = true
self.contents.draw_text(200,0,200,40,Rufconfig::FAME_VOCAB)
self.contents.font.bold = false
self.contents.font.size = old_size
if page == 0
for i in 0..$fame.visible.size-1
self.contents.draw_text(5,20+40*((i+1)),200,40,$fame.faction[$fame.visible[i]][0])
draw_ruf($fame.faction[$fame.visible[i]],230,20+40*((i+1)))
end
elsif page > 0
for i in page*7+page..$fame.visible.size-1
self.contents.draw_text(5,20+40*((i+1)-(page*7+page)),200,40,$fame.faction[$fame.visible[i]][0])
draw_ruf($fame.faction[$fame.visible[i]],230,20+40*((i+1)-(page*7+page)))
end
end
end
def draw_ruf(faction, x, y, width = 270)
draw_ruf_gauge(faction, x, y, width)
last_font_size = self.contents.font.size
self.contents.draw_text(x-180, y, 244, WLH, faction[1], 2)
self.contents.font.color = normal_color
self.contents.draw_text(x-100, y, 211, WLH, "/", 2)
self.contents.draw_text(x, y, 244, WLH, faction[2], 2)
end
def draw_ruf_gauge(faction, x, y, width = 240)
if faction[1] >= 0
gw = width * faction[1] / Rufconfig::MAX_RUF
gc1 = Color.new(102,160,96)
gc2 = Color.new(56,140,47)
else
gw = width * -1*faction[1] / Rufconfig::MAX_RUF
gc1 = Color.new(206,70,83)
gc2 = Color.new(147,29,41)
end
self.contents.fill_rect(x, y + WLH - 8, width, 12, gauge_back_color)
self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 12, gc1, gc2)
end
end
#-------------------------------------------------------------------------------
class Scene_Title < Scene_Base
alias ruf_system create_game_objects
def create_game_objects
ruf_system
$fame = Ruf_System.new
$fame_popup = Fame_Popup.new
end
end
#-------------------------------------------------------------------------------
class Scene_Map < Scene_Base
alias ruf_system_update update
def update
$fame_popup.update_popup
ruf_system_update
if Input.trigger?(Rufconfig::MAP_BUTTON)
$scene = Scene_Ruf.new
end
end
end
#-------------------------------------------------------------------------------
class Fame_Popup
def initialize
@popup_duration = 0
end
def show_fame_popup(pre,faction,val)
if @popup_sprite != nil
dispose_popup
end
bitmap = Bitmap.new(360,160)
old_color = bitmap.font.color
if pre == true
preval = "+"
bitmap.font.color = Color.new(102,160,96)
else
preval = "-"
bitmap.font.color = Color.new(206,70,83)
end
@popup_duration = Rufconfig::POPUP_DURATION
bitmap.font.bold = true
old_size = bitmap.font.size; bitmap.font.size = Rufconfig::POPUP_SIZE
bitmap.draw_text(1,1,360,160,preval+val.to_s+" "+Rufconfig::FAME_VOCAB+" - "+faction[0],1)
bitmap.font.size = old_size; bitmap.font.color = old_color
bitmap.font.bold = false
@popup_sprite = Sprite.new(Viewport.new(0,0,544,416))
@popup_sprite.bitmap = bitmap
@popup_sprite.x = 50
@popup_sprite.y = (Graphics.height/2)-bitmap.font.size
@popup_sprite.z = 999999
end
def dispose_popup
return if @popup_sprite.bitmap == nil
@popup_sprite.bitmap.dispose
@popup_sprite.dispose
@popup_sprite = nil
end
def update_popup
if @popup_duration > 0
@popup_duration -=1
@popup_sprite.y -= 1
elsif @popup_duration <= 0 and @popup_sprite != nil and !@popup_sprite.disposed?
@popup_sprite.y -= 1
@popup_sprite.opacity -= 5
dispose_popup if @popup_sprite.opacity <= 0
end
end
end
#-------------------------------------------------------------------------------
class Scene_File < Scene_Base
alias save_fame_hh write_save_data
def write_save_data(file)
save_fame_hh(file)
Marshal.dump($fame,file)
end
alias read_fame_hh read_save_data
def read_save_data(file)
read_fame_hh(file)
$fame = Marshal.load(file)
end
end
viel Spaß damit
mfG HamsterHai
==================================================================
v1.1 Changelog
Durch den Befehl .discover(id) wurde die Fraktion unendlich oft hinzugefügt bei wiederholtem ausführen...
dieser Fehler wurde behoben
v1.2 Changelog
Das Fame System berücksichtigt ab jetzt auch gespeicherte Spielstände