Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin
- Change Picture Properties
- Made by: Sixth
- Just a small snippet allowing the user to change the pictures' properties
- individually instead of setting them all at once like how those rigid default
- picture related event commands do.
- You can use this script call:
- change_pic_prop(pic_id, prop_data1, prop_data2, ..., duration)
- The pic_id must be an integer number and it will be the ID of the picture.
- The prop_dataX arguments will be the properties you will change with the script
- call. Each of them is an array with 2 elements. The first element is always the
- name of the property, and the second element is the value you want to set for
- that property.
- Here is a list of valid property names:
- 'name' # Changes the image used for the picture (string)
- 'x' # Changes the X position of the picture (float number)
- 'y' # Changes the Y position of the picture (float number)
- 'zoom_x' # Changes the horizontal zoom level of the picture (0.0 to 100.0)
- 'zoom_y' # Changes the vertical zoom level of the picture (0.0 to 100.0)
- 'opacity' # Changes the opacity of the picture (0.0 to 255.0)
- 'blend_type' # Changes the blend type of the picture (0, 1 or 2)
- They are all strings!
- I wrote the possible value types these properties can take beside them in
- brackets. Note the difference between integer and float numbers, those are
- kinda important. If you use an integer number for an animated property, it will
- NOT work correctly! So, use float numbers for pretty much everything except for
- the 'name' and 'blend_type' properties.
- You can enter as many as you want in the script call, and all of these changes
- will be executed at once.
- The last part of the script call is an optional argument named as duration.
- If you use that, the changes will be animated, so it will change the specified
- properties within the specified duration gradually.
- This argument must come after all of your prop_data arguments, and it must be
- an integer from 1 to infinity!
- You can NOT change the 'name' and 'blend_type' properties with a script call
- using the duration argument! If you do, your game will crash!
- The rest of them can be used with the duration argument.
- The duration for the change is a global duration, sadly. That's how the default
- code is written, and I have no intention of rewriting it, too much hassle. :P
- So, if you do a second script call with the duration argument while the previous
- one is still not finished the change, it will rewrite the duration for those
- previous changes specified in the previous script call, so you may want to add
- a wait command after these before executing another script call to change
- something.
- Examples:
- change_pic_prop(1,['name',"zack1_s1a"])
- change_pic_prop(23,['name',"tutorial2"],['blend_type',0])
- change_pic_prop(12,['zoom_x',25.0],['zoom_y',0.5],120)
- change_pic_prop(35,['x',240.0],['y',320.0],['opacity',0.0],90)
- chnage_pic_prop(24,['opacity',180])
- =end
- class Game_Picture
- attr_accessor :number, :name, :origin, :x, :y, :zoom_x, :zoom_y, :opacity,
- :blend_type, :tone, :angle,
- :target_x, :target_y, :target_zoom_x, :target_zoom_y,
- :target_opacity
- def change_prop(*changes)
- if changes[-1].is_a?(Integer) # Animated
- @duration = changes.pop
- changes.each {|change| send('target_' + change[0] + '=', change[1]) }
- else # Instant
- changes.each {|change| send(change[0]+'=',change[1]) }
- end
- end
- end
- class Game_Interpreter
- def change_pic_prop(id,*changes)
- screen.pictures[id].change_prop(*changes)
- end
- end
- # End of scipt! O_O
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement