I have less time and interest so i release scripts ideas that other scripters may terminate.
Improved Show Pictures Command
This script idea was to have these habilities:
-Lock the picture
-Make a fog/panorama continuos movement for pictures
-The option to set the z of game pictures through a depth atribute, so you can set it an a plenty of key locations: under chipset, under characters, under fog, up messages.
I also pots my learnins to solve this:
Z values
-WinMsg 9998
-WinInputNum 9999
Per sobre de msg: 10000
@viewport2.z = 200
@viewport3.z = 5000
-Event always on top 999
# Make panorama plane
@panorama = Plane.new(@viewport1)
@panorama.z = -1000
# Make fog plane
@fog = Plane.new(@viewport1)
@fog.z = 3000
The problem here is viewports. The z in viewports seems to be used to differentiate between the objects that used that viewport, so, if you give it a z = 10000 it wont work because these z only makes to show on the top of its viewport.
Note that the key class is spriteset map. I have modified well the sprite picutr, i think.
Then to make this scripts you have to know about viewports and modify that system. I also dont know if viewports give some other beneficits so you will have to create your mdified version.
Finally, i think this is a very good idea. It will be nice that somebody terminates this. Also, my code use some Anonymous Scripters code so if you take it give it credits too,xDDDDDDDDDDDDDD.
#==============================================================================
# ** Game_Picture
#------------------------------------------------------------------------------
# This class handles the picture. It's used within the Game_Screen class
# ($game_screen).
#==============================================================================
class Game_Picture
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :anchor # rotation angle
attr_accessor :depth
#--------------------------------------------------------------------------
# * Alias Methods
#--------------------------------------------------------------------------
alias glitch_anchor_pic_game_picture_initialize initialize
#--------------------------------------------------------------------------
# * Object Initialization
# number : picture number
#--------------------------------------------------------------------------
def initialize(number)
@anchor = false
@depth = 0
glitch_anchor_pic_game_picture_initialize(number)
end
def set_depth (code)
if code == :under_chipset
elsif code == :under_fog
elsif code == :above_message
end
end
end
#==============================================================================
# ** Sprite_Picture
#------------------------------------------------------------------------------
# This sprite is used to display the picture.It observes the Game_Character
# class and automatically changes sprite conditions.
#==============================================================================
class Sprite_Picture < Sprite
#--------------------------------------------------------------------------
# * Alias Methods
#--------------------------------------------------------------------------
alias glitch_anchor_pic_sprite_picture_update update
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
glitch_anchor_pic_sprite_picture_update
if @picture.anchor == true
self.ox = $game_map.display_x / 4
self.oy = $game_map.display_y / 4
end
self.z = @picture.depth
end
end
#==============================================================================
# ** Interpreter (part 1)
#------------------------------------------------------------------------------
# This interpreter runs event commands. This class is used within the
# Game_System class and the Game_Event class.
#==============================================================================
class Interpreter
def pic_depth(num, code)
$game_screen.pictures[num].set_depth(code)
end
end
Improved key input command
The idea was to make a command like 2003 one, and also, whatever you think in adding to it for eventers. So:
-A wait for trigger key option.
-Selection the valids keys for each key input command.
This is the code i already created, the idea was to have a defined
array of default keys to use in all input calls, and then that you can modify this list in two ways:
-new: creates a totally new set of temporal keys used for that call
-add: add keys to the default list
example:
def_used_keys('add', ['z', 'x', 'up'].
-special mark 'all'. These key mark makes that all are used in a temporal or default context.
Using this you may have the more basic actived, and then add someone if you need.
class Interpreter
alias wep_interpreter_init initialize
def initialize(depth = 0, main = false)
@key_wait = false # control internal way
@used_keys = Wep::Default_used_keys.split # list of used keys setted with default
@type = 0 # it saves the type of input
wep_interpreter_init
end
#--------------------------------------------------------------------------
# * Button Input
#--------------------------------------------------------------------------
def input_button
# Determine pressed button
n = 0
for i in 1..18
if Input.trigger?(i) and @used_keys.include?(Input.trigger?(i))
n = i
end
end
# If button was pressed
if n > 0
# Change value of variables
$game_variables[@button_input_variable_id] = n
$game_map.need_refresh = true
# End button input
@button_input_variable_id = 0
# Reset values
if @type == 1 or @type == 2
@used_keys.clear
@used_keys=Wep::Default_used_keys
@type = 0
end
end
end
#--------------------------------------------------------------------------
# * Button Input Processing
#--------------------------------------------------------------------------
def command_105
# Set variable ID for button input
@button_input_variable_id = @parameters[0]
# Advance index
@index += 1
# End
return false
end
#--------------------------------------------------------------------------
# * Def Used Keys
#--------------------------------------------------------------------------
def def_used_keys(type='add', keys)
# Check for type
if type == 'add'
@used_keys+=keys
@type = 1
elsif type == 'new'
@used_keys=keys
@type = 2
end
end
#--------------------------------------------------------------------------
# * Is Used Key?
# determine if a key is used
#--------------------------------------------------------------------------
def is_used_key?(num)
# If used keys have a all mark, allways true
if @used_keys.include?('all')
return true
end
# If not, search for it
for key in @used_keys
return true if convert_user_key(key) == num
end
# Return false if not valid
return false
end
#--------------------------------------------------------------------------
# * Convert user key
# this method have to be used to make convertion key-Input constants
#--------------------------------------------------------------------------
def convert_user_key(key)
case key
when 'a'; return Input::A
when 'b'; return Input::B
when 'c'; return Input::C
end
end
def wait_key
end
end
module Wep
Default_used_keys = ('a', 'b', 'c')
end
Note that will be better to use symbols here because they are easy to type and process and this is not using really the text in strings.
Script command language
The ideas to try to create some sort of scripting 'language' for the call script command that maks the things more easy and quick. For that i planned to use:
-Use of sortcuts to the game information
-Use of event commands with scripts
-Create new functions for this system
We can make everything, and its very quick to do. Here a example:
def cure_all
for actor in $game_party.actors
actor.recover_all
end
end
This is the easy way of doing it.
def cure(id=0)
if id == 0
for actor in $game_party.actors
actor.recover_all
end
else
$game_actors[id].recover_all
end
end
I think that knowing that all database ids start with 1, will be nice to treat a 0 like a "for all". And maybe make this the default values.
Also i think that will be nice to make that each method have a shorter one:
cure- c o cu
cure_all -cu_a
def gold=(value)
$game_party.gold += value
end
def gold
return $game_party.gold
end
Maybe when setting variables values we can make that a value of 0 sets it to 0. If not, to reduce the gold to 0 you have to call gold=-99999.
Another idea is if the use of = in method names is correct or not. Its more slow,that for sure.
A example call script.
gold=500 # This add 500 gold
(a 1).name = 'Wilfred' # (a 1) is like $game_actors[1]
for a in actors # actors is an alias of $game_party.actors
a.hp+=20
end
get_number(1) # This is like a input number command.
In the same way that cure and cure all:
def hp_mod(hp, id=0)
if id == 0
for actor in $game_party.actors
actor+=hp
end
else
$game_actors[id]+=hp
end
end
That can be aliased like mhp or hp. The problem here may be if you want
to make that trully all actors get the bonus. Maybe make that with a id=-1?
Also a nice idea for ids arguments will be to be arrays...
Note that idea was attacked because it lacked new things and was poorly readable. Anyway adding a save support for example, is not hard using my improved save as a basis.
Also i think the readibility things matter when someones wants to read what you have created. Who in the hells reads in a full game for normal events like how you have shown a message or something? thats stupid to do and care.
In 2k/2k3 the people looked for events to understand engines. But in everydary eventing readability dont matters for me. I was planning to finnish this but for now i couldnt.
The topic was here:
http://www.arpgmaker.com/viewtopic.php?f=155&t=72548
class Interpreter
def gold=(value)
$game_party.gold += value
end
def gold
return $game_party.gold
end
def g(value)
$game_party.gold += value
end
def vg
return $game_party.gold
end
def actor(id)
return $game_actors[id]
end
def a(id)
return $game_actors[id]
end
def actors
return $game_actors.party.actors
end
def as(id)
return $game_actors.party.actors
end
def steps
return $game_actors.party.steps
end
def st
return $game_actors.party.steps
end
def cure_all
for actor in $game_party.actors
actor.recover_all
end
end
def cure(id=0)
if id == 0
for actor in $game_party.actors
actor.recover_all
end
else
$game_actors[id].recover_all
end
end
def variable(id)
return $game_variables[id]
end
def v(id)
return $game_variables[id]
end
def switch(id)
return $game_switches[id]
end
def sw(id)
return $game_switches[id]
end
def get_number(variable, digits=2)
@parameters[0] = variable
@parameters[1] = digits
command_103
end
def gnum(variable, digits=2)
@parameters[0] = variable
@parameters[1] = digits
command_103
end
def wait(frames)
@wait_count = frames * 2
command_106
end
def hp_mod(hp, id=0)
if id == 0
for actor in $game_party.actors
actor+=hp
end
else
$game_actors[id]+=hp
end
end
end
class Game_Party
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :actors # actors
attr_accessor :gold # amount of gold
attr_reader :steps # number of steps
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Create actor array
@actors = []
# Initialize amount of gold and steps
@gold = 0
@steps = 0
# Create amount in possession hash for items, weapons, and armor
@items = {}
@weapons = {}
@armors = {}
end
end
Note that i didnt plan to support all comands. There are things for the events are far better.