Jump to content

Announcing our new website

To find out the latest about our new website, visit Game Dev Unlimited

- - - - -

Quick Scripting Problem with an amazing CASH PRIZE


  • You cannot reply to this topic
4 replies to this topic

#1 Elvshire

    Newbie

  • Member
  • 2 posts

Posted 22 December 2011 - 10:20 PM

So I've recently begun working in RMXP on a small project with a friend and I've been struggling to start learning how to use the scripting system to allow for greater customization. I'm currently using the Atoa CBS with the Chrono Trigger addon and I've come to a point of real difficulty for me, though I'm sure for anyone with a shred of scripting knowledge will laugh at the simplicity of my problem. What I'm trying to do is display an image onscreen whenever the item window is shown in combat. The idea is to simply reduce the opacity of the default item box until it is invisible and use the displayed image file as the new background. If someone could show me how to write a couple of lines to display the image and where to place them in what I assume will be Window_Item, it would be a HUGE help to me.

Thanks in advance.

Oh yeah, CASH PRIZES
If anyone can help me get this going I will paypal them $5. Not much, but hey, more then you're getting in other threads Posted Image

#2 kellessdee

    mrrow ~!

  • Moderator
  • 904 posts

Posted 22 December 2011 - 11:51 PM

I never laugh at the simplicity of ANYONE's problems. We all gotta start somewhere don't we? (besides, you're already half way there!) :D

Anyways, I'll tell you how to do this. But I require ONE SINGLE CONDITION.....and that is you don't give me money.

So, first off, this won't be the most efficient way to solve this...however, it will be the simplest, and it will be easiest to implement.
Now, I can't promise this will work right away -- it will depend on whether/how any other scripts you have might affect the Window_Item class.

Anyways, try this on for size (add below all other scripts):
class Window_Item < Window_Selectable
  # =========================
  # Image Name Configuration
  # =========================
  BG_IMG = "filename"  # Set to the name of picture, in pictures folder

  alias :new_init_bg :initialize unless method_defined? :new_init_bg
  
  def initialize
    new_init_bg
    if $game_temp.in_battle
        @background_sprite = Sprite.new
        @background_sprite.bitmap = RPG::Cache.picture(BG_IMG)
        @background_sprite.x, @background_sprite.y = self.x, self.y
        self.opacity = 0
    end
  end
  
  # Just in case the window gets repositioned
  # these methods will trigger the background image 
  # to move with it
  def x=(x)
    super
    if @background_sprite
      @background_sprite.x = x
    end
  end
  
  def y=(y)
    super
    if @background_sprite
      @background_sprite.y = y
    end
  end
  
  # Dispose background when window is disposed
  def dispose
    super
    if @background_sprite
      @background_sprite.dispose
    end
  end
end

Just change BG_IMG = "filename" to the filename of the background you would like to use. (MUST be in quotations " ", the file extension (.bmp/.png/etc) is not necessary though.)

Lemme know if that works, and works the way you want it. This *SHOULD* work in a default script environment, but I can't guarantee its behaviour with custom scripts (should still be okay though)

Some tweaking may be required in terms of size -- though if your background image is the same size as the battle item window, then it should be okay.

#3 bigace

    King of Spades

  • Member
  • 732 posts

Posted 23 December 2011 - 07:46 AM

Uh Stop Posted Image , Atoa ACBS already does that by default:

Just look at his Custom Windows Setting Script that basically allows you to move the window, change the opacity and add a background image. You should probably read the whole CBS first as he add alot of customizable components. How I Know this because I'm look at it right now, plus I have my own custom background I made in photoshop.

#4 kellessdee

    mrrow ~!

  • Moderator
  • 904 posts

Posted 23 December 2011 - 02:46 PM

Oh, LOL. Bigace ftw! I am not familiar with any of these custom scripts. Good thing someone is! xD

#5 Elvshire

    Newbie

  • Member
  • 2 posts

Posted 23 December 2011 - 10:03 PM

View Postbigace, on 23 December 2011 - 07:46 AM, said:

Uh Stop Posted Image , Atoa ACBS already does that by default:

Just look at his Custom Windows Setting Script that basically allows you to move the window, change the opacity and add a background image. You should probably read the whole CBS first as he add alot of customizable components. How I Know this because I'm look at it right now, plus I have my own custom background I made in photoshop.

I had actually messed around quite a bit with the custom window settings but never of them ever applied correctly. That is until I took a second pass at it right now and realized I simply needed to move the location of the custom window script to get it to load right. Damn it! So much time wasted. Thanks to both of you, though.





0 user(s) are reading this topic

members, guests, anonymous users