TRIHAN'S "MAKE ME A SCRIPT" TOPIC!
Posts
Yes.
I have another question. I'm using the draw_text_ex() method, and it seems to only display a max of 2 lines. Is it possible to display more, and to auto trim the text (the autotrim isn't really important, but meh XD)?
Edit: No worries, I think I got it. :-)
I have another question. I'm using the draw_text_ex() method, and it seems to only display a max of 2 lines. Is it possible to display more, and to auto trim the text (the autotrim isn't really important, but meh XD)?
Edit: No worries, I think I got it. :-)
So I'm trying to make edits to this guy's nifty day/night script so it uses a prefix/suffix to add the map ids to an array that's used to determine whether or not the screen tints in respect to the time because I'm not about to enter each individual map id into the script if I can avoid it. (The array in question is on line 80, but is used on line 147)
Problem is that I have no idea how to add to an array with this language and I'm only 80% sure on how to nab a map's id if it contains the needed prefix/suffix :F
Problem is that I have no idea how to add to an array with this language and I'm only 80% sure on how to nab a map's id if it contains the needed prefix/suffix :F
To add an array, you do this:
#Sample Array Declaration description = [] #declared an empty array. You can add infinite number of items description[0] = "First Item" description[2] = "Second Item" #and so forth
author=shiningriverdescription = [] #declared an empty array. You can add infinite number of items
Just to clarify, when you say I can add an infinite number of items does that mean that the array can change in size at any time?
(I'm stuck in Java mode over here.. I blame my computer science classes)
Cause if it does, then all that's left for me to do is to write a bit of code to pull the ids of maps that have a certain prefix and then add them to the array (array.insert?)
To add a new element to the end of an array, it's array.push(element).
No worries.
If you ever get to the point of needing to do other forms of array manipulation:
array.unshift(element) - Adds a new element to the beginning of the array.
array.insert(position, element) - Adds a new element at any position of the array.
array.pop - Removes the last element of the array and returns it.
array.shift - Removes the first element of the array and returns it.
There are other methods too, but those are the most useful.
If you ever get to the point of needing to do other forms of array manipulation:
array.unshift(element) - Adds a new element to the beginning of the array.
array.insert(position, element) - Adds a new element at any position of the array.
array.pop - Removes the last element of the array and returns it.
array.shift - Removes the first element of the array and returns it.
There are other methods too, but those are the most useful.
I'm just going to sideline a bit...
Do you have a script that shows a window with a selectable list (for example, a window containing a list of player names)? I need to try to experiment on that one...
Do you have a script that shows a window with a selectable list (for example, a window containing a list of player names)? I need to try to experiment on that one...
The best thing to do is to recreate the enemy list window from part 2 of my Slip into Ruby article, but rather than draw enemy.name, make an array for the player names and use that as the data instead.
Is it possible to have a weapon (or skill) do two different elemental attacks? That is, say, a sword that does 10 physical damage + 2 cold damage. Or a spear that does 15 piercing damage + 6 fire damage. Stuff like that?
author=Trihan
The best thing to do is to recreate the enemy list window from part 2 of my Slip into Ruby article, but rather than draw enemy.name, make an array for the player names and use that as the data instead.
That works. I did some editing here and there, but it now works.
I guess I have to wait for part 3 to handle events associated with those items. :-)
kentona: I'm pretty sure that can be done. Would it work if you used that follow-on skill script to make the attack or skill in question use another skill afterwards that does the 2 cold damage or whatever, or is that not suitable for your needs?
shiningriver: Working on it. :)
Archeia: Interesting request. Leave it with me and I'll see what I can come up with.
shiningriver: Working on it. :)
Archeia: Interesting request. Leave it with me and I'll see what I can come up with.
class Game_Interpreter def tint_screen_and_pics(pic_ids, tone, frames, wait = false) screen.start_tone_change(tone, frames) for pic in pic_ids if screen.pictures[pic] != nil screen.pictures[pic].start_tone_change(tone, frames) end end wait(frames) if wait == true end end
There you go Archeia; call it in a script using "tint_screen_and_pics" along with the required parameters. Tone needs to be in the format "Tone.new(red, green, blue, grey)". pic_ids is an array of which pictures you want to tint along with the screen. Note that even if you're only tinting one pic it still needs to be an array or it'll cause an error.
Okay, so it's quite difficult... haha...
I'm having problems transitioning to another screen. What I want to accomplish is that all of the options call another screen (Scene_Fusion2). But I also want to get Scene_Fusion2 to display what you have selected from the previous screen (Scene_Fusion1).
Additionally, I am not able to exclude the main actor (the very first actor) no matter what method I try.
I'm having problems transitioning to another screen. What I want to accomplish is that all of the options call another screen (Scene_Fusion2). But I also want to get Scene_Fusion2 to display what you have selected from the previous screen (Scene_Fusion1).
Additionally, I am not able to exclude the main actor (the very first actor) no matter what method I try.
#============================================================================== # Class Scene_Fusion < Scene_MenuBase # This class is for displaying the first Fusion screen. All options should # open the next screen, Scene_Fusion2 #============================================================================== class Scene_Fusion < Scene_MenuBase def start super @header_window = Window_Header.new(0, 0, Graphics.width, 50) @list_window = Window_PartyList.new(0, 50, Graphics.width) @list_window.set_handler(:cancel, method(:return_scene)) end #def start end #class Scene_Fusion #============================================================================== # Class Scene_Fusion2 < Scene_MenuBase # This class is for displaying the second Fusion screen. All options should # open the next screen, displaying the status of the resulting demon #============================================================================== class Scene_Fusion2 < Scene_MenuBase def start super @header_window2 = Window_Header2.new(0, 0, Graphics.width, 50) @list_window2 = Window_PartyList2.new(0, 50, Graphics.width) @list_window2.set_handler(:cancel, method(:return_scene)) end #def start end #class Scene_Fusion2 #============================================================================== # Class Window_Header < Window_Base # This class displays the options at the top. #============================================================================== class Window_Header < Window_Base def initialize(x, y, width, height) super self.windowskin = Cache.system("Window") self.opacity = 0 update_padding update_tone create_contents draw_headers @opening = @closing = false end #def initialize def dispose contents.dispose unless disposed? super end #def dispose def draw_headers change_color(system_color) draw_text(25, 0, 250, line_height, "Select First Demon") draw_text(25, 25, 85, line_height, "Race") draw_text(110, 25, 85, line_height, "Name") draw_text(190, 25, 85, line_height, "LV") for i in 1..6 eval("draw_text(220+(50*#{i}), 0, 30, line_height, #{i})") end # for change_color(normal_color) end #def draw_headers end #class Window_Header #============================================================================== # Class Window_Header2 < Window_Base # This class displays the options at the top. #============================================================================== class Window_Header2 < Window_Base def initialize(x, y, width, height) super self.windowskin = Cache.system("Window") self.opacity = 0 update_padding update_tone create_contents draw_headers @opening = @closing = false end #def initialize def dispose contents.dispose unless disposed? super end #def dispose def draw_headers change_color(system_color) draw_text(25, 0, 250, line_height, "Select Second Demon") draw_text(25, 25, 85, line_height, "Race") draw_text(110, 25, 85, line_height, "Name") draw_text(190, 25, 85, line_height, "LV") draw_text(300, 25, 85, line_height, "Result") change_color(normal_color) end #def draw_headers end #class Window_Header2 #============================================================================== # Class Window_PartyList < Window_Selectable # This class displays the list of party members. Should not include the # main actor. #============================================================================== class Window_PartyList < Window_Selectable def initialize(x, y, width) super(x, y, width, Graphics.height - y) self.opacity = 0 data = [] self.index = 0 #Do not include the main actor! activate refresh end #def initialize def item_max @data ? @data.size : 1 end #def item_max def make_item_list @data = $game_party.members.compact end #def make_item_list def draw_item(index) item = @data[index] if item rect = item_rect_for_text(index) draw_text(rect, item.id) draw_text_ex(rect.x + 15, rect.y, item.class.name) draw_text_ex(rect.x + 100, rect.y, item.name) draw_text_ex(rect.x + 180, rect.y, item.level) for i in 1..6 if index==i-1 #If same actor, cannot be fused eval("draw_text(220+(50*#{i}), rect.y, 30, line_height, '-')") elsif item.class == @data[i-1].class #else if same class, cannot be fused eval("draw_text(220+(50*#{i}), rect.y, 30, line_height, 'No')") else #else, can be fused eval("draw_text(220+(50*#{i}), rect.y, 30, line_height, 'Yes')") #set call handler end #end if else end #end for end #end if end #def draw_item def refresh contents.clear make_item_list create_contents draw_all_items end #def refresh #set handler for showing the next screen end #class Window_PartyList #============================================================================== # Class Window_PartyList2 < Window_Selectable # This class displays the list of party members. Should not include the # main actor. #============================================================================== class Window_PartyList2 < Window_Selectable def initialize(x, y, width) super(x, y, width, Graphics.height - y) self.opacity = 0 data = [] self.index = 0 #Do not include the main actor! activate refresh end #def initialize def item_max @data ? @data.size : 1 end #def item_max def make_item_list @data = $game_party.members.compact end #def make_item_list def draw_item(index) item = @data[index] if item rect = item_rect_for_text(index) draw_text(rect, item.id) draw_text_ex(rect.x + 15, rect.y, item.class.name) draw_text_ex(rect.x + 100, rect.y, item.name) draw_text_ex(rect.x + 180, rect.y, item.level) for i in 1..6 if index==i-1 #If same actor, cannot be fused eval("draw_text(220+(50*#{i}), rect.y, 30, line_height, '!')") elsif item.class == @data[i-1].class #else if same class, cannot be fused eval("draw_text(220+(50*#{i}), rect.y, 30, line_height, 'No')") else #else, can be fused eval("draw_text(220+(50*#{i}), rect.y, 30, line_height, 'Yes')") @data[i-1].set_handler(:ok, SceneManager.call(Scene_Fusion2)) #set call handler end #end if else end #end for end #end if end #def draw_item def refresh contents.clear make_item_list create_contents draw_all_items end #def refresh end #class Window_PartyList2
How about a simple script that allows a spell to display enemy HP next to their name after the spell is used on them?
Before: FAT CAT
After: FAT CAT (HP: 56/56)
Before: FAT CAT
After: FAT CAT (HP: 56/56)
Thank you so much Trihan <3
EDIT:
I found a bug! When I call a message, the game reverts the picture's original tint D:
Fully tested without other scripts.
EDIT 2:
Nevermind I am a moron and show pictured twice <_<
Sorry XD
EDIT:
Fully tested without other scripts.
EDIT 2:
Nevermind I am a moron and show pictured twice <_<
Sorry XD
class Game_Enemy < Game_Battler attr_accessor :scanned alias tri_scan_initialize initialize def initialize(index, enemy_id) tri_scan_initialize(index, enemy_id) @scanned = false end def scanned? @scanned end end class Window_BattleEnemy < Window_Selectable def draw_item(index) change_color(normal_color) enemy = $game_troop.alive_members[index] name = enemy.name if enemy.scanned? draw_text(item_rect_for_text(index), "#{name} (#{enemy.hp}/#{enemy.mhp})") else draw_text(item_rect_for_text(index), name) end end end
There you go UPRC. You need to make the skill in question set the scanned property of the target to true. I did this by doing "b.scanned = true" in the formula window, but then it displays a message saying no damage was done so this obviously isn't the best way. I'd probably recommend implementing a notetag for it or something.
Hi, how's it going so far?
I'm having difficulty trying to display the item selected from one screen to be displayed to another... here's the code that I have
I'm trying to get the item selected from Window_PartyList1 to be displayed on Header2.
I'm having difficulty trying to display the item selected from one screen to be displayed to another... here's the code that I have
#============================================================================== # Class Scene_Fusion < Scene_MenuBase # This class is for displaying the Fusion screen. All options should # open the next screen, Scene_Fusion2 #============================================================================== class Scene_Fusion < Scene_MenuBase def start super # Fusion 1 @header1 = Window_Header.new(0, 0, Graphics.width, 132) @list1 = Window_PartyList.new(0, 132, Graphics.width) @list1.set_handler(:ok, method(:continue)) @list1.set_handler(:cancel, method(:return_scene)) # Fusion 2 @header2 = Window_Header2.new(0, 0, Graphics.width, 132) @list2 = Window_PartyList2.new(0, 132, Graphics.width) @list2.set_handler(:ok, method(:continue)) @list2.set_handler(:cancel, method(:return_scene)) # Setup Fusion 1 as the start point @list1.activate # Activate the first list. @list2.deactivate # Deactivate the second list. @list2.hide @header2.hide # Hide the second list and header. end def continue @list1.deactivate @list1.hide @header1.hide @list2.show @header2.show @list2.activate end end #============================================================================== # Class Window_Header < Window_Base # This class displays the options at the top. #============================================================================== class Window_Header < Window_Base def initialize(x, y, width, height) super self.opacity = 0 draw_headers @opening = @closing = false end #def initialize def dispose contents.dispose unless disposed? super end #def dispose def draw_headers line_height = 16 change_color(system_color) draw_text(30, 0, 250, line_height, "Select First Demon") draw_text(30, 40, 85, line_height, "Race") draw_text(120, 40, 85, line_height, "Name") draw_text(265, 40, 85, line_height, "LV") for i in 1..10 eval("draw_text(300+(30*#{i-1}), 0, 30, 10, #{i})") end # for change_color(normal_color) end #def draw_headers end #class Window_Header #============================================================================== # Class Window_Header2 < Window_Base # This class displays the options at the top. #============================================================================== class Window_Header2 < Window_Base def initialize(x, y, width, height) super self.opacity = 0 draw_headers @opening = @closing = false end #def initialize def dispose contents.dispose unless disposed? super end #def dispose def selected(value) @selected = value end #def selected def draw_headers line_height = 16 change_color(system_color) draw_text(30, 0, 250, line_height, "Select Second Demon") draw_text(420, 0, 300, line_height, $selected.class) draw_text(30, 40, 85, line_height, "Race") draw_text(120, 40, 85, line_height, "Name") draw_text(265, 40, 85, line_height, "LV") draw_text(420, 40, 85, line_height, "Result") change_color(normal_color) end #def draw_headers end #class Window_Header2 #============================================================================== # Class Window_PartyList < Window_Selectable # This class displays the list of party members. Should not include the # main actor. #============================================================================== class Window_PartyList < Window_Selectable def initialize(x, y, width) super(x, y, width, Graphics.height - y) self.opacity = 0 data = [] self.index = 0 #Do not include the main actor! activate refresh end #def initialize def item_max @data ? @data.size : 1 end #def item_max def make_item_list @data = $game_party.members.compact @data.delete_at(0) #Ensures that the first party member isn't bothered. end #def make_item_list def draw_item(index) line_height = 16 item = @data[index] if item rect = item_rect_for_text(index) #draw_text(rect, item.id) draw_text_ex(0, rect.y, item.id) #draw_text_ex(rect.x + 15, rect.y, item.class.name) draw_text_ex(30, rect.y, item.class.name) #draw_text_ex(rect.x + 100, rect.y, item.name) draw_text_ex(120, rect.y, item.name) #draw_text_ex(rect.x + 180, rect.y, item.level) draw_text_ex(265, rect.y, item.level) for i in 1..10 if index==i-1 #If same actor, cannot be fused eval("draw_text(300+(30*#{i-1}), rect.y, 30, line_height, '-')") elsif item.class == @data[i-1].class #else if same class, cannot be fused eval("draw_text(300+(30*#{i-1}), rect.y, 30, line_height, 'No')") else #else, can be fused eval("draw_text(300+(30*#{i-1}), rect.y, 30, line_height, 'Yes')") #@data[i-1].set_handler(:ok, SceneManager.call(Scene_Fusion2)) end #end if else end #end for end #end if end #def draw_item #def selected(value) # @selected = value #end def refresh contents.clear make_item_list create_contents draw_all_items end #def refresh def selected #return @data[self.index] $selected = @data[self.index] end #def selected end #class Window_PartyList #============================================================================== # Class Window_PartyList2 < Window_Selectable # This class displays the list of party members. Should not include the # main actor. #============================================================================== class Window_PartyList2 < Window_Selectable def initialize(x, y, width) super(x, y, width, Graphics.height - y) self.opacity = 0 data = [] resultClass = [] self.index = 0 #Do not include the main actor! activate refresh resultClass[0] = nil #resultClass for Deity Fusions: resultClass[1] = {3, 5, 5, 4, 9, 10, 8, 9, 7, 5} #resultClass for Fairy Fusions: resultClass[2] = {6, 5, 3, 2, 2, 6, 8, 9, 7, 2} end #def initialize def item_max @data ? @data.size : 1 end #def item_max def make_item_list @data = $game_party.members.compact @data.delete_at(0) #Ensures that the first party member isn't bothered. end #def make_item_list def draw_item(index) item = @data[index] if item rect = item_rect_for_text(index) draw_text(rect, item.id) draw_text_ex(rect.x + 15, rect.y, item.class.name) draw_text_ex(rect.x + 100, rect.y, item.name) draw_text_ex(rect.x + 180, rect.y, item.level) #Compute the resulting demon draw_text_ex(rect.x + 350, rect.y, show_result(item, index)) end #end if end #def draw_item #should print out the resulting demon. def show_result(item, index) return @result[item.id][index] end #show_result def refresh contents.clear make_item_list create_contents draw_all_items end #def refresh def selected(value) @selected = value end #set handler for showing the next screen end #class Window_PartyList2
I'm trying to get the item selected from Window_PartyList1 to be displayed on Header2.



















