Help - Search - Members - Calendar
Full Version: Emoticon on Event for RMXP
RPG RPG Revolution Forums > Scripting > Script Submissions > RGSS-Submissions
Nechi
Add this script before main script:

Ver. 2.0
CODE
#======================================================================
========
# Emoticon on Event for RMXP Ver. 2.0
#==============================================================================
# By Nechigawara Sanzenin
# Original VX Script by ŽEnterbrain
# WARNING!! : This script can use on RPG Maker XP Only!! (VX Not Support)
#==============================================================================
#Show Emo on event with easy control
#==============================================================================
#Version Log
#==============================================================================
#2.0 Add Emo name , Change Key Word , Move setting to module EMO
#==============================================================================
=begin

How to Use:
You will add "\Ei[Number Of Emoticon]" or "\En[Name Of Emoticon]" To Script
Control in "Set Move Route".

The Emoticon Picture is in "Graphics\Picture".
when the line number of emoticonset is 1 , Number of Emoticon is 1.
when the line number of emoticonset is 2 , Number of Emoticon is 2.

Row of emoticon are height 32 px
And width 256 px.
frame size is 32*32 px.

You will edit or add Emo name in module EMO.
You can set Emoticon's Picture Name at EMO_NAME.
You can set frame rate at BALLOON_WAIT.

