08-11-2005, 01:00 PM
Steal / Peep script
By makeamidget and Khatharr
posted by Khatharr
Aug 11 2005
Well, it took us long enough, but here's to collaborative experience. yahoo.gif
First and foremostly, BACK UP YOUR PROJECT! It'll save us all a lot of grief.
Anyways, this is in two sections. Both are to be coped into new sections in the script editor. So make two new sections just above "Main" by right-clicking and selecting "Insert". The first section is for customizing the script, the second is the main body of the code.
Go into the database and create 2 new skills, being sure to write down or remember their ID numbers. (The number of the skill in the databse.)
One skill should be steal, and the other peep. Make sure to set them both to target "One Enemy" and make sure that the "Peep" skill (at least) has a "Target Animation" set.
Assign the skills to a player or players and then go back into the script editor.
In your first section paste the following:
And in the second section paste the following:
This post has been edited by Khatharr: Jul 16 2008, 11:41 PM
M___K__s_Steal_Script_Demo.rar (Size: 198.57 KB / Downloads: 1)
By makeamidget and Khatharr
posted by Khatharr
Aug 11 2005
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
No support is given. If you are the owner of the thread, please contact administration.
Well, it took us long enough, but here's to collaborative experience. yahoo.gif
First and foremostly, BACK UP YOUR PROJECT! It'll save us all a lot of grief.
Anyways, this is in two sections. Both are to be coped into new sections in the script editor. So make two new sections just above "Main" by right-clicking and selecting "Insert". The first section is for customizing the script, the second is the main body of the code.
Go into the database and create 2 new skills, being sure to write down or remember their ID numbers. (The number of the skill in the databse.)
One skill should be steal, and the other peep. Make sure to set them both to target "One Enemy" and make sure that the "Peep" skill (at least) has a "Target Animation" set.
Assign the skills to a player or players and then go back into the script editor.
In your first section paste the following:
Script part 1
Code:
#================================================
# Steal Script by makeamidget & Khatharr
#================================================
# Well, here we are. We made a script. It does stuff. If you HAVE to, well....
# I suppose we can let you use it. Just don't go thinkin' that we're generous or
# something, 'cuz.... Well, things could get messy....
# Anyway, if you screw this thing up, don't come cryin' to us, because for the most
# part, we haven't got a clue how the hell it works. We just wrote what the aliens
# told us to, so figure it out.
# In the meantime, I'd like to give a shout-out to Zoe Saldana, because I want to
# make babies with her, and also to Amy Lee, for the same reason.
# (Urggghhh... Choices....)
# I'd also be remiss if I didn't recognize the fine work of Solomon, when he said,
#
# Your two breasts are like two
# fawns,
# like twin fawns of a gazelle
# that browse among the lilies.
# (Song of Songs 4:5)
#
# Because I plan to use that line to get either Zoe or Amy to by my l-l-l-ladaaaay.
# Thanx you. Bye-bye.
#
# -Khat
#================================================
# In case you don't know us, we're both pretty new... and well... we decided to
# give this RGSS thing a whirl.. see what all the fuss was about and all that and for
# the most part we are largely unimpressed.. why anyone would want to do something
# like this is beyond us... i shall now try to think of a reason why... *thinking*... nope
# i'm just drawing a blank... and what Khatharr doesn't know is that Amy Lee has already
# been claimed by your's truly... as has Maggie Gyllenhaal.. she is an inspiration to us
# all.. and for those who aren't inspired by her.. they.. uh.. should be... anyway...
# uh enjoy this and stuff.. it's great and cool... or something.. i don't know.. i'm tired...
#
# Enjoy.. or not.. it's you're choice really...
#
# -Midge-
#================================================
# Back off my kool-aid, yo! -K
#================================================
#--------------------------------------------------------------------------
# First, set all these constants to your liking.
# They each come with an explanation.
#--------------------------------------------------------------------------
#This is what displays in the Peep window when the enemy is immune
PEEP_IMMUNE_DISPLAY = "-No Data Available... Ya peeper...-"
#This is the string that pops when an enemy is immune to peeping.
PEEP_IMMUNE_STRING = "Immune"
#This is the string that pops when an enemy is peeped successfully.
AFTER_PEEP_STRING = "Peeper!"
#This is the string that pops when a peep attempt fails.
PEEP_FAIL_STRING = "Failed to Peep"
#This is the string that pops when a steal attempt fails.
STEAL_FAIL_STRING = "You Missed! Chump!"
#This is the string that pops when you try to steal from an enemy with no item.
NO_ITEM_TO_STEAL_STRING = "No item to steal!"
#This is the string that pops when an enemy has a rare, but not a common item and you fail an attempt to steal.
FAILED_RARE_STEAL_STRING = "Being stingy!"
#This should be changed to the database ID# of your "steal" skill.
STEAL_SKILL_ID_NUM = 81
#This should be changed to the database ID# of your "peep" skill.
PEEP_SKILL_ID_NUM = 82
#This number controls how long (in frames) the steal window will display before auto-closing.
STEAL_WINDOW_DURATION = 65
#This is the main color used when an item name pops on a target.
ENEMY_POP_R = 255
ENEMY_POP_G = 255
ENEMY_POP_B = 255
#This is the main color used when an item name pops on the thief.
ACTOR_POP_R = 255
ACTOR_POP_G = 255
ACTOR_POP_B = 255
#This is the border color used when an item name pops on a target.
ENEMY_BPOP_R = 100
ENEMY_BPOP_G = 100
ENEMY_BPOP_B = 250
#This is the border color used when an item name pops on the thief.
ACTOR_BPOP_R = 100
ACTOR_BPOP_G = 250
ACTOR_BPOP_B = 100
#----------------------------------------------------------------------------
class Game_Enemy < Game_Battler
attr_accessor :peep_immune
#--------------------------------------------------------------------------
# This method returns the id# of the enemy's "common" item ID# or 0 if there isn't one.
# It can basically be configured however you want. For now it is a "case" statement.
# To associate an item with an enemy, you may simply un-comment and use the sample code
# That's already in place below.
# Just make it so that:
# case (enemy-id# from database)
# return (item-id# from the database)
# You can add as many of those as you like. The section that reads:
# else
# return 0
# Will make it so that any enemy not specified returns a 0 (no item to steal).
# This also can be changed as you wish. The "return 0" at the end handles what to return
# if this enemy was already stolen from. It too can be changed, if you like.
#--------------------------------------------------------------------------
def steal_item_id
unless @stolen
case @enemy_id
when 1 #<---- Enemy ID#
return 1 #<---- Item ID#
when 31
return 3
else
return 0 #<---- Unspecified enemy.
end
end
return 0 #<---- Already stolen.
end
#--------------------------------------------------------------------------
# This is the exact same thing as above, but for the enemy's "rare" item.
# Stealing a "common" item is about as hard as hitting with a normal attack,
# but stealing a "rare" item is about as hard as getting a critical hit.
# Any enemy can have both a rare and a common item, or one or the other,
# or neither. Remember that 0 means "no item".
#--------------------------------------------------------------------------
def steal_rare_id(drop_rare = false)
if @stolen_rare
if drop_rare
return steal_item_id
else
return 0
end
else
case @enemy_id
when 1 #<---- Enemy ID#
return 2 #<---- Item ID#
when 31
return 4
else
return 0 #<---- Unspecified enemy.
end
end
return 0 #<---- Already stolen.
end
end
#--------------------------------------------------------------------------
# Next, to customize the "Peep" command. You may want some enemies in your game
# To be immune to being peeped. If so, just push their ID#'s into this array.
# Some sample lines are present, and if they were un-commented, they would render
# enemies #1(the database ID#), #3, #5 and 31 immune to peeping. Immune enemies
# are still peeped, but no data is shown. Test it out to see how it looks.
# This array may be left blank if you like.
# Also, the ID numbers do not need to be in any particular order.
#--------------------------------------------------------------------------
def peep_immune?
#@peep_immune.push(31)
#@peep_immune.push(5)
#@peep_immune.push(1)
#@peep_immune.push(3)
end
And in the second section paste the following:
Script part 2
Code:
#==================================================
# -- OFFICIAL NON-MONKEYING SECTION --
# The crap in this section should not really be messed with unless you know what
# you're doing. I commented some of it, but large chucks of it I did not. So there.
# Anyhoo, below this comment lies the black, cold heart of the code.
# You can play around with it, but if you screw up something DOWN THERE, well....
# I for one will not be providing support for this beast unless a bug is found.
# So save us all a load of heart-ache and back-up your project before doing ANY script work, okay?
# We're all tired of seeing "I put a script and now RPG Maker don't start!"
# ...
# Back up your work!!!! That's what winrar is for!!!! Aieeeeeeeeeeeeeeeeee!!!!!
#==================================================
# I can't think of any reason why any of this would need to be modified.. so just save everyone
# the trouble of you creating problems that might need some help to fix.. and don't mess with it
# thank you, and yea! back up your work.. or else...!
#==================================================
class Game_Enemy < Game_Battler
def skill_effect(user, skill)
case skill.id
when STEAL_SKILL_ID_NUM
tempything = steal_attempt(user)
unless tempything == 0
$scene.steal_source = user.name
$scene.steal_target = self.name
return true
else
return false
end
when PEEP_SKILL_ID_NUM
super_squirrel = peep_attempt(user)
if super_squirrel
if self.peep_immune?.include?(self.id)
self.damage = PEEP_IMMUNE_STRING
$peep_miss = true
else
$peep_miss = false
end
$peep = self
return true
else
return false
end
else
return super(user, skill)
end
#P.S. - I know I'm generally the wierdo of the group, but I swear to you that "super_squirrel" is
#a makeamidget invention. I tend to stick to normal variable names, like "poop" and "butthole", etc.
#------------------------------------------------------------------------
# It's true... maybe... actually i can't remember.. but it is in one of my sections.. so it's probobly true
#(If you're the wierdo then what does that make me?) -Midge-
end
#--------------------------------------------------------------------------
# This mods the init a little to include some flags that determine
# whether the enemy's item is stolen or not. There's no need to mess with it.
#--------------------------------------------------------------------------
alias mk_steal_initialize initialize
def initialize(troop_id, member_index)
mk_steal_initialize(troop_id, member_index)
@stolen = (steal_item_id == 0) # If the enemy has a common item, it's marked as not stolen.
@stolen_rare = (steal_rare_id == 0) # If the enemy has a rare item, it's marked as not stolen.
@peep_immune = []
peep_immune
end
#--------------------------------------------------------------------------
# This bad boy decides whether or not an attempt to "peep" will
# succeed, and sets the 'damage' string that will pop on the target.
#--------------------------------------------------------------------------
def peep_attempt(user)
Input.update
if (rand(100) < (100 - (100 * [(self.mdef.to_f - user.agi.to_f), 0].max / (self.mdef.to_f + user.agi.to_f)).to_i))
self.damage = AFTER_PEEP_STRING
return true
else
self.damage = PEEP_FAIL_STRING
return false
end
end
#--------------------------------------------------------------------------
# This processes the steal attempt. The probability is based on the
# "attack" command. Rare items are stolen by "critical" hits.
# Note that attacker wants a high "dex" and defender wants a high "agi" and "eva".
#--------------------------------------------------------------------------
def steal_attempt(attacker)
if self.cant_evade? # If they can't evade, they fail to defend against the theft.
if (rand(100) < 4 * attacker.dex / self.agi) #"critical" checking
temporary = steal(true, attacker) #steal rare item
else
temporary = steal(false, attacker) #steal common item
end
return temporary
end
# This next line determines if the attack is accurate and if the enemy evades or not.
if (rand(100) < attacker.hit) and (rand(100) < (100 - (8 * self.agi / attacker.dex + self.eva)))
if (rand(100) < 4 * attacker.dex / self.agi) and (not @stolen_rare) #"critical" checking
temporary = steal(true, attacker) #steal rare item
else
temporary = steal(false, attacker) #steal common item
end
return temporary
end
self.damage = STEAL_FAIL_STRING
return 0
end
#--------------------------------------------------------------------------
# This one handles the actual theft, as far as giving the item, setting the flags, etc.
#--------------------------------------------------------------------------
def steal(rare, attacker)
$scene.steal_rare = rare #Ghetto pass! Woohah! (this ghetto pass brought to you in part by Khatharr
if rare
item_id = steal_rare_id(true)
$game_party.gain_item(item_id, 1) #If you're digging through this code in hopes of being clever,
@stolen_rare = true #You could start changing the item quantities here....
else
item_id = steal_item_id
$game_party.gain_item(item_id, 1)
@stolen = true
end
$scene.steal_item_id = item_id #Ghetto pass! Woohah! (he can't stop passin ghetto style)
if item_id == 0 #This part handles what to do if there's no item.
if @stolen_rare #"If the rare item exists and is not stolen."
self.damage = NO_ITEM_TO_STEAL_STRING
else
self.damage = FAILED_RARE_STEAL_STRING
end
return 0
else #This part sets the item name as the "damage" message.
self.damage = $data_items[item_id].name
self.steal_icon = $data_items[item_id].icon_name #save icon so that it can be displayed
attacker.damage = $data_items[item_id].name #added so the actor can have damage pop'ed too
attacker.steal_icon = $data_items[item_id].icon_name #actor icon...
if rare
self.damage = $data_items[item_id].name + " (rare)"
self.steal_icon = $data_items[item_id].icon_name #save icon so that it can be displayed
attacker.damage = $data_items[item_id].name + " (rare)" #added so the actor can have damage poped too
attacker.steal_icon = $data_items[item_id].icon_name #actor icon..
end
return self.damage
end
end
end
#--------------------------------------------------------------------------
class Scene_Battle
#These accessors are actually used by our ghetto-ass variable passing tech.
#(There's 2 of us, so it's a dual tech! Yay!)
#i don't recall makin any ghetto passes... -Midge-
#Most of them are set from outside the scene by using the syntax "$scene.variable = ???".
attr_accessor :steal_source #Who's stealin'?
attr_accessor :steal_target #Who's gettin' stole on?
attr_accessor :steal_rare #Is the item being stolen the target's "rare" item?
attr_accessor :steal_item_id #The item_id number of the item stolen.
attr_accessor :pop_done #Is the damage_pop routine in RPG::Sprite finished executing?
#--------------------------------------------------------------------------
alias mk_steal_main main
def main
#initialize the new variables
@steal_source = nil
@steal_target = nil
@steal_item_id = 0
@steal_rare = false
@pop_done = false
mk_steal_main #run the original "main"
unless @steal_window == nil
@steal_window.dispose #after "main" is done, dispose any steal window that may exist
end #unless @steal_window == nil
@steal_message = nil #I think I may have done these two lines purely for kicks.
@pop_done = nil
end #def main
#--------------------------------------------------------------------------
alias mk_steal_update update
def update
if @pop_done == true #If the damage_pop routine is finished
@pop_done = false #turn off the notifier
unless @steal_source == nil #check to see if someone got jacked and handle the window if they did
@steal_window = Window_Steal.new(@steal_source, @steal_item_id, @steal_target, @steal_rare)
@steal_source = nil #reset all the variables that were passed to the window
@steal_item_id = nil
@steal_target = nil
@steal_rare = false
end #unless @steal_source == nil
end #@pop_done == true
unless @steal_window == nil #if the steal window is showing...
if @steal_window.done #check to see if it's done
@steal_window.dispose #if it is, get rid of it
@steal_window = nil #and set it to 'nil'
else #if @steal_window.done
@steal_window.update #if it's not done, update the window
end #if @steal_window.done
else #unless @steal_window == nil
mk_steal_update #if the window is not showing, proceed with battle
end #unless @steal_window == nil
end #def update
#--------------------------------------------------------------------------
alias mk_steal_update_phase4_step5 update_phase4_step5
def update_phase4_step5
mk_steal_update_phase4_step5 #run the original method
if @active_battler.damage != nil && @active_battler.steal_icon != nil
#If the battler has a damage value(potentially an item name) and a value is set in the icon variable,
#"pop" the damage for the battler. This is basically so that the stealing party get's the item name popped.
@active_battler.damage_pop = true
end #if @active_battler.dam.....
end #def update_phase4_step5
#--------------------------------------------------------------------------
end # class Scene_Battle
class Window_Steal < Window_Base
attr_reader :done
def initialize(source, item_id, target, rare)
@done = false
item_name = $data_items[item_id].name
unless rare
#These two lines compose the common-item steal message. The icon appears between them.
string = source + " stole a "
string_b = " from " + target + "."
else
#These two lines compose the rare-item steal message. The icon appears between them.
string = source + " wrestled a "
string_b = " away from " + target + "."
end
super(0, 96, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = Font.default_name
self.contents.font.size = Font.default_size
self.width = self.contents.text_size(string + string_b + item_name).width + 64
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = Font.default_name
self.contents.font.size = Font.default_size
self.x = 320 - (self.width / 2)
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, self.width - 40, 32, string)
icon_x = self.contents.text_size(string).width
bitmap = RPG::Cache.icon($data_items[item_id].icon_name)
self.contents.blt(icon_x, 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.draw_text(self.contents.text_size(string).width + 23, 0, self.width - 40, 32, item_name + string_b)
self.back_opacity = 160
self.visible = true
@counter = STEAL_WINDOW_DURATION
end
def update
Input.update
Graphics.update
if Input.press?(Input::C)
@counter = 0
end
if @counter == 0
@done = true
else
@counter -= 1
end
end
def dispose
@done = nil
@counter = nil
self.contents.clear
super
end
end
class Game_Battler
attr_accessor :steal_icon #this exists solely to save the icon of the stolen item in... that and
alias mk_steal_initialize2 initialize
def initialize
mk_steal_initialize2
@steal_icon = nil
end
end
#--------------------------------------------------------------------------
# okay this is the amazing mod to the sprite class so that the icon and the battler type
# gets passed to it... also where the color changing for the steal poping is handled...
#--------------------------------------------------------------------------
module RPG
class Sprite < ::Sprite
def damage(value, critical, icon = nil, battler = nil)#added the info to send to determine where and what to pop
dispose_damage
if value.is_a?(Numeric)
damage_string = value.abs.to_s
else
damage_string = value.to_s
end
if icon == nil #if there is no icon(then that means nothing was stolen) buisiness is taken care of per normal...
bitmap = Bitmap.new(160, 48)
bitmap.font.name = "Arial Black"
bitmap.font.size = 32
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(-1, -1, 160, 36, damage_string, 1)
bitmap.draw_text(1, -1, 160, 36, damage_string, 1)
bitmap.draw_text(-1, +1, 160, 36, damage_string, 1)
bitmap.draw_text(1, +1, 160, 36, damage_string, 1)
if value.is_a?(Numeric) and value < 0
bitmap.font.color.set(176, 255, 144)
else
bitmap.font.color.set(255, 255, 255)
end
bitmap.draw_text(0, 0, 160, 36, damage_string, 1)
else #BUT.. if there is... then this crap happens...
bitmap = Bitmap.new(180, 48)
bitmap.font.name = "Arial Black"
bitmap.font.size = 32
#if the character is an Enemy then the color scheme is whatever you set up in the customize section
#this is the outline color by the way... if the character is a player character then it's the player section
if battler.is_a?(Game_Enemy)
bitmap.font.color.set(ENEMY_BPOP_R, ENEMY_BPOP_G, ENEMY_BPOP_B)
else
bitmap.font.color.set(ACTOR_BPOP_R, ACTOR_BPOP_G, ACTOR_BPOP_B)
end
iconbmp = RPG::Cache.icon(icon) #gets the actual icon for the poping
#the offset for the x value cause the damage is centered...
size = [((bitmap.text_size(damage_string).width / 2) + 5), 80].min
bitmap.blt(80 - size, 16, iconbmp, Rect.new(0,0,24,24))
bitmap.draw_text(19, 12-1, 160, 36, damage_string, 1) #these next for lines are making the outline of the
bitmap.draw_text(21, 12-1, 160, 36, damage_string, 1) #damage pop.. this is how the damage can have an outline
bitmap.draw_text(19, 12+1, 160, 36, damage_string, 1) #it's pretty spiffy if you ask me... (makeamidget)
bitmap.draw_text(21, 12+1, 160, 36, damage_string, 1)
#the next little section is the center color of the damage pop... (normaly the white middle part)
if battler.is_a?(Game_Enemy)
bitmap.font.color.set(ENEMY_POP_R, ENEMY_POP_G, ENEMY_POP_B)
else
bitmap.font.color.set(ACTOR_POP_R, ACTOR_POP_G, ACTOR_POP_B)
end
bitmap.draw_text(20, 12, 160, 36, damage_string, 1)
end
if critical
bitmap.font.size = 20
bitmap.font.color.set(0, 0, 0)
bitmap.draw_text(-1, -1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(+1, -1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(-1, +1, 160, 20, "CRITICAL", 1)
bitmap.draw_text(+1, +1, 160, 20, "CRITICAL", 1)
bitmap.font.color.set(255, 255, 255)
bitmap.draw_text(0, 0, 160, 20, "CRITICAL", 1)
end
@_damage_sprite = ::Sprite.new(self.viewport)
@_damage_sprite.bitmap = bitmap
@_damage_sprite.ox = 80
@_damage_sprite.oy = 20
@_damage_sprite.x = self.x
@_damage_sprite.y = self.y - self.oy / 2
@_damage_sprite.z = 3000
@_damage_duration = 40
end
def update_animation
if @_animation_duration > 0
frame_index = @_animation.frame_max - @_animation_duration
cell_data = @_animation.frames[frame_index].cell_data
position = @_animation.position
animation_set_sprites(@_animation_sprites, cell_data, position)
for timing in @_animation.timings
if timing.frame == frame_index
animation_process_timing(timing, @_animation_hit)
end
end
else
dispose_animation
if ($peep != nil) and (self.battler.is_a?(Game_Enemy))
@super_mario_rpg = WindowPeep.new($peep, $peep_miss)
$peep = nil
end
end
end
def update
super
if @_whiten_duration > 0
@_whiten_duration -= 1
self.color.alpha = 128 - (16 - @_whiten_duration) * 10
end
if @_appear_duration > 0
@_appear_duration -= 1
self.opacity = (16 - @_appear_duration) * 16
end
if @_escape_duration > 0
@_escape_duration -= 1
self.opacity = 256 - (32 - @_escape_duration) * 10
end
if @_collapse_duration > 0
@_collapse_duration -= 1
self.opacity = 256 - (48 - @_collapse_duration) * 6
end
if @_damage_duration > 0
@_damage_duration -= 1
case @_damage_duration
when 38..39
@_damage_sprite.y -= 4
when 36..37
@_damage_sprite.y -= 2
when 34..35
@_damage_sprite.y += 2
when 28..33
@_damage_sprite.y += 4
end
@_damage_sprite.opacity = 256 - (12 - @_damage_duration) * 32
if @_damage_duration == 0
$scene.pop_done = true
dispose_damage
end
end
if @_animation != nil and (Graphics.frame_count % 2 == 0)
@_animation_duration -= 1
update_animation
end
if @_loop_animation != nil and (Graphics.frame_count % 2 == 0)
update_loop_animation
@_loop_animation_index += 1
@_loop_animation_index %= @_loop_animation.frame_max
end
if @_blink
@_blink_count = (@_blink_count + 1) % 32
if @_blink_count < 16
alpha = (16 - @_blink_count) * 6
else
alpha = (@_blink_count - 16) * 6
end
self.color.set(255, 255, 255, alpha)
end
@@_animations.clear
end
end
end
class Sprite_Battler < RPG::Sprite
def update
super
if @battler == nil
self.bitmap = nil
loop_animation(nil)
return
end
if @battler.battler_name != @battler_name or
@battler.battler_hue != @battler_hue
@battler_name = @battler.battler_name
@battler_hue = @battler.battler_hue
self.bitmap = RPG::Cache.battler(@battler_name, @battler_hue)
@width = bitmap.width
@height = bitmap.height
self.ox = @width / 2
self.oy = @height
if @battler.dead? or @battler.hidden
self.opacity = 0
end
end
if @battler.damage == nil and
@battler.state_animation_id != @state_animation_id
@state_animation_id = @battler.state_animation_id
loop_animation($data_animations[@state_animation_id])
end
if @battler.is_a?(Game_Actor) and @battler_visible
if $game_temp.battle_main_phase
self.opacity += 3 if self.opacity < 255
else
self.opacity -= 3 if self.opacity > 207
end
end
if @battler.blink
blink_on
else
blink_off
end
unless @battler_visible
if not @battler.hidden and not @battler.dead? and
(@battler.damage == nil or @battler.damage_pop)
appear
@battler_visible = true
end
end
if @battler_visible
if @battler.hidden
$game_system.se_play($data_system.escape_se)
escape
@battler_visible = false
end
if @battler.white_flash
whiten
@battler.white_flash = false
end
if @battler.animation_id != 0
animation = $data_animations[@battler.animation_id]
animation(animation, @battler.animation_hit)
@battler.animation_id = 0
end
#the only mod in this section...
#it sends the icon and battler type to the modified damage section so that the icon can be popped..
#then sets both to nil.. so that they are all forgotten and stuff....
if @battler.damage_pop
damage(@battler.damage, @battler.critical, @battler.steal_icon, @battler)
@battler.damage = nil
@battler.critical = false
@battler.steal_icon = nil
@battler.damage_pop = false
end
if @battler.damage == nil and @battler.dead?
if @battler.is_a?(Game_Enemy)
$game_system.se_play($data_system.enemy_collapse_se)
else
$game_system.se_play($data_system.actor_collapse_se)
end
collapse
@battler_visible = false
end
end
self.x = @battler.screen_x
self.y = @battler.screen_y
self.z = @battler.screen_z
end
end
class WindowPeep < Window_Base
def initialize(enemy, immune = false)
super(120,32,400,262)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = Font.default_name # "Skill" status window font
self.contents.font.size = Font.default_size
self.z =9990
self.opacity=0
self.contents_opacity = 0
@enemy = enemy
refresh(immune)
end
def refresh(immune = false) #immune is wether or not the enemy is immune to the 'peep' skill
done = false #used to know when the shrinking of the sprite is done so that movement can begin
opacity = 0 #sets opacity to 0.. this will be used in the do loop in a minute...
text = ""
for i in @enemy.states #going through the statuses afflicted on the enemy
if $data_states[i].rating >= 1 #when the rating of the statusis above 1
if text == "" #and if there wasn't one prior to this status
text = $data_states[i].name #then text will = the name of the inflicted statuf
else #if there was a status inflicted already
text = text + "/" + $data_states[i].name #then the new status is added along with the previous statuses
end
end
end
if text == ""
text = "[Normal]" #no status is inflicted
else
text = "[" + text + "]" #adding the brackets to the statuses
end
if @enemy.steal_item_id == 0 #getting the info on the available items
common = "None" #when stolen or not possessing an item.. returns none
else
common = $data_items[@enemy.steal_item_id].name.to_s #otherwise it will return the name of the available item
end
if @enemy.steal_rare_id == 0
rare = "None" #when stolen or not possessing an item.. returns none
else
rare = $data_items[@enemy.steal_rare_id].name.to_s #otherwise it will return the name of the available item
end
if immune #if the enemy is immune to peeping then it will only display the name... and whatever the peep display constant contains
self.contents.draw_text(10,-18,400,50,"Name: " + @enemy.name.to_s)
self.contents.draw_text(0, self.height / 2,400-64,60, PEEP_IMMUNE_DISPLAY, 1)
else #otherwise all the available information for the enemy is displayed...
self.contents.draw_text(10,-18,400,50,"Name: " + @enemy.name.to_s)
self.contents.draw_text(10,12,400,50,$data_system.words.hp.to_s + ": " + @enemy.hp.to_s + " / " + @enemy.maxhp.to_s)
self.contents.draw_text(10,42,400,50,$data_system.words.sp.to_s + ": " + @enemy.sp.to_s + " / " + @enemy.maxsp.to_s)
self.contents.draw_text(10,72, 400, 50,"Exp: " + @enemy.exp.to_s)
self.contents.draw_text(10,102,400,50,$data_system.words.gold.to_s + ": " + @enemy.gold.to_s)
self.contents.draw_text(10, 132, 400, 50, "Current Status: " + text)
self.contents.draw_text(10,162,400,50,"Common Steal: " + common)
self.contents.draw_text(10,192,400,50,"Rare Steal: " + rare)
end
@sprite = Sprite.new #making the enemy sprite that i will be shrinking and moving from its current position...
@sprite.bitmap = RPG::Cache.battler(@enemy.battler_name, @enemy.battler_hue) #getting the battle sprite of the enemy
@sprite.x = (@enemy.screen_x - (@sprite.bitmap.width / 2)) #the wierd ass formula that determines where the sprite is
@sprite.y = (@enemy.screen_y - @sprite.bitmap.height) #on the screen...
@sprite.z = 9999
old_center_x = @sprite.bitmap.width / 2 #these are two variables that are set up so that i can center
old_center_y = @sprite.bitmap.height / 2 #zoom the battle sprite... it's cool looking...
thing = (400 - (@sprite.bitmap.width / 4)) #the stopping x position
div = 1 #the amount of zoom that the sprite is... uh... zoomed... this will be decreasing shortly
#ok.. the meat of the window... and where all the cool stuff takes place... it's really cool..
#i set up a loop so that the gameplay would pause.. except for what i wanted to happen...
loop do
Graphics.update #graphics update
Input.update #input update... so that the Input::C is always read...
if Input.trigger?(Input::C) #when C is pressed
dispose #the window is disposed and the rest of the battle is allowed to happen
break #stop the loop
end
if self.opacity < 255 #this is where the fade in occurs...
self.opacity = opacity #makes the back of the window = to opacity.. which was defined at the beginning of this method
self.contents_opacity = opacity #same thing as above.. except that it's for the contents of the window
unless opacity >= 255 #if opacity is less than 255 the 20 is added to it...
opacity += 20
end
end
if (@sprite.bitmap.width * div >= 200 or @sprite.bitmap.height * div >= 150) #if the sprite is too big.. then some shrinkin occurs
@sprite.zoom_x = div #remember div? well this is where it shrinks the sprite.. zoom_x is the zooming functions for sprites
@sprite.zoom_y = div #when it's over 1.. it will zoom in.. when its under 1 it will shrink.. that is what is happening in this case
div -= 0.01 #takes div lower so that it can shrink more... its goes 0.01 so that it is smooth
new_center_x = (@sprite.bitmap.width * div) / 2 #updating the center x so that i can find the difference in the x and y positions so that i can
new_center_y = (@sprite.bitmap.height * div) / 2 #move the x and y of the sprite to make it look like it's actually zooming inward
x_move = new_center_x - old_center_x #this is where it gets the x and y
y_move = new_center_y - old_center_y #to move the sprite down and right
old_center_x = new_center_x #makes the old_center_x the new_center_x also does the same with y
old_center_y = new_center_y #so that the whole process can be repeated during the next iteration of the loop
@sprite.x -= x_move.to_i #moves the sprite the amount of x that was shrunk because of div and zoom_x
@sprite.y -= y_move.to_i #same thing as the x
else #when the sprite is an acceptable size...
done = true #done is true and the movement can begin
end
unless done == false #if the shrinkig is finished...
xlen = @sprite.x - thing #the length of the x
ylen = @sprite.y - 40 #the length of the y
len = Math.hypot(xlen, ylen) # the squareroot of xlen^2 and ylen^2, which is the length of the line
len /= 5 #makes the length shorter.. so that it moves faster
line = []
line.push([@sprite.x, @sprite.y]) #push the starting points
for i in 1..len
#getting the points from the beggining to the end of the line
newx = @sprite.x - ((xlen / len) * i)
newy = @sprite.y - ((ylen / len) * i)
newx = newx.to_i
newy = newy.to_i
line.push([newx, newy])
end
line.uniq! #removing any duplicates
for i in 0...line.size
Graphics.update
givexy = line[i]
@sprite.x = givexy[0] #moving the sprite to it's new x and y along the line...
@sprite.y = givexy[1]
end
end
end
end
def dispose
@sprite.dispose
self.contents.dispose
super
end
end
This post has been edited by Khatharr: Jul 16 2008, 11:41 PM
M___K__s_Steal_Script_Demo.rar (Size: 198.57 KB / Downloads: 1)