This is a public list for scripts that are so small that the author feels that they should not bother giving them their own topic. Anybody can submit a script to this list and it will be added to the table.
List of Scriptlets:Script Name Change Leader | Game Over to Common Event | Stop Animation Actors | A little module addon |
| Author |modern algebra | |modern algebra | |modern algebra | |Zeriab |
| Description |Scroll through party members to choose leader (on map) | |Runs a common event at gameover, rather then going straight to gameover screen | |Allows you to have actors with stop animation if they are the leader | |Allows for you to set a default value to a public instance variable in it's definition |
|
Change Leader
by modern algebra
It's a pretty common request, so I figured I'd post it. Basically, this script allows you to switch your lead character on the map by using the L and R buttons (To see what keys each button is attached to, press F1 while Test Playing and go to Page 3 in the little menu that pops up. By default, L and R are Q and W.)
Paste it into it's own script page in the editor, just above main.
Game Over Common Event
by modern algebra
Requested by zzzdude, I figured I would post it in case anyone else wanted it. Instead of calling up the GameOver scene when you die in battle, it calls a common event you specify. This can be used for an epilogue, or any kind of evented Game Over cutscene. Bear in mind that you do have to call the Game Over screen at the end, or else arrange an alternate game over. You will need to set everything in the common event. The script does not do anything a regular Game Over scene does.
Paste it into it's own script page in the editor, just above main.
Stop Animation Actors
by modern algebra
Requested by Forcystus, this script allows you to set certain actors to have stop animation when they are the leader (thus on the game screen). Stop animation can be useful for flying units for instance, as it doesn't make any sense for them not to be flapping their wings at any time. It only effects the party member who is the leader. It has no influence on Caterpillar scripts.
A Little Module Addon
by Zeriab
Here's a litte addition to the module I have made ^^
You can use it like this:
attr_sec_accessor :method, default
It works pretty much like the
attr_accessor except that you can only do method creation per call.
method is the method name.
default is the default value the method returns. (If it has not been written to yet.)
An usage example:
class Foo
attr_sec_accessor :visible, false
attr_sec_accessor :data, 'Data_Foo.new'
end
This way you'll have that the default variable of visible is false.
If it is called before you write to the variable you will get 'false' rather than 'nil'
One thing to note is that lazy instantiation is used.
Let us assume that Data_Foo is a heavy object. It is only created if you try to read what the data attribute contains before you have written to it. More specifically. If the value of data attribute is nil then it is change to be what the default value is.
The code in the example is converted to this:
class Foo
def visible=(value)
@visible = value
end
def visible
@visible = false if @visible.nil?
@visible
end
def data=(value)
@data = value
end
def data
@data = Data_Foo.new if @data.nil?
@data
end
end
One thing to notice is that you must put '' around Data_Foo.new to make it a string. Otherwise you will get an error in almost all cases.
The greatest use will probably be if you want to add information to hidden classes. Let's for an example take RPG::Actor.
You can use its initialize method to set the default value by default because it won't be called automatically.
Other than that it will hopefully make the coder shorter and easier to understand.
Naturally. Only use this functionality where it is needed or where it can have a positive use
*hugs*
~ Zeriab