=end
#==============================================================================
module EMO
#Setting
BALLOON_WAIT = 12
EMO_NAME = "Balloon"
#Name data
NAME = {
#Add Name And Number Here
"Surprise" => 1 ,
"Confusion" => 2 ,
"Musical" => 3 ,
"Love" => 4 ,
"Anger" => 5 ,
"Awkward" => 6 ,
"Crushed" => 7 ,
"Silence" => 8 ,
"Creative" => 9 ,
"Zzz" => 10 ,
#End
}
#Change Name to ID
def self.add_id(text)
if NAME.include?(text)
return NAME[text]
else
return 0
end
end
#--------------------------------------------------------------------------
end
#==============================================================================
class Game_Character
#--------------------------------------------------------------------------
attr_accessor :balloon_id
#--------------------------------------------------------------------------
alias inc_initialize initialize
def initialize
inc_initialize
@balloon_id = 0
end
#--------------------------------------------------------------------------
def move_type_custom
# If it is not in the midst of stopping, discontinuance
if jumping? or moving?
return
end
# Until the list of portable command it arrives lastly, the loop
while @move_route_index < @move_route.list.size
# Acquiring portable command
command = @move_route.list[@move_route_index]
# When the command cord/code 0th (list) is last
if command.code == 0
# Option [ repeats operation ] in case of ON
if @move_route.repeat
# The index of the portable route first is reset
@move_route_index = 0
end
# Option [ repeats operation ] in case of OFF
unless @move_route.repeat
# When it is in the midst of movement route forcing
if @move_route_forcing and not @move_route.repeat
# Cancelling forcing the portable route
@move_route_forcing = false
# Return original portable route
@move_route = @original_move_route
@move_route_index = @original_move_route_index
@original_move_route = nil
end
# Clearing stop count
@stop_count = 0
end
return
end
# Portable type command (it moves under? When jump) is
if command.code <= 14
# It diverges with the command cord/code
case command.code
when 1 # It moves down
move_down
when 2 # It moves left
move_left
when 3 # It moves right
move_right
when 4 # It moves up
move_up
when 5 # It moves left-down
move_lower_left
when 6 # It moves right-down
move_lower_right
when 7 # It moves left-up
move_upper_left
when 8 # It moves right-up
move_upper_right
when 9 # It moves random
move_random
when 10 # It moves toward player
move_toward_player
when 11 # It moves away form hero
move_away_from_player
when 12 # It moves forward
move_forward
when 13 # It moves backword
move_backward
when 14 # Jump
jump(command.parameters[0], command.parameters[1])
end
# Option [ when it cannot move, disregard ] with OFF, in case of the failure of movement
if not @move_route.skippable and not moving? and not jumping?
return
end
@move_route_index += 1
return
end
# In case of weight
if command.code == 15
# Setting weight count
@wait_count = command.parameters[0] * 2 - 1
@move_route_index += 1
return
end
# In case of command of direction modification type
if command.code >= 16 and command.code <= 26
# It diverges with the command cord/code
case command.code
when 16 # Face down
turn_down
when 17 # Face left
turn_left
when 18 # Face right
turn_right
when 19 # Face up
turn_up
when 20 # Turn 90 right
turn_right_90
when 21 # Turn 90 left
turn_left_90
when 22 # 180 Turn
turn_180
when 23 # Left-right 90 turn
turn_right_or_left_90
when 24 # Face random
turn_random
when 25 # Face to hero
turn_toward_player
when 26 # Face away from hero
turn_away_from_player
end
@move_route_index += 1
return
end
# In case of other commands
if command.code >= 27
# It diverges with the command cord/code
case command.code
when 27 # Switch ON
$game_switches[command.parameters[0]] = true
$game_map.need_refresh = true
when 28 # Switch OFF
$game_switches[command.parameters[0]] = false
$game_map.need_refresh = true
when 29 # Modification of drift speed
@move_speed = command.parameters[0]
when 30 # Modification of portable frequency
@move_frequency = command.parameters[0]
when 31 # When moving animation ON
@walk_anime = true
when 32 # When moving animation OFF
@walk_anime = false
when 33 # When stepping animation ON
@step_anime = true
when 34 # When stepping animation OFF
@step_anime = false
when 35 # Direction fixing ON
@direction_fix = true
when 36 # Direction fixing OFF
@direction_fix = false
when 37 # Through ON
@through = true
when 38 # Through OFF
@through = false
when 39 # Always on top ON
@always_on_top = true
when 40 # Always on top OFF
@always_on_top = false
when 41 # Graphic modification
@tile_id = 0
@character_name = command.parameters[0]
@character_hue = command.parameters[1]
if @original_direction != command.parameters[2]
@direction = command.parameters[2]
@original_direction = @direction
@prelock_direction = 0
end
if @original_pattern != command.parameters[3]
@pattern = command.parameters[3]
@original_pattern = @pattern
end
when 42 # Modification of opacity
@opacity = command.parameters[0]
when 43 # Modification of synthetic method
@blend_type = command.parameters[0]
when 44 # Play SE
$game_system.se_play(command.parameters[0])
when 45 # Script
script = command.parameters[0].clone
# Emoticon With Name Command
if (/\A\\[Ee]n\[(.+?)\]/.match(script)) != nil then
text = $1
@balloon_id = EMO.add_id(text)
script.gsub!(/\\[Ee]n\[(.+?)\]/) { "" }
end
# Emoticon With ID Command
if (/\A\\[Ee]i\[([0-9]+)\]/.match(script)) != nil then
id = $1.to_i
@balloon_id = id
script.gsub!(/\\[Ee]i\[([0-9]+)\]/) { "" }
end
# Clear Syntax
script.gsub!(/\\[Ee]n\[(.+?)\]/) { "" }
script.gsub!(/\\[Ee]i\[([0-9]+)\]/) { "" }
result = eval(script)
end
@move_route_index += 1
end
end
end
#--------------------------------------------------------------------------
end
#==============================================================================
class Sprite_Character < RPG::Sprite
#--------------------------------------------------------------------------
BALLOON_WAIT = EMO::BALLOON_WAIT
EMO_NAME = EMO:: EMO_NAME
#--------------------------------------------------------------------------
def initialize(viewport, character = nil)
super(viewport)
@character = character
@balloon_duration = 0
update
end
#--------------------------------------------------------------------------
alias inc_update update
def update
inc_update
# Update Balloon
update_balloon
# Check Balloon
if @character.balloon_id != 0
@balloon_id = @character.balloon_id
start_balloon
@character.balloon_id = 0
end
end
#--------------------------------------------------------------------------
def start_balloon
dispose_balloon
@balloon_duration = 8 * 8 + BALLOON_WAIT
@balloon_sprite = Sprite.new(viewport)
@balloon_sprite.bitmap = RPG::Cache.picture(EMO_NAME)
@balloon_sprite.ox = 16
@balloon_sprite.oy = 32
update_balloon
end
#--------------------------------------------------------------------------
def update_balloon
if @balloon_duration > 0
@balloon_duration -= 1
if @balloon_duration == 0
@balloon_id = 0
dispose_balloon
else
@balloon_sprite.x = x
if @tile_id >= 384
he = 32
else
he = self.bitmap.height/4
end
@balloon_sprite.y = y - he
@balloon_sprite.z = z + 200
if @balloon_duration < BALLOON_WAIT
sx = 7 * 32
else
sx = (7 - (@balloon_duration - BALLOON_WAIT) / 8) * 32
end
sy = (@balloon_id - 1) * 32
@balloon_sprite.src_rect.set(sx, sy, 32, 32)
end
end
end
#--------------------------------------------------------------------------
def dispose_balloon
if @balloon_sprite != nil
@balloon_sprite.dispose
@balloon_sprite = nil
end
end
#--------------------------------------------------------------------------
end
#==============================================================================


