Jump to content
Rpg²S Forum

mulliky

Utenti
  • Posts

    64
  • Joined

  • Last visited

Posts posted by mulliky

  1. salve,

    ho 2 problemi con 2 script diversi, però a dirla tutta solo 1 di loro mi da veramente problemi

     

    il primo script è questo:

     

     

    #===============================================================================
    # ** Hunger_HUD
    #===============================================================================

    class Hunger_HUD < Window_Base

      #====================================================================#
      #                    BEGIN CONFIGURATION                             #
      #====================================================================#
     
      # Define the colors used for each of the bars.
      HUNGER_EMPTY = Color.new(255, 0, 0)
      HUNGER_FULL = Color.new(0, 255, 0)
     
      THIRST_EMPTY = Color.new(96, 96, 96)
      THIRST_FULL = Color.new(128, 128, 255)
     
      BACKGROUND_COLOR = Color.new(0, 0, 0)
     
      # Define the type of bar used. (0 = Gradient, 1 = Transitional)
      # It would take longer to explain the differences than to just try each out.
      # There's only two as of the moment.
      BAR_STYLE = 1
     
      # Define the width and height, in pixels, of the bars.
      BAR_WIDTH = 128
      BAR_HEIGHT = 8
     
      # Define switch for active/visibility control within game.
      ONOFF_SWITCH = 10
     
      #====================================================================#
      #                     END CONFIGURATION                              #
      #====================================================================#
     
      def initialize(y = -12)
        super(0, y, 640, 96)
        # Set the windowskin's opacity to 0.
        self.windowskin = nil
        @colors1 = [HUNGER_EMPTY, HUNGER_FULL, BACKGROUND_COLOR]
        @colors2 = [THIRST_EMPTY, THIRST_FULL, BACKGROUND_COLOR]
        @actors = $game_party.actors
        @stats = stats
        refresh
      end
     
      def refresh
        # Dispose the contents of the HUD.
        if self.contents != nil
          self.contents.dispose
          self.contents = nil
        end
        # Adjust width and location of window.
        self.width = @actors.size * (BAR_WIDTH + 48)
        self.x = (640 - self.width) / 2
        self.contents = Bitmap.new(self.width, self.height)
        # Iterate actors.
        @actors.each_index {|i|
          actor = @actors
          # Calculate locations for each actor's bars.
          x = i * (BAR_WIDTH + 48)
          # Draw actor's name.
          self.contents.font.size = 16
          self.contents.draw_text(x, 0, BAR_WIDTH, 16, actor.name)
          # Draw hunger bars.
          w, h, rate, max = BAR_WIDTH, BAR_HEIGHT, @stats[0], @stats[1]
          self.contents.draw_bar(x, 16, w, h, rate, max, BAR_STYLE, @colors1)
          # Draw thirst bars.
          rate, max, height = @stats[2], @stats[3], 16+BAR_HEIGHT+4
          self.contents.draw_bar(x, height, w, h, rate, max, BAR_STYLE, @colors2)
        }
      end
     
      def stats
        return @actors.collect {|a| [a.hunger, a.max_hunger, a.thirst, a.max_thirst]}
      end
     
      def update
        self.visible = $game_switches[ONOFF_SWITCH]
        if self.visible
          if (@stats != stats) || (@actors != $game_party.actors)
            @stats, @actors = stats, $game_party.actors
            refresh
          end
        end
      end
    end

    #===============================================================================
    # ** Gradient_Bar
    #===============================================================================

    class Bitmap
     
      def draw_bar(x, y, w, h, rate, max, style, colors = nil)
        # Set required instance variables.
        @bar_rect = Rect.new(x, y, w, h)
        @rate, @max, @style, @colors = rate, max, style, colors
        # Define default colors if not defined. (RED <--> GREEN)
        if @colors == nil
          @colors = [Color.new(255, 0, 0), Color.new(0, 255, 0), Color.new(0, 0, 0)]
        end
        # Draw the background color.
        self.fill_rect(@bar_rect, @colors[2])
        # Branch by what style is being used.
        case @style
        when 0 then gradient
        when 1 then transition
        end
      end
    #-------------------------------------------------------------------------------
      def gradient
        # Get the bar from the cache.
        key = [@style, @bar_rect.width-2, @bar_rect.height-2, @colors[0], @colors[1]]
        bar = RPG::Cache.gradient_bar(*key)
        # Draw the gradient bar using rectangular transfer.
        rect = Rect.new(0, 0, fill_width, @bar_rect.height)
        self.blt(@bar_rect.x+1, @bar_rect.y+1, bar, rect)
      end
    #-------------------------------------------------------------------------------
      def transition
        # Returns the color for current rate.
        c1 = [@colors[0].red, @colors[0].green, @colors[0].blue, @colors[0].alpha]
        c2 = [@colors[1].red, @colors[1].green, @colors[1].blue, @colors[1].alpha]
        rgba, rate = [],  1 - (@rate.to_f / @max)
        c1.each_index {|i| rgba = c2 - ((c2 - c1) * rate) }
        # Set the bars fill rate and color depending on value.
        rect = Rect.new(@bar_rect.x+1, @bar_rect.y+1, fill_width, @bar_rect.height-2)
        self.fill_rect(rect, Color.new(*rgba))
      end
    #-------------------------------------------------------------------------------
      def fill_width
        # Calculate the difference, in percentage, of the min and max rates.
        return ((@rate / @max.to_f) * (@bar_rect.width - 2)).round
      end
    #-------------------------------------------------------------------------------
    end

    #===============================================================================
    # ** Scene_Map
    #===============================================================================

    class Scene_Map
     
      alias zer0_hunger_hud_main main
      def main
        # Add the bars to Scene_Map.
        @hunger_hud = Hunger_HUD.new
        zer0_hunger_hud_main
        @hunger_hud.dispose unless @hunger_hud.disposed? || @hunger_hud == nil
      end
     
      alias zer0_hunger_hud_upd update
      def update
        # Update the bars as needed.
        @hunger_hud.update
        zer0_hunger_hud_upd
      end
    end

    #===============================================================================
    # ** RPG::Cache
    #===============================================================================

    module RPG::Cache
     
      def self.gradient_bar(style, width, height, color1, color2)
        # Create a unique key to call the bar back with.
        path = [style, width, height, color1, color2]
        # Check if cache already has bitmap defined, if not create it now.
        if !@cache.include?(path) || @cache[path].disposed?
          bitmap, rates = Bitmap.new(width, height), []
          # Iterate through each pixel horizontally, setting a gradient color.
          c1 = [color1.red, color1.green, color1.blue, color1.alpha]
          c2 = [color2.red, color2.green, color2.blue, color2.alpha]
          # Draw the bar, having in transition from the first color to the second.
          c1.each_index {|i| rates = (c1 - c2).to_f / width }
          (0...width).each {|i|
            values = [0, 1, 2, 3].collect {|j| c1[j] - (i * rates[j]) }
            # Set the color incrementally. This will be used later.
            bitmap.fill_rect(i, 0, 1, height, Color.new(*values))
          }
          @cache[path] = bitmap
        end
        # Return the created bitmap.
        return @cache[path]
      end
    end

    che è l'hud dello script hunger and thirst presente qui : http://forum.chaos-project.com/index.php?topic=6363.0

     

    il problema è che subito dopo che la partita viene avviata si vedono ma passati pochi secondi sparisce, la stessa cosa appare quando chiudo il menu (ho lo script menu ad anello) si vede per pochi secondi e poi scompare, come posso risolvere?

     

    il secondo script con il quale ho "problemi" è l'hp bar,

     

     

    #-----------------------------------------------------------------
        class Scene_Map
        #-----------------------------------------------------------------
        alias sk_bar_main main
        def main
        @bars = Window_Sk_Bars.new
        sk_bar_main
        @bars.dispose if @bars != nil
        end
        #-----------------------------------------------------------------
        alias sk_bar_update update
        def update
        @bars.update
        sk_bar_update
        end
        #-----------------------------------------------------------------
        end
        #-----------------------------------------------------------------
        class Window_Base < Window
        #-----------------------------------------------------------------
        def sk_initialize(font=0,size=22)
        font = "Tahoma" if font == 0
        self.contents = Bitmap.new(self.width-32,self.height-32)
        self.contents.font.name = font
        self.contents.font.size = size
        end
        #-----------------------------------------------------------------
        def draw_text_outline(x,y,w,h,str,c=normal_color,a=0)
        self.contents.font.color = Color.new(0,0,0,255)
        self.contents.draw_text(x-1,y,w,h,str,a)
        self.contents.draw_text(x+1,y,w,h,str,a)
        self.contents.draw_text(x,y+1,w,h,str,a)
        self.contents.draw_text(x,y-1,w,h,str,a)
        self.contents.font.color = c
        self.contents.draw_text(x,y,w,h,str,a)
        end
        #-----------------------------------------------------------------
        end
        #-----------------------------------------------------------------
        class Window_Sk_Bars < Window_Base
        #-----------------------------------------------------------------
        def initialize
        super(250,-8,206,96)
        sk_initialize("Comic Sans MS")
        self.opacity = 0
        end
        #-----------------------------------------------------------------
        def update
        self.contents.clear
        actor = $game_party.actors[0]
        draw_text_outline(0,-4,64,26,"HP")
        draw_actor_hp(actor,30,0)
        end
        #-----------------------------------------------------------------
        def draw_actor_hp(actor,x,y)
        width = 128
        y += 4
        white = Color.new(255,255,255,255)
        black = Color.new(0,0,0,255)
        w = width * actor.hp / actor.maxhp
        # White border
        self.contents.fill_rect(x+1, y-1, width-2, 1, white)
        self.contents.fill_rect(x, y, width, 1, white)
        self.contents.fill_rect(x-1, y+1, width+2, 9, white)
        self.contents.fill_rect(x, y+10, width, 1, white)
        self.contents.fill_rect(x+1, y+11, width-2, 1, white)
        # Black back
        self.contents.fill_rect(x+2, y, width-4, 1, black)
        self.contents.fill_rect(x+1, y+1, width-2, 1, black)
        self.contents.fill_rect(x, y+2, width, 7, black)
        self.contents.fill_rect(x+1, y+9, width-2, 1, black)
        self.contents.fill_rect(x+2, y+10, width-4, 1, black)
        # Generating the color
        val = 255 * ((actor.hp*100)/actor.maxhp)
        green = 255 - val/100
        color = Color.new(224,green,0,255)
        w_color = Color.new(255,green+32,96,255)
        if green > 64 then green -= 32
        elsif green > 128 then green -= 64 end
        b_color = Color.new(172,green,0,255)
        # Making the bar
        self.contents.fill_rect(x+2, y, w-4, 1, w_color)
        self.contents.fill_rect(x+1, y+1, w-2, 1, w_color)
        self.contents.fill_rect(x, y+2, w, 7, color)
        self.contents.fill_rect(x+1, y+9, w-2, 1, color)
        self.contents.fill_rect(x+2, y+10, w-4, 1, b_color)
        end
        #-----------------------------------------------------------------
        end
        #-----------------------------------------------------------------
       

    il problema è che sta in alto sulla schermata, centrato, e li ci dovrebbero essere anche le barre della sete/fame, qualche buon anima puo fare in modo ceh mi appaia in basso?

     

    scusate il disturbo

  2. io voglio creare un gioco di avventura ( per ora ho abbandonato la possibilita di one piece cosi posso impratichirmi prima) con la sua trama e le sotto missioni pero vorrei aggiungerci tante cose
  3. Salve a tuttiiiiiii

    vengo achiedere aiuto...

    Vorrri rendere il mio gioco eccezzionale e aggiungere delle belle features ma apparte il menu ad anello non me ne vengono in mente nessuna voi avete qualche idea; cosa vorreste voi da un gioco?

    ringrazio tutti quelli che mi aiuteranno

  4. <p>ecco a fondo pagina tutto cio che ho trovato... mancano un po di nemici e personaggi ed è per questo che ho bisogno di un buon pixel artist.<br />

    la trama è quella di one piece fino a dopo i fatti di impel down<br />

    pensavo di aggiungere<br />

    il ciclo giorno e notte<br />

    la possibilita di cucinare e raccogliere mandarini e pescare<br />

    poter vivere un avventura a parte (panda man)<br />

    e cose del genere...<br />

    so che sembrera un po ambizioso ma credo che se avro abbastanza aiuto sara un gioco stupendo (forse xD)<br />

    grazie a chiunque aiuterà<br />

    <img src="http://img526.imageshack.us/img526/542/aceon.png" /><br />

    <img src="http://img51.imageshack.us/img51/9042/arlongd.png" /><br />

    <img src="http://desmond.imageshack.us/Himg29/scaled.php?server=29&filename=cabajis.png&res=landing" /><img src="http://desmond.imageshack.us/Himg40/scaled.php?server=40&filename=django.png&res=landing" /><img src="http://img341.imageshack.us/img341/5048/fullbody.png" /><img src="http://desmond.imageshack.us/Himg834/scaled.php?server=834&filename=hinatheblackcage.png&res=landing" /><br />

    <br />

    ne ho altri ma non ho il tempo di postarli</p>

  5. Buongiorno a tutti, non so se vi ricordate di me ma non sono potuto stare connesso per problemi nella vita reale...

    ora torno con progetti, direi, ambiziosi per me...

    vorrei realizzare un gioco di one-piece , so che sembra un po banale ma lo vorrei fare bene

    non ho screen... ma ho molti chara...

    avrei bisogno di qualcuno in grado di realizzare buone animazioni (ovvero un pixel-artist)

    e uno scripter...

    grazie mille

    le comunicazioni avverranno tramite msn

  6. Dì la verità che ti rodeva la coscenza a fare il lurker ruba risorse.

    Benvenuto.

     

    cavolo mi avete scoperto! a parte gli scherzi dove posso porre le mie domande?

  7. progetto con le mucche? mai fatto e mai pensato xD io mi ricordo di: seraph andrew, flame, sadico e poi vuoto totale

     

    una specie di monster hunter

  8. Ciao a tutti! mi sono iscritto a questo forum ( ma lo ero gia....ma ho perso la password...) per poter accedere a tutte le risorse grafiche ma poi mi sono detto : " ehi! se vuoi fare un gioco decente devi imparare qualcosa di piu su eventi, impararare a fare script, imparare a mappare bene; ma perchè non vai ad imparare qualcosa sul quel forum pieno di esperti" e così eccomi qua se volete sapere qualcosa di piu su di me:

     

    Inseguo da 3 anni il desiderio di creare un gioco rpg bello e ben definito; da 2 ho cominciato a imparare qualcosa e da 1 mese ho capito che devo imparare prima di fare (uso rpg maker xp)

    forse qualcuno di voi mi ricorda? un certo mulliky che era in chat questa estate... vabbe spero di essere il benvenuto!

×
×
  • Create New...