Fome No RPG Maker XP

30 de outubro de 2012
Fome No RPG Maker XP

Window_Eat é um script desenvolvido para o RPG Maker XP pelo markusmks e editado pela DCO Informática, que, basicamente faz o que você já deve estar imaginando, implementa um sistema que atribui um nível de fome ao herói, que pode levá-lo à morte.

A janela do game, com este script, fica com uma barra (ou um HUD, como alguns chamam), mostrando o nível de fome do herói. Você pode ver melhor na demo, como fica.

Infelizmente os comentários estão em alemão (eu acho) e eu entendo quase nada deste idioma, mas para instalar no seu projeto, basta pegar o código abaixo e adicionar acima do Main:

#============================================================================== 
# ■ Window_Eat 
#==================================================================== 
#Copyright By: ;© markusmks 
#Edited By: DCO Informática * http://forum.dcoinformatica.com 
# 
# $eat. is the main 
# All defs, with a ▼ are the functions 
# so for example you can do: $eat.stop_counter use fucntion 
# 
# here are the functions: 
# (don't forget: every time with a text add a number for example: 
# $eat.change_modus(1, 5) 
# 
# $eat.dont_show - hide bar totally 
# $eat.dont_show(what) - what: 1= complet. 2= bar is away, Bar Text will #stay. 3= Bar-Text is away 
# $eat.show - shows bar 
# $eat.start_counter - starts stopped counter 
# $eat.stop_counter - Stops Counter 
# $eat.change_modus(Modus, time) - change modus (1= Sec ,2= Min). 
# $eat.change_sec(Secs) - takes seconds away 
# $eat.change_min(Minuts) - takes minutes away 
# $eat.full_rec - health 
# $eat.die - totall hungry (die) 
# $eat.add(number) - how much eat add? 
# $eat.dec(number) - how much take away? 
# $eat.get_eatmin - shows how much eated ($eat.get_eatmin) 
# $eat.get_eatmax - show the high of the bar (Test: print #$eat.get_eatmax) 
# $eat.change_max(Max) - with max you change the high of the maximal size 
# $eat.get_seconds - how much is it there all the time? (Test: print #$eat.get_seconds) 
# 
#============================================================================== 
# under intiziale you can change the functions 
#============================================================================== 

class Window_Eat < Window_Base 
#-------------------------------------------------------------------------- 
# ● Initialize 
#-------------------------------------------------------------------------- 
def initialize 
# -------------------------------------- 
# ● change with true or false ● 
# -------------------------------------- 
# === 
# sekunden (=1) oder minuten (=2) für eine verringerung? 
@use_seconds = 2 
# Wieviele Sekunden bei einen Bar abzug? 1 = echte SekundenZeit 
# 60 = eine Minute 
@slowseconds = 1 
# Wieviele Minuten bei einen Bar abzug? 1 = echte MinutenZeit 
# 60 = eine Minute 
@slowminutes = 1 
# === 

# Bar anzeigen? 
@showbar = true 
$atualizar_a_barra = "OK" 

# Zahlen unter bar anzeigen? 
@barminitext = true 

# Anzeigenden Titel 
@text = "Nível de Fome" 
# Outline Farbe? 
@outline_color = true 
# Geringe Füllung Text 
@warning_text = "Perigo..." 
# Tot Text? 
@deathtext = true 
@death_text = "Morreu..." 
# Warntext anzeigen? 
@showwarning = true 
# Warning Farbe farbe - (red,green,blue,transparenz) 
@warningcolor = Color.new(130,0,50) 

# maximale Magengröße 
@timemax = 21 

# bar x position - 490 
xx = 490 

# bar y position - 0 
yy = 0 

# bar höhe 
@barheight = 6 

# barcolor 
@red = 255 
@green = 0 
@blue = 50 

# Hinter bar? 
@backbar = true 

# Hinter bar farbe 
@backbarColor = Color.new(200,8,8) 

#backback Color 
@backback = Color.new(40,40,40) 

# Switch bei Leeren Magen ON schalten? 
@switch = true 
@switchnumber = 1 