Ver. 1.0
CODE
#======================================================================
========
# Emoticon on Event for RMXP
#------------------------------------------------------------------------------
# By Nechigawara Sanzenin
# Original VX Script by ŽEnterbrain
# WARNING!! : This script can use on RPG Maker XP Only!! (VX Not Support)
#==============================================================================
=begin
How to Usw :
Add "\E[Number Of Emoticon]" To Script Control in "Set Move Route"
The Emoticon Picture is in "Graphics\Picture".
when the line number of emoticonset is 1 , Number of Emoticon is 1.
when the line number of emoticonset is 2 , Number of Emoticon is 2.
Max of Number of Emoticon is 10.
You can set Emoticon's Picture Name at EMO_NAME.
You can set frame rate at BALLOON_WAIT.
=end
#==============================================================================
class Game_Character
#--------------------------------------------------------------------------
attr_accessor :balloon_id
#--------------------------------------------------------------------------
alias inc_initialize initialize
def initialize
inc_initialize
@balloon_id = 0
end
#--------------------------------------------------------------------------
def move_type_custom
# If it is not in the midst of stopping, discontinuance
if jumping? or moving?
return
end
# Until the list of portable command it arrives lastly, the loop
while @move_route_index < @move_route.list.size
# Acquiring portable command
command = @move_route.list[@move_route_index]
# When the command cord/code 0th (list) is last
if command.code == 0
# Option [ repeats operation ] in case of ON
if @move_route.repeat
# The index of the portable route first is reset
@move_route_index = 0
end
# Option [ repeats operation ] in case of OFF
unless @move_route.repeat
# When it is in the midst of movement route forcing
if @move_route_forcing and not @move_route.repeat
# Cancelling forcing the portable route
@move_route_forcing = false
# Return original portable route
@move_route = @original_move_route
@move_route_index = @original_move_route_index
@original_move_route = nil
end
# Clearing stop count
@stop_count = 0
end
return
end
# Portable type command (it moves under? When jump) is
if command.code <= 14
# It diverges with the command cord/code
case command.code
when 1 # It moves down
move_down
when 2 # It moves left
move_left
when 3 # It moves right
move_right
when 4 # It moves up
move_up
when 5 # It moves left-down
move_lower_left
when 6 # It moves right-down
move_lower_right
when 7 # It moves left-up
move_upper_left
when 8 # It moves right-up
move_upper_right
when 9 # It moves random
move_random
when 10 # It moves toward player
move_toward_player
when 11 # It moves away form hero
move_away_from_player
when 12 # It moves forward
move_forward
when 13 # It moves backword
move_backward
when 14 # Jump
jump(command.parameters[0], command.parameters[1])
end
# Option [ when it cannot move, disregard ] with OFF, in case of the failure of movement
if not @move_route.skippable and not moving? and not jumping?
return
end
@move_route_index += 1
return
end
# In case of weight
if command.code == 15
# Setting weight count
@wait_count = command.parameters[0] * 2 - 1
@move_route_index += 1
return
end
# In case of command of direction modification type
if command.code >= 16 and command.code <= 26
# It diverges with the command cord/code
case command.code
when 16 # Face down
turn_down
when 17 # Face left
turn_left
when 18 # Face right
turn_right
when 19 # Face up
turn_up
when 20 # Turn 90 right
turn_right_90
when 21 # Turn 90 left
turn_left_90
when 22 # 180 Turn
turn_180
when 23 # Left-right 90 turn
turn_right_or_left_90
when 24 # Face random
turn_random
when 25 # Face to hero
turn_toward_player
when 26 # Face away from hero
turn_away_from_player
end
@move_route_index += 1
return
end
# In case of other commands
if command.code >= 27
# It diverges with the command cord/code
case command.code
when 27 # Switch ON
$game_switches[command.parameters[0]] = true
$game_map.need_refresh = true
when 28 # Switch OFF
$game_switches[command.parameters[0]] = false
$game_map.need_refresh = true
when 29 # Modification of drift speed
@move_speed = command.parameters[0]
when 30 # Modification of portable frequency
@move_frequency = command.parameters[0]
when 31 # When moving animation ON
@walk_anime = true
when 32 # When moving animation OFF
@walk_anime = false
when 33 # When stepping animation ON
@step_anime = true
when 34 # When stepping animation OFF
@step_anime = false
when 35 # Direction fixing ON
@direction_fix = true
when 36 # Direction fixing OFF
@direction_fix = false
when 37 # Through ON
@through = true
when 38 # Through OFF
@through = false
when 39 # Always on top ON
@always_on_top = true
when 40 # Always on top OFF
@always_on_top = false
when 41 # Graphic modification
@tile_id = 0
@character_name = command.parameters[0]
@character_hue = command.parameters[1]
if @original_direction != command.parameters[2]
@direction = command.parameters[2]
@original_direction = @direction
@prelock_direction = 0
end
if @original_pattern != command.parameters[3]
@pattern = command.parameters[3]
@original_pattern = @pattern
end
when 42 # Modification of opacity
@opacity = command.parameters[0]
when 43 # Modification of synthetic method
@blend_type = command.parameters[0]
when 44 # Play SE
$game_system.se_play(command.parameters[0])
when 45 # Script
script = command.parameters[0].clone
if (/\A\\[Ee]\[([0-9]+)\]/.match(script)) != nil then
id = $1.to_i
@balloon_id = id
script.gsub!(/\\[Ee]\[([0-9]+)\]/) { "" }
end
result = eval(script)
end
@move_route_index += 1
end
end
end
#--------------------------------------------------------------------------
end
#==============================================================================
class Sprite_Character < RPG::Sprite
#--------------------------------------------------------------------------
BALLOON_WAIT = 12
EMO_NAME = "Balloon"
#--------------------------------------------------------------------------
def initialize(viewport, character = nil)
super(viewport)
@character = character
@balloon_duration = 0
update
end
#--------------------------------------------------------------------------
alias inc_update update
def update
inc_update
# Update Balloon
update_balloon
# Check Balloon
if @character.balloon_id != 0
@balloon_id = @character.balloon_id
start_balloon
@character.balloon_id = 0
end
end
#--------------------------------------------------------------------------
def start_balloon
dispose_balloon
@balloon_duration = 8 * 8 + BALLOON_WAIT
@balloon_sprite = Sprite.new(viewport)
@balloon_sprite.bitmap = RPG::Cache.picture(EMO_NAME)
@balloon_sprite.ox = 16
@balloon_sprite.oy = 32
update_balloon
end
#--------------------------------------------------------------------------
def update_balloon
if @balloon_duration > 0
@balloon_duration -= 1
if @balloon_duration == 0
@balloon_id = 0
dispose_balloon
else
@balloon_sprite.x = x
if @tile_id >= 384
he = 32
else
he = self.bitmap.height/4
end
@balloon_sprite.y = y - he
@balloon_sprite.z = z + 200
if @balloon_duration < BALLOON_WAIT
sx = 7 * 32
else
sx = (7 - (@balloon_duration - BALLOON_WAIT) / 8) * 32
end
sy = (@balloon_id - 1) * 32
@balloon_sprite.src_rect.set(sx, sy, 32, 32)
end
end
end
#--------------------------------------------------------------------------
def dispose_balloon
if @balloon_sprite != nil
@balloon_sprite.dispose
@balloon_sprite = nil
end
end
#--------------------------------------------------------------------------
end
#==============================================================================


