=begin
OZ Character Blend Control
==========================
Version 1.0
This script lets you change a character blend mode/type through comments.
Not only that but it also lets you set it to a current variable value.
So you can control several events at once!
Thanks to Derkias, because it was his idea, and I think it ended up pretty nice. :)
Usage: Put this in an event page comment command.
<pallete add> -> This sets the event blending mode to Add
<pallete sub> -> This sets the event blending mode to Substract
<pallete 2> -> This sets the event blending mode to whatever the variable 2 says (0: normal 1:add 2:sub). As safeguard, anything else will use normal.
=end
class Game_Character < Game_CharacterBase
attr_writer :pallete
def pallete
@pallete = nil if @pallete==nil
return @pallete
end
end
class Sprite_Character < Sprite_Base
alias oz_update_other update_other unless $@
def update_other
oz_update_other
# self.blend_type = @character.blend_type
# Change blend here
if @character.pallete != nil
case @character.pallete
when :add
self.blend_type = 1
when :sub
self.blend_type = 2
when Numeric
# Use a variable
v = $game_variables
v = 0 if v < 0 || v > 2
self.blend_type = v
else
self.blend_type = 0
end
end
end
end
class Game_Event < Game_Character
alias oz_clear_page_settings clear_page_settings unless $@
def clear_page_settings
oz_clear_page_settings
@pallete = nil
end
alias oz_setup_page_settings setup_page_settings unless $@
def setup_page_settings
oz_setup_page_settings
# Find all comments and find regex <pallete n>
@list.each {|command|
if (command.code == 108 || command.code == 408)
txt = command.parameters
txt.gsub(/\<(.+)\>/) {
case $1
when "add"
@pallete = :add
when "sub"
@pallete = :sub
else
@pallete = $1.to_i
end
}
end
}
end
end