Okay, so, uh..lets get started. (TYPO IN TUTORIAL, I noticed I said to use armor, but I used sword by accident) (Demo at bottom).
Lets say you were making a blacksmith, you set a choice for an item to be created, but you want a window showing what is needed to make the item or whatever.Code:
Spoiler for :
class Window_Popup < Window_Base def initialize super(0, 0, 640, 64) self.contents = Bitmap.new(width = 600, height = 32) refresh end def refresh self.contents.clear #---------------------------------------------- #--Edit where it has purple text, if you want-- #--to be able to have more than just the same-- #--popup window, then copy this and rename it-- #--to something unique, you'll have to rename-- #--it where ever you see where I've placed my-- #--names, like to the left, and at the top of-- #--this, and don't forget to check the event -- #--that runs the script, you'll have to -- #--rename that aswell. When making the event-- #--put @gold_window.dispose AFTER the text, -- #--it's important otherwise nothing pops up. -- #-- Have Fun! -- #---------------------------------------------- cx = contents.text_size("Creation Items: 10 Iron Bars,50 gold").width self.contents.font.color = normal_color self.contents.draw_text(0, 0, cx, 32, "Creation Items: 10 Iron Bars,50 gold", 2) end end
Step 1:Make a new event, name it Blacksmith01 or whatever you want.
Now, put a Show Choice command and type "Make Iron Armor". Once your done that, under the "Make Iron Sword" option insert a "Script" command. Type "@gold_window = Window_Popup.new"(Explained at end of tutorial).
After that, put in another Show Choice option asking "Continue?" Then under the "Continue?" choice put another Show Choice command asking "Create Item".
Now the fun stuff, under the "Create Item" choice put a conditional branch, navigate to settings page 4 in the Conditional Branch options, check Gold or G or whatever your currency is and put 50.
After that,in the conditional branch, put a text command saying "Here you are." Then, a Change Gold command with settings of "Operation = Decrease" "Constant = 50" Then after that, put a Change Weapons "Iron sword Increase 1".
Under "Else" put a "Jump To Label" command and put whatever label name you want. (Everything explained at the end of tutorial)
Then after the "Jump to Label" command insert a script command with "@gold_window.dispose" (Also put this wherever necessary).
Then, at the bottom of everything, put an "Exit Event Processing" command. Then under that, put a Label command. Put the same name as you did the Jump to Label command. Then insert text saying "Not enough gold."
Now if you go ingame, talk to the event and you have 50 gold, select the Create Iron Armor option and voilla a new Armor.
The Result:
EVERYTHING EXPLAINED!!Starting with the conditional branch, I like to make my custom "shops" actually cost something
. Which is why I used the Conditional Branch. For the Jump to Label, I used that to "jump" to the label below everything if the player did not have enough gold.
Now for the script explanation, the script is fairly simple to use, read the comments I put in it and you'll figure it out.(Put this script above "Main").
Spoiler for :
class Window_Popup < Window_Base def initialize super(0, 0, 640, 64) self.contents = Bitmap.new(width = 600, height = 32) refresh end def refresh self.contents.clear #---------------------------------------------- #--Edit where it has purple text, if you want-- #--to be able to have more than just the same-- #--popup window, then copy this and rename it-- #--to something unique, you'll have to rename-- #--it where ever you see where I've placed my-- #--names, like to the left, and at the top of-- #--this, and don't forget to check the event -- #--that runs the script, you'll have to -- #--rename that aswell. When making the event-- #--put @gold_window.dispose AFTER the text, -- #--it's important otherwise nothing pops up. -- #-- Have Fun! -- #---------------------------------------------- cx = contents.text_size("Creation Items: 10 Iron Bars,50 gold").width self.contents.font.color = normal_color self.contents.draw_text(0, 0, cx, 32, "Creation Items: 10 Iron Bars,50 gold", 2) end end
-=DEMO=- http://s23.quicksharing.com/v/6927608/WindowDemo.rar.html Credit to
Reddawg for the script.