How to Use (2.0):

You will add "\Ei[Number Of Emoticon]" or "\En[Name Of Emoticon]" To Script
Control in "Set Move Route".

The Emoticon Picture is in "Graphics\Picture".
when the line number of emoticonset is 1 , Number of Emoticon is 1.
when the line number of emoticonset is 2 , Number of Emoticon is 2.

Row of emoticon are height 32 px
And width 256 px.
frame size is 32*32 px.

You will edit or add Emo name in module EMO.
You can set Emoticon's Picture Name at EMO_NAME.
You can set frame rate at BALLOON_WAIT.

***How to Use for ver. 1.0 is include in script.

Version Log :
#2.0 Add Emo name , Change Key Word , Move setting to module EMO

Example of Emoticon Picture


Screen Shot :


Demo Ver. 2.0 : http://www.mediafire.com/?fmsmbk4jiny
Demo Ver. 1.0 : http://www.mediafire.com/?8bmlkid4kvb
vath
Yay! thanks, Nechi!.
*i like this script. you'll be credited into my current project. wink.gif
ChaosMaxima
Awesome script, but I got some good suggestions.

1. You should allow us to name emotions. Hence, instead of "\E[Number Of Emoticon]", it should be "\E[Name Of Emoticon]". It's a lot easier to remember names than numbers. thumbsup.gif

2. Allow a string of images for certain emotions. Something like:
emotion[1] = ["Emote1.png", "Emote2.png"]

That'd help if we need animated emotions or such.


Apart from that, it's a great script. I'll be using this for sure!
Nechi
QUOTE (ChaosMaxima @ Feb 21 2008, 06:57 AM) *
Awesome script, but I got some good suggestions.

1. You should allow us to name emotions. Hence, instead of "\E[Number Of Emoticon]", it should be "\E[Name Of Emoticon]". It's a lot easier to remember names than numbers. thumbsup.gif

2. Allow a string of images for certain emotions. Something like:
emotion[1] = ["Emote1.png", "Emote2.png"]

That'd help if we need animated emotions or such.


Apart from that, it's a great script. I'll be using this for sure!

I Port This option from RMVX (It's use number in script.)
I will edit this for next version.
Thanks for advise,ChaosMaxima-kun.
ChaosMaxima
Either way, it's better to specify it by its name. Since it isn't in the message, there's really no need to make it small. (if it was in the message, people would have been worried about cluttering up their messages). I'd prefer long names, as numbers are hard to remember.

Call me Chaos, btw. =D
mumerus
I get an error when using this script.


Script 'Emoticon on Event' line 262: NoMehodError occurred
undefined method '-' for nil:NilClass

Is there a way to fix this?
woratana
Can you give me script line 262 from your game?
Nechi
Version 2.0 has been release .
Please download that at the first post.

QUOTE (mumerus @ Feb 21 2008, 04:02 PM) *
I get an error when using this script.


Script 'Emoticon on Event' line 262: NoMehodError occurred
undefined method '-' for nil:NilClass

Is there a way to fix this?

Please show script line 262 from your game. and tell me what scripts are you use in your game?
I will help you when i know a problem.
mumerus
Oh sorry, heres the line that you requested. The error is in the emoticon script


sx = 7 * 32
else
sx = (7 - (@balloon_duration - BALLOON_WAIT) / 8) * 32
end
-> sy = (@balloon_id - 1) * 32
@balloon_sprite.src_rect.set(sx, sy, 32, 32)
end
end
end
woratana
That's plenty of script =[]@!

Is there other script that use this variable?
CODE
@balloon_id


Search it by press 'Shift+Ctrl+F' smile.gif

*Off-topic*
CODE
Hima's multi monster drop (useless)

I'm glad you use that smile.gif Hima is really good scripter! (no offense to other scripters tongue.gif)
mumerus
Nope, no other script uses that, only this one, how can I change it. Just to be sure that no other scripts are going to touch it?


*Off-topic*
That script doesnt work very well, after the end of the battle, there doesnt seem to be mutliple drops D:
woratana
I tried demo version 2 and it works fine smile.gif

Are you using version 2?
mumerus
Err.. cant download the ver 2.0 demo, but I tried using the ver 2.0 script, same error.

Can someone make this into a animation instead? Since the script isnt working for me? ;_;
Blizzard
Isn't it like way easier to make a simple animation than overcomplicate with a script...? (-_-') Here's a demo with an animation. And if you don't like how it gets a bit when pixelated growing, simply make an animation set with balloons that were sized up in Photoshop.

http://www.sendspace.com/file/w222rq

EDIT:

5 minutes, that's how long it took me to make this demo. How much did you spent on making the script?
mumerus
Why did I just lol'ed on that demo...?

Anyways, thanks alot Blizzard, cant believe that took you 5 minutes.
woratana
Ah, that's the way we use when RM2K don't have script tongue.gif

I think this script will be useful when using emoticon image from VX (If there's one that looks good enough smile.gif )
or when I'm too lazy to make animation.

Anyway, I do agree with you, Blizzard. Thx for demo~ laugh.gif

p.s. I'm afraid I've scripted the one that is no one need. ToT
Nechi
QUOTE (Blizzard @ Feb 23 2008, 06:56 AM) *
5 minutes, that's how long it took me to make this demo. How much did you spent on making the script?

I spend more time to making this script.
But , I have learn the manything from this work.^^
Blizzard
Yeah, that's good. The knowledge how to add a subsprite can be pretty useful. smile.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.