# Bei Leeren Magen Game_Over? 
@gameover = true 
# -------------------------------------- 
# ● ● 
# -------------------------------------- 
super(490,0,150,73) 
self.width = width 
self.height = height 
self.opacity = 0 
self.x = xx 
self.y = yy 
self.z = 0 
@timemin = @timemax 
@savetime = 0 
@width = width 
@height = height 
@slowsec = @slowseconds 
@slowmin = @slowminutes 
@stopcounter = false 
self.contents = Bitmap.new(@width - 32, @height -32) 
refresh 
end 
#-------------------------------------------------------------------------- 
# ▼ Lässt Bar/Bar-Text verschwinden 
#-------------------------------------------------------------------------- 
def dont_show(was = 0) 
if was == 0 
@showbar = false 
@barminitext = false 
elsif was == 1 
@showbar = false 
@barminitext = true 
elsif was >= 2 
@showbar = true 
@barminitext = false 
end 
return 
end 
#-------------------------------------------------------------------------- 
# ▼ Zeigt Bar komplett an 
#-------------------------------------------------------------------------- 
def show 
@showbar = true 
@barminitext = true 
return 
end 
#-------------------------------------------------------------------------- 
# ▼ Stopt Counter 
#-------------------------------------------------------------------------- 
def stop_counter 
if @stopcounter == false; @stopcounter = true;end 
end 
#-------------------------------------------------------------------------- 
# ▼ Startet Counter 
#-------------------------------------------------------------------------- 
def start_counter 
if @stopcounter == true; @stopcounter = false;end 
end 



#-------------------------------------------------------------------------- 
# ▼ .change_modus(Modus,Zeit) 
# Modus: 1= Sekunden, 2= Minuten 
# Zeit : Abzug der Bar bei wievielen Sekunden/Minuten? 
#-------------------------------------------------------------------------- 
def change_modus(modus = 1,time = 1) 
if modus == 1 
@use_seconds = 1 
elsif modus == 2 
@use_seconds = 2 
else 
print "Entre por favor em uma modalidade entre 1 ou 2." 
end 
if time != 0 && @use_seconds == 1 
if time < @slowsec; @slowseconds = @sec; end 
@slowsec = time 
elsif time != 0 && @use_seconds == 2 
if time < @slowmin; @slowminutes = @min; end 
@slowmin = time 
else 
print "Falta 60 segundos para o personagem morrer." 
end 
end 
#-------------------------------------------------------------------------- 
# ▼ .change_sec(sec) 
# Sec: Abzug der Bar bei wievielen Sekunden? 
#-------------------------------------------------------------------------- 
def change_sec(sec = 1) 
if sec < @slowsec; @slowseconds = @sec; end 
if sec != 0; @slowsec = sec; else print "Falta 60 segundos para o personagem morrer.";end 
end 
#-------------------------------------------------------------------------- 
# ▼ .change_min(min) 
# Min: Abzug der Bar bei wievielen Minuten? 
#-------------------------------------------------------------------------- 
def change_min(min = 1) 
if min < @slowmin; @slowminutes = @min; end 
if min != 0; @slowmin = min;else print "Falta 60 segundos para o personagem morrer.";end 
end 
#-------------------------------------------------------------------------- 
# ▼ .full_rec 
# Füllt Magen komplett an. 
#-------------------------------------------------------------------------- 
def full_rec 
@timemin = @timemax 
end 
#-------------------------------------------------------------------------- 
# ▼ .die 
# Leer ganzen Magen komplett 
#-------------------------------------------------------------------------- 
def die 
@timemin = 0 
end 
#-------------------------------------------------------------------------- 
# ▼ .add(Zahl) 
# Damit hüllst du deinen Magen... 
# Beispiel: $xxx.add(10) 
#-------------------------------------------------------------------------- 
def add(addeat = 0) 
if addeat != 0 
@timemin += addeat 
if @timemin >= @timemax; @timemin = @timemax; end 
end 
end 
#-------------------------------------------------------------------------- 
# ▼ .dec(Zahl) 
# Damit leerst du deinen Magen... 
# Beispiel: $xxx.dec(10) 
#-------------------------------------------------------------------------- 
def dec(deceat = 0) 
if deceat != 0 
@timemin -= deceat 
if @timemin < 0; @timemin = 0; end 
end 
end 

#-------------------------------------------------------------------------- 
# ▼ gibt die aktuellen Hunger werte ab 
# Beispiel: print $xxx.get_eatmin 
#-------------------------------------------------------------------------- 
def get_eatmin 
return @timemin 
end 
#-------------------------------------------------------------------------- 
# ▼ gibt die Max Magen werte ab 
# Beispiel: print $xxx.get_eatmax 
#-------------------------------------------------------------------------- 
def get_eatmax 
return @timemax 
end 
#-------------------------------------------------------------------------- 
# ▼ Ändert die Max größe deines Magens 
# Beispiel: $xxx.change_max(10) 
#-------------------------------------------------------------------------- 
def change_max(changemax = 0) 
if changemax < @timemax; @timemin = changemax;end 
if changemax <= 0 
else 
@timemax = @timemax + changemax 
# if @timemin < 0; @timemin = 0; end 
end 
return 
end 
#-------------------------------------------------------------------------- 
# ▼ gibt die derzeitigen sekunden zurück 
# .get_seconds 
#-------------------------------------------------------------------------- 
def get_seconds 
if @use_seconds == 1 
@total_sec = Graphics.frame_count / Graphics.frame_rate 
@sec = @total_sec % 60 
if @sec >= @slowseconds 
@sec += 1 
@slowseconds += @slowsec 
else 
@sec = 0 
end 
else 
@total_sec = Graphics.frame_count / Graphics.frame_rate 
@min = @total_sec / 60 % 60 
if @min >= @slowminutes 
@min += 1 
@slowminutes += @slowmin 
else 
@min = 0 
end 
@sec = @min 
end 
return @sec 
end 
#-------------------------------------------------------------------------- 
# ● Refresht die Bar 
#-------------------------------------------------------------------------- 
def refresh 
self.contents.clear 
# --------------- 
if @timemin == 0 
if @switch == true 
$game_switches[@switchnumber] = true 
end 
if @gameover == true 
$game_temp.gameover = true 
end 
end 
# ---------------- 
# erstellt HP anzeige 
timenow = get_seconds 
timemax = @timemax 
@timenow = timenow 
if @timemin == nil; @timemin = timemax; end 
if @stopcounter == false 
if timenow > @savetime 
@savetime = get_seconds 
@timemin -= 1 
end 
end 
if @timemin <= 0; @timemin = 0; end 
# ---------------- 
if @showbar == true 
text = @text 
@width = 1 
if @outline_color == true 
self.contents.font.color = Color.new(155, 100, 0) 
self.contents.draw_text(@width+1, -5, 118, 32, text) 
end 
self.contents.font.color = normal_color 
self.contents.draw_text(@width, -6, 118, 32, text) 
minbar = (@timemin.to_f / timemax.to_f) 
red = @red 
green = @green 
blue = @blue 
difference1 = (red / @barheight) - (@barheight / 2 + 2) 
difference2 = (green / @barheight) - (@barheight / 2 + 2) 
difference3 = (blue / @barheight) - (@barheight / 2 + 2) 
if difference1 < 0; difference1 = 0;end 
if difference2 < 0; difference2 = 0;end 
if difference3 < 0; difference3 = 0;end 
self.contents.fill_rect(2,17 + 4,115,@barheight + 3,@backback) 
if @backbar == true 
self.contents.fill_rect(4,16 + 6,111,@barheight,@backbarColor) 
end 

for i in 1..@barheight 
rect = Rect.new(4, 16+6 + i-1,111 * minbar,1) 
self.contents.fill_rect(rect,Color.new(red -= difference1,green -= difference2,blue -= difference3,255)) 
end 
if @showwarning == true 
if @timemin <= (@timemax / 6) 
self.contents.font.size = 12 
self.contents.font.color = @warningcolor 
self.contents.font.bold = true 
if @timemin == 0 && @deathtext == true 
self.contents.draw_text(10,23,111,12,@death_text.to_s) 
else 
if @timemin != 0 
self.contents.draw_text(10,23,111,12,@warning_text.to_s) 
end 
end 
self.contents.font.color = normal_color 
self.contents.font.bold = false 
self.contents.font.size = 22 
end 
end 
end 
if @barminitext == true 
self.contents.font.size = 12 
width1 = self.contents.text_size(@timemin.to_s).width 
width2 = self.contents.text_size(" / ").width 
width3 = self.contents.text_size(timemax.to_s).width 
widtho = 114 - (width1 + width2 + width3) 
height = 27 
self.contents.draw_text(widtho,height,111,12,@timemin.to_s) 
self.contents.draw_text(width1 + widtho,height,111,12," / ") 
self.contents.draw_text(width1 + width2 + widtho,height,111,12,timemax.to_s) 
self.contents.font.size = 22 
end 
end 
end
site ou autor do arquivo markusmks tamanho do arquivo 823KB licencaGrátis sistemas operacionais compativeisWindows 98/98SE/Me/2000/XP/Vista/7 Download

Deixe um comentário

  • Seja social e nos siga!

           
  • Páginas

  • Tags Especiais

  • Categorias

  • Parceiros

  • eXTReMe Tracker
    Copyright © 2001 - 2017 Gaming Room. Todos os Direitos Reservados - É expressamente proibida a reprodução total ou parcial deste site sem o consentimento dos autores.