07-03-2005, 01:00 PM
Star Ocean Chests!
by Jimmie
Jul 3 2005
Yep! Items appear out of a chest and bounce once. The player cannot move during this time.
!!!!!UPDATED!!!!!!
It can jump in four different ways and items don't bounce totally off-screen
Credits to DubeAlex for delay script and Enix for a great game!
Anyways, here's the script once more:
The call script is:
You may have to break it up, like write the text on a different line or so, if it's too long.:
You can have as many or as few x,y and v as you want, but it must be the same amount.
by Jimmie
Jul 3 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.
Yep! Items appear out of a chest and bounce once. The player cannot move during this time.
!!!!!UPDATED!!!!!!
It can jump in four different ways and items don't bounce totally off-screen
Credits to DubeAlex for delay script and Enix for a great game!
Anyways, here's the script once more:
Content Hidden
Code:
class SOchest
def initialize(type,index,event,number,text)
$type=type
$index=index
$number=number
$treasure_window=Window_Treasure.new(text)
for i in 0...type.size#do this once for every item
$i=i
@frames=0#reset the animation
@dir=rand(4)#choose what bounce animation to use
$pic = Sprite.new#define the sprite
$pic.zoom_y=0.1#make it flat at the start
case type[i]#dependin on what item type it is
when 0#useable item
$pic.bitmap=RPG::Cache.icon($data_items[index[i]].icon_name)#choose an icon for
$game_party.gain_item(index[i],number[i])#add the item
when 1#weapon
$pic.bitmap=RPG::Cache.icon($data_weapons[index[i]].icon_name)#choose an icon for
$game_party.gain_weapon(index[i],number[i])#add the weapon
when 2#armor
$pic.bitmap=RPG::Cache.icon($data_armors[index[i]].icon_name)#choose an icon for
$game_party.gain_armor(index[i],number[i])#add the armor
end
Audio.se_play("Audio/SE/" + "056-Right02", 50, 100)#play soound effect
$pic.x=$game_map.events[event].real_x/4-$game_map.display_x/4 +5#set the x position of the sprite
$pic.y=$game_map.events[event].real_y/4-$game_map.display_y/4 +15#set the y position
@dir = rand(2)+2 if $pic.x<40#if it's near the left edge make it jump right
@dir = rand(2) if $pic.x>575#if it's near the right edge make it jump left
update#call the update function(start the animation)
end
end
def update#animation
delay(1)#wait one hundredth of a second each time
case @dir#which animation will be used
when 0#first animation, long left jump
if @frames<5#first 0.05 seconds
$pic.zoom_y+=0.2#increase the height of the picture
$pic.y-=4#move it upwards
$pic.x-=2#move it left
@frames+=1#next animation step
update#play the animation again
elsif @frames < 10#next 0.05 seconds
$pic.zoom_x+=0.05#increase the pics width
$pic.zoom_y-=0.05#decrease the height
$pic.y-=2#move it up
$pic.x-=4#move it left
@frames+=1#next step
update#play animation
elsif @frames < 15#next 0.05 seconds
$pic.y+=2#move down
$pic.x-=4#move left
@frames+=1#next step
update#animation
elsif @frames < 20#next 0.05 seconds
$pic.zoom_x-=0.05#decrease width
$pic.zoom_y+=0.05#increase height
$pic.y+=6#move down
$pic.x-=2#move left
@frames+=1#next step
update#animation
elsif @frames < 30#next 0.1 seconds
$pic.opacity-=10#make the picture a bit more transparent
$pic.y-=2#move it up(bounce starts)
$pic.x-=1#move left
@frames+=1#next step
update#animation
elsif @frames < 33#next 0.03 seconds
$pic.opacity-=10#make the picture a bit more transparent
$pic.y+=2#move it down
$pic.x-=1#move it left
@frames+=1#next step
update#animation
elsif @frames < 35#next 0.02 seconds
$pic.opacity-=10#make the picture a bit more transparent
@frames+=1#next step
update#animation
elsif @frames==35#last 0.01 seconds
$pic.opacity-=255/20#make the picture a bit more transparent
@frames+=1#next step(end animatoin)
$pic.dispose#delete the picture
end
when 2#long jump right
#Everything is basically the same as before, the only thing that changes form here on out is
#the +/- signs and the values of how muck it is moved
#you should know how to fix this...
if @frames<5
$pic.zoom_y+=0.2
$pic.y-=4
$pic.x+=2
@frames+=1
update
elsif @frames < 10
$pic.zoom_x+=0.05
$pic.zoom_y-=0.05
$pic.y-=2
$pic.x+=4
@frames+=1
update
elsif @frames < 15
$pic.y+=2
$pic.x+=4
@frames+=1
update
elsif @frames < 20
$pic.zoom_x-=0.05
$pic.zoom_y+=0.05
$pic.y+=4
$pic.x+=2
@frames+=1
update
elsif @frames < 30
$pic.opacity-=10
$pic.y-=2
$pic.x+=1
@frames+=1
update
elsif @frames < 33
$pic.opacity-=10
$pic.y+=2
$pic.x+=1
@frames+=1
update
elsif @frames < 35
$pic.opacity-=20
@frames+=1
update
elsif @frames==35
$pic.opacity-=255/20
@frames+=1
$pic.dispose
end
when 1#short jump left
if @frames<5
$pic.zoom_y+=0.2
$pic.y-=4
$pic.x-=1
@frames+=1
update
elsif @frames < 10
$pic.zoom_x+=0.05
$pic.zoom_y-=0.05
$pic.y-=2
$pic.x-=2
@frames+=1
update
elsif @frames < 15
$pic.y+=2
$pic.x-=2
@frames+=1
update
elsif @frames < 20
$pic.zoom_x-=0.05
$pic.zoom_y+=0.05
$pic.y+=4
$pic.x-=1
@frames+=1
update
elsif @frames < 30
$pic.opacity-=10
$pic.y-=2
$pic.x-=1
@frames+=1
update
elsif @frames < 33
$pic.opacity-=10
$pic.y+=2
$pic.x-=1
@frames+=1
update
elsif @frames < 35
$pic.opacity-=20
@frames+=1
update
elsif @frames==35
$pic.opacity-=255/20
@frames+=1
$pic.dispose
end
when 3#short jump right
if @frames<5
$pic.zoom_y+=0.2
$pic.y-=4
$pic.x+=1
@frames+=1
update
elsif @frames < 10
$pic.zoom_x+=0.05
$pic.zoom_y-=0.05
$pic.y-=2
$pic.x+=2
@frames+=1
update
elsif @frames < 15
$pic.y+=2
$pic.x+=2
@frames+=1
update
elsif @frames < 20
$pic.zoom_x-=0.05
$pic.zoom_y+=0.05
$pic.y+=7
$pic.x+=1
@frames+=1
update
elsif @frames < 30
$pic.opacity-=10
$pic.y-=2
$pic.x+=1
@frames+=1
update
elsif @frames < 33
$pic.opacity-=10
$pic.y+=2
$pic.x+=1
@frames+=1
update
elsif @frames < 35
$pic.opacity-=20
$pic.zoom_y=1
$pic.zoom_x=1
@frames+=1
update
elsif @frames==35
$pic.opacity-=255/20
@frames+=1
$pic.dispose
end
end
end
def delay(time)
for i in 0...(time)
sleep 0.01
Graphics.update
end
end
end
class Window_Treasure <Window_Base
def initialize(text)
super(20,0,600,64)
self.contents=Bitmap.new(600-32,32)
self.contents.font.name = $defaultfonttype
self.contents.font.size = $defaultfontsize
self.contents.draw_text(4,0,560,32,text,1)
$ij=0
end
end
class Scene_Map
def update
loop do
if $treasure_window!=nil
if $ij <20
sleep 0.01
$ij+=1
elsif $ij <84
sleep 0.01
$ij+=1
$treasure_window.y-=1
$treasure_window.opacity-=5
else
$treasure_window.dispose
$treasure_window=nil
end
end
$game_map.update
$game_system.map_interpreter.update
$game_player.update
$game_system.update
$game_screen.update
unless $game_temp.player_transferring
break
end
transfer_player
if $game_temp.transition_processing
break
end
end
@spriteset.update
@message_window.update
if $game_temp.gameover
$scene = Scene_Gameover.new
return
end
if $game_temp.to_title
$scene = Scene_Title.new
return
end
if $game_temp.transition_processing
$game_temp.transition_processing = false
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
if $game_temp.message_window_showing
return
end
if $game_player.encounter_count == 0 and $game_map.encounter_list != []
unless $game_system.map_interpreter.running? or
$game_system.encounter_disabled
n = rand($game_map.encounter_list.size)
troop_id = $game_map.encounter_list[n]
if $data_troops[troop_id] != nil
$game_temp.battle_calling = true
$game_temp.battle_troop_id = troop_id
$game_temp.battle_can_escape = true
$game_temp.battle_can_lose = false
$game_temp.battle_proc = nil
end
end
end
if Input.trigger?(Input::B)
unless $game_system.map_interpreter.running? or
$game_system.menu_disabled
$game_temp.menu_calling = true
$game_temp.menu_beep = true
end
end
if $DEBUG and Input.press?(Input::F9)
$game_temp.debug_calling = true
end
unless $game_player.moving?
if $game_temp.battle_calling
call_battle
elsif $game_temp.shop_calling
call_shop
elsif $game_temp.name_calling
call_name
elsif $game_temp.menu_calling
call_menu
elsif $game_temp.save_calling
call_save
elsif $game_temp.debug_calling
call_debug
end
end
end
end
The call script is:
Code:
SOchest.new([x1,x2...],[y1...],z,[v1...],"text")
x=0 for item, 1 for weapon, 2 for armor, as an array
y=items indew in database, starts at 1,as an array
z=chests event number
v=number of items to add, as an array
text=text to print in window.
You may have to break it up, like write the text on a different line or so, if it's too long.:
Code:
description = "text"
SOchest.new([x1,x2...],[y1...],z,[v1...],description)
You can have as many or as few x,y and v as you want, but it must be the same amount.