LOGIN
SEARCH
PROFILE
keys: ↑ ↓
LOGOUT
INDEX
MEMBERS
keys: ↑ ↓
HOME
PORTAL
PLAY ALONG
PLAY with WORDS
PLAY with GRAPHICS
PLAY with SOUNDS
PLAY with CODES
PLAY with PROJECTS
keys: ← →
Guest Access
Register:
Members:



View previous topic View next topic Go down Message [Page 1 of 1]

EVENTALIST
EVENTALIST
#1 XAS - Respawn Timer
Loading

mr_wiggles

avatar
EVENTALIST
 EVENTALIST
EVENTALIST
profile
XAS - Respawn Timer
Version: 3.0
Author: Mr Wiggles
Date: November 3, 2011

Version History




  • Version 3.0 11/3/11 - New System.
  • Version 2.5 7/1/10 - Fixed some minor bugs
  • Version 2.2 6/27/10 - Cleaned code up. Added new installation instructions.
  • version 2.0 6/25/10 - Updated script to work with both the new and old versions of XAS (3.6 and 3.7)
  • Version 1.3 6/11/10 - Removed dependency on self variables script. Added new feature, never re-spawn.
  • Version 1.0 4/19/10 - Original Release


Planned Future Versions


  • Maybe more features, like individual re-spawn times depending on enemy id.


Description


Makes the enemies in XAS re-spawn after a set time instead of after a map change, or make the the enemies never re-spawn.

Features

  • Enemies can be tagged so that they will never re-spawn
  • Set the time it takes to re-spawn
  • Lag prevention by limiting updates
  • Can set the re-spawn time for item enemies like crates and such as well.



Instructions
Paste this script in your script data base above your add on scripts but bellow XAS System scripts (in the add on section). Set up the the constants in the script header.

script



Code:

#===============================================================================
#                      XAS - Respawn Timer
#-------------------------------------------------------------------------------
# By, Mr_Wiggles
# Version 3.0
# 11/3/11
#-------------------------------------------------------------------------------
# Directions -
#  Paste script in the data base above main and below all of XAS System
#  Scripts. Then fill in the constants bellow.
#
#  To make an enemy never respawn, make a comment on the first page of the
#  enemy event that says: (case sensitive)
#  NEVER_RESPAWN
#
module Respawn_Settings
#===============================================================================
#                          ** EDIT AREA **
#===============================================================================
# Any value bellow set to -1 will never respawn.
#-------------------------------------------------------------------------------
# Respawn template...
#            when (id of enemy)
#              return (number of seconds)
def Respawn_Settings.enemy_time(id)
  case id
  when 2 # When the enemy id is this
    return 15 # return this number of seconds
  when 6
    return 50
  else # Other wise return the default respawn time
    return 20 # number of seconds for the default time
  end
end
#-------------------------------------------------------------------------------
# Number of seconds until an item Enemy will respawn
ITEM_RESPAWN_TIME = 30
#===============================================================================
#                          ** END EDIT **
#===============================================================================
end

#===============================================================================
class Game_Event < Game_Character
  alias respawn_init initialize
  def initialize(*args)
    respawn_init(*args)
    @never_respawn = false
    unless @page.nil?
      for i in @page.list
        if (i.code == 108 or i.code == 408) and
            i.parameters[0].upcase[/NEVER_RESPAWN/] != nil
          @never_respawn = true
        end
      end
    end
    mid = $game_map.map_id
    key = [mid, @id]
    return if $game_respawns.empty?(key)
    if $game_respawns.dead?(key)
      self.opacity = 0
      self.erase
      $game_map.need_refresh = true
    end
  end
 
  alias respawn_update update
  def update
    respawn_update
    return if self.battler.nil? or !self.battler.is_a?(Game_Enemy)
    mid = $game_map.map_id
    key = [mid, @id]
    return if $game_respawns.dead?(key)
    if self.battler.hp <= 0
      if @never_respawn
        respawn = -1
      elsif XAS_BA_ENEMY::ITEM_ENEMY.include?(self.battler.id)
        respawn = Respawn_Settings::ITEM_RESPAWN_TIME
      else
        respawn = Respawn_Settings.enemy_time(self.battler.id)
      end
      $game_respawns.respawn(key, respawn)
      print("Dead and added id #{key.join(', ')} = #{respawn}")
    end
  end
end

#===============================================================================
class Scene_Map 
  alias :abs_spawn_up :update
  def update
    $game_respawns.update_spawns
    abs_spawn_up
  end
end

#===============================================================================
class Respawn_Hash
  def initialize
    @data = {}
    @spawn_wait = 0
  end
 
  def respawn(key, value)
    @data[key] = value
  end
 
  def dead?(key)
    time = @data[key].nil? ? 0 : @data[key]
    return (time != 0)
  end
 
  def update_spawns
    @spawn_wait -= 1
    return if @spawn_wait > 0
    @data.each{|key, value|
      respawn = value.nil? ? 0 : value
      respawn -= 1 if respawn > 0
      @data[key] = respawn
    }
    @spawn_wait = 40
  end
 
  def remove(key)
    @data.delete(key)
  end
 
  def empty?(key)
    return @data[key].nil?
  end
end

#==============================================================================
class Scene_Title
  alias :resp_main :main
  def main
    $game_respawns = Respawn_Hash.new
    resp_main
  end
end

#==============================================================================
class Scene_Save < Scene_File
  alias :resp_save :write_save_data
  def write_save_data(file)
    resp_save(file)
    Marshal.dump($game_respawns, file)
  end
end

#==============================================================================
class Scene_Load < Scene_File
  alias :resp_save :read_save_data
  def read_save_data(file)
    resp_save(file)
    $game_respawns = Marshal.load(file)
  end
end
[You must be registered and logged in to see this link.]

Support


Post any problems you may encounter, or a suggestion for a future update here in this topic.

Known Compatibility Issues
This script will not work with SDK.

Restrictions
DO not post this any where with out my permission, you are free to edit in any way you see fit, but i must be credited some place.
EVENTALIST
Show Signature
EVENTALIST
WORDSMITH
WORDSMITH
#2 Re: XAS - Respawn Timer
Loading

Cardboard Square

avatar
WORDSMITH
WORDSMITH
profile
This is great! I should have been using this program all along. It's funny, a lot of the scripts you post are things I've had to event myself with RM2K.
WORDSMITH
Show Signature
WORDSMITH
Administrator
Administrator
#3 Re: XAS - Respawn Timer
Loading

G@MeF@Ce

avatar
Administrator
Administrator
Administrator
profile
@wiggles- man this kix @$$! more control as to how the enemy re-spawns?
I'm using this. Other than your XAS difficulties script, this makes for another enemy twist. Thanks for sharing!!!

(G@/\/\(e|F/A\(C|=
Administrator
Show Signature
Administrator
https://www.dropbox.com/sh/i47rig99qhrvn8s/4m5HvsM2fD http://g4m3f4c3.deviantart.com https://www.facebook.com//pages/Gameface101/332331300127008 https://twitter.com//mr_gameface101 https://soundcloud.com/schurr http://www.youtube.com/user/MrGameface101?feature=watch
EVENTALIST
EVENTALIST
#4 Re: XAS - Respawn Timer
Loading

mr_wiggles

avatar
EVENTALIST
 EVENTALIST
EVENTALIST
profile
I guess im script happy... lol

this was one of 2 i wrote in one night. The other made the weapon damage the skill's power, and i can directly effect the weapons damage so i can make it do more damage depending on the players skill with that type of weapon.
EVENTALIST
Show Signature
EVENTALIST
EVENTALIST
EVENTALIST
#5 Re: XAS - Respawn Timer
Loading

mr_wiggles

avatar
EVENTALIST
 EVENTALIST
EVENTALIST
profile
i'm going to make this script more of a stand alone after i finish with a requested update.
EVENTALIST
Show Signature
EVENTALIST
EVENTALIST
EVENTALIST
#6 Re: XAS - Respawn Timer
Loading

mr_wiggles

avatar
EVENTALIST
 EVENTALIST
EVENTALIST
profile
*updated*
EVENTALIST
Show Signature
EVENTALIST
ACTIVATED
ACTIVATED
#7 Re: XAS - Respawn Timer
Loading

rpg-dutch

ACTIVATED
ACTIVATED
ACTIVATED
profile
I don't understand I created a new script field and pasted the script under the XAS System and I get a message saying...

Line 63 NoMethodError Occured
Undefined Method 'push' for nil:NilClass

Please help this script sounds like what I've been after all this time
ACTIVATED
Show Signature
ACTIVATED
EVENTALIST
EVENTALIST
#8 Re: XAS - Respawn Timer
Loading

mr_wiggles

avatar
EVENTALIST
 EVENTALIST
EVENTALIST
profile
How are you using the script? i can't replicate this error, and if i can't replicate it i can't fix.
can you give more details?
What other scripts are you using?
Is this script above or bellow those?
EVENTALIST
Show Signature
EVENTALIST
ACTIVATED
ACTIVATED
#9 Re: XAS - Respawn Timer
Loading

rpg-dutch

ACTIVATED
ACTIVATED
ACTIVATED
profile
I use a few different add-ons see below.

Spoiler:
#===============================================================================
# Check_Time, By Leon_Westbrooke
#-------------------------------------------------------------------------------
# Details:
# Will automatically change the tint of maps that it is called on based on
# the computer's internal clock.
#
# Instructions:
# Place script above main, but below other default scripts.
# On each map you want the tint set by this script, make an event as follows:
# [Parallel Process Event]
# Turn on switch 3
# Loop
# script... Check_Time.new
# Wait 1 frame
# End Loop
#
# Notes:
# You must set a switch to change this parallel process if you wish to change
# the tint of the screen on that map.
#
#===============================================================================
class Check_Time
def initialize
@time_stamp = Time.new
if $game_switches[246] == false
if @time_stamp.strftime("%H").to_i < 6 or @time_stamp.strftime("%H").to_i > 20
red = -100
green = -100
blue = -90
$game_screen.start_tone_change(Tone.new(red, green, blue, 20), 120)
elsif @time_stamp.strftime("%H").to_i > 5 and @time_stamp.strftime("%H").to_i < 9
red = -60
green = -42
blue = -60
$game_screen.start_tone_change(Tone.new(red, green, blue, 15), 120)
elsif @time_stamp.strftime("%H").to_i > 8 and @time_stamp.strftime("%H").to_i < 18
red = 0
green = 0
blue = 0
$game_screen.start_tone_change(Tone.new(red, green, blue, 0), 120)
elsif @time_stamp.strftime("%H").to_i >17 and @time_stamp.strftime("%H").to_i < 21
red = -40
green = -60
blue = -60
$game_screen.start_tone_change(Tone.new(red, green, blue, 15), 120)
end
else
if @time_stamp.strftime("%H").to_i < 6 or @time_stamp.strftime("%H").to_i > 20
red = -100
green = -100
blue = -90
$game_screen.start_tone_change(Tone.new(red, green, blue, 20), 0)
$game_switches[246] = false
elsif @time_stamp.strftime("%H").to_i > 5 and @time_stamp.strftime("%H").to_i < 9
red = -60
green = -42
blue = -60
$game_screen.start_tone_change(Tone.new(red, green, blue, 15), 0)
$game_switches[246] = false
elsif @time_stamp.strftime("%H").to_i > 8 and @time_stamp.strftime("%H").to_i < 18
red = 0
green = 0
blue = 0
$game_screen.start_tone_change(Tone.new(red, green, blue, 0), 0)
$game_switches[246] = false
elsif @time_stamp.strftime("%H").to_i >17 and @time_stamp.strftime("%H").to_i < 21
red = -42
green = -60
blue = -60
$game_screen.start_tone_change(Tone.new(red, green, blue, 15), 0)
$game_switches[246] = false
end
end
end
end


Spoiler:
#==============================================================================#
# Quest Log script
# By: game_guy
# Date: May 31st, 2009
# Version: 1.6
#==============================================================================#
=begin
Intro:
This script allows you to have a quest system. A bit more overcomplicated than
most quest scripts but still easy to configure I hope.

The quests are items which allowed me to knock off a bunch of lines of code.
Easy to setup (I hope)

Instructions:
Ok so how do you setup quests? Thats easy just follow the steps.
1: First make an Item in the database. For example call it Goblin Raid
2: Set the description to the quest description. Example:
Kill all the goblins before they attack.
3: Come in the script and go to CONFIG REWARD and follow the steps there
4: Now go to CONFIG LOCATION and follow the steps there
You're done SETTING up a quest.

Ok so then how do I add a quest to the quest log?
Use this in a script call
$quest.gain_quest(item_id)
Remember that the quests are items

Ok so then how do I mark them as complete?
Use this in a script call
$game_items[the item id here].completed = true

So heres an example:
$quest.gain_quest(32) This will give the player the item #32 which acts as a quest
Then say he completes it use this
$game_items[32].completed = "Complete"

Oh and to see if a quest has even been accepted use this in a conditional branch

$quest.quest(item id) > 0

See the demo to see how everything is setuo.

Hopefully these arent confusing instructions...
=end
module RPG
class Item
def reward
case id
#==========================
# CONFIG REWARD NOTE THIS DOES NOT GIVE THE PLAYER A REWARD IT JUST
# GIVES THE script INFO ON THE QUEST
#==========================
# Use this
# when item_id then return "Reward here"
when 32 then return "Batman?"
when 32 then return "300 Gold"
# END CONFIG REWARD
end
return "Nothing"
end
def location
case id
#==========================
# CONFIG LOCATION
#==========================
# Use this
#when item_id then return "Location Here"
when 24 then return "Lynnia"
when 32 then return "Lynnia"
#END CONFIG LOCATION
end
return "Nowhere"
end
def completed
return false
end
end
end
class Game_Item
attr_accessor :completed
def initialize(actor_id)
super()
setup(actor_id)
end
def setup(actor_id)
actor = $data_items[actor_id]
@completed = false
end
end
class Game_Items
def initialize
@data = []
end
def [](actor_id)
if actor_id > 999 or $data_items[actor_id] == nil
return nil
end
if @data[actor_id] == nil
@data[actor_id] = Game_Item.new(actor_id)
end
return @data[actor_id]
end
end
class Quests
def initialize
@items = {}
end
def quest(item_id)
return @items.include?(item_id) ? @items[item_id] : 0
end
def gain_quest(item_id)
if item_id > 0
@items[item_id] = [[quest(item_id) + 1, 0].max, 99].min
end
end
def lose_quest(item_id)
gain_item(item_id, -1)
end
end
class Window_Quest < Window_Selectable
def initialize
super(0, 64, 320, 416)
@column_max = 1
refresh
self.index = 0
end
def item
return @data[self.index]
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in 1...$data_items.size
if $quest.quest(i) > 0
@data.push($data_items[i])
end
end
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
end
def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $quest.quest(item.id)
end
self.contents.font.color = normal_color
x = 4 + index % 1 * (288 + 32)
y = index / 1 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(item.icon_name)
if $game_items[item.id].completed
self.contents.font.color = crisis_color
else
self.contents.font.color = normal_color
end
#opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), 255)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
end
def update_help
@help_window.set_text(self.item == nil ? "" : "Press the action key to view Quest Info.")
end
end
class Window_QuestInfo < Window_Base
def initialize(name, info, location, reward, completed)
super(0, 64, 640, 416)
self.contents = Bitmap.new(width - 32, height - 32)
@name = name
@info = info
self.z = 200
@location = location
@reward = reward
@completed = completed
refresh
end
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 300, 32, "Quest")
self.contents.draw_text(4, 64, 300, 32, "Description")
self.contents.draw_text(4, 128, 300, 32, "Location")
self.contents.draw_text(4, 192, 300, 32, "Reward")
self.contents.draw_text(4, 256, 300, 32, "Status")
self.contents.font.color = normal_color
self.contents.draw_text(4, 32, 300, 32, @name)
self.contents.draw_text(4, 96, 300, 32, @info)
self.contents.draw_text(4, 160, 300, 32, @location)
self.contents.draw_text(4, 224, 300, 32, @reward)
if @completed == true
self.contents.font.color = crisis_color
self.contents.draw_text(4, 288, 300, 32, "Completed")
else
self.contents.font.color = normal_color
self.contents.draw_text(4, 288, 300, 32, "Not Finished")
end

end
end
class Scene_Quest
def main
@quest = Window_Quest.new
@help_window = Window_Help.new
@quest.help_window = @help_window
@map = Spriteset_Map.new
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@map.dispose
@quest.dispose
@questinfo.dispose if @questinfo != nil
@help_window.dispose
end
def update
@quest.update
@questinfo.update if @questinfo != nil
@help_window.update
if @quest.active
update_quest
end
if @questinfo != nil and @questinfo.active
update_questinfo
end
end
def update_quest
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
if @quest.item == nil
$game_system.se_play($data_system.buzzer_se)
return
else
$game_system.se_play($data_system.decision_se)
@quest.active = false
@help_window.set_text("Press the cancel key to back out.")
@questinfo = Window_QuestInfo.new(@quest.item.name, @quest.item.description, @quest.item.location, @quest.item.reward, $game_items[@quest.item.id].completed)
@questinfo.active = true
end
end
def update_questinfo
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@help_window.set_text("Press the action key to view Quest Info.")
@quest.active = true
@questinfo.visible = false
@questinfo.active = false
end
end
end
end
class Scene_Save < Scene_File
alias quest_save_later write_save_data
def write_save_data(file)
quest_save_later(file)
Marshal.dump($quest, file)
Marshal.dump($game_items, file)
end
end
class Scene_Title
alias load_quest_later command_new_game
def command_new_game
$quest = Quests.new
$game_items = Game_Items.new
load_quest_later
end
end
class Scene_Load < Scene_File
alias quest_load_later read_save_data
def read_save_data(file)
quest_load_later(file)
$quest = Marshal.load(file)
$game_items = Marshal.load(file)
end
end

Spoiler:
#===================================================
# ■ Ring Menu - Show Player Location - Release #1 (Enhanced By Dubealex)
#===================================================
# For more infos and update, visit:
# asylum.dubealex.com
#
# Original Ring Menu by: 和希 (From XRXS)
# Original Edit and Fix by: Maki
# Show Player Location Version by: Dubealex
#
# You can customize this script at line #35 - Have fun !!
# If you want to show more stuff, its easy to do, you can try to ask in the forum.
#
# [You must be registered and logged in to see this link.]
#===================================================


#===================================================
# ▼ CLASS Scene_Menu Begins
#===================================================

class Scene_Menu
#--------------------------------------------------------------------------
# پ? ?I?u?W?F?N?gڈ?????
# menu_index : ?R?}???h??Jپ[?\??ڈ?????u
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
$location_text=[]
$window_size=[]
$ring_menu_text=[]
$chara_select=[]
@window_opacity=[]
@chara_select=[]
@window_position=[]

#--------------------------------------------------------------------------------------------------
# ■ Ring Menu Customization Section: (By Dubealex)
#--------------------------------------------------------------------------------------------------
# Those variables defines how the script will act.
# Simply change the value by those you want.
# Remember that changing the font size has its limitation due to text space allocation.
#
# ▼ TEXT SETTINGS FOR SHOW PLAYER LOCATION WINDOW:
$location_text[0]="Tahoma" # Font Type
$location_text[1]=22 # Font Size
$location_text[2]=6 # Location Title Color
$location_text[4]=0 # Map Name Color
$location_text[3]="Location:" # Customize the "Location" Title Text

# ▼ SHOW LOCATION WINDOW SETTINS:
@show_location_window=true #Set to false to not use it !
@window_opacity[0]=255 # Border Opacity
@window_opacity[1]=130 # Background Opacity
$window_location_skin="001-Blue01" # Window Skin
@window_position[0]=20 # X Axis Position
@window_position[1]=20 # Y Axis Position
$window_size[0]=160 # Lengh
$window_size[1]=96 # Heigh

# ▼ TEXT SETTINGS FOR INSIDE THE RING MENU:
$ring_menu_text[0]="Tahoma" # Font Type
$ring_menu_text[11]=0 # Font Color
$ring_menu_text[10]=22 # Font Size
$ring_menu_text[1]="Items" # Items Menu Text
$ring_menu_text[2]="Skills" # Skills Menu Text
$ring_menu_text[3]="Equip" # Equip Menu Text
$ring_menu_text[4]="Stats" # Stats Menu Text
$ring_menu_text[5]="Quests" # Quests
$ring_menu_text[6]="Main" # Main
$ring_menu_text[7]="Save" # Save Menu Text
$ring_menu_text[8]="Quit" # Quit Menu Text

# ▼ CHARACTER SELECTION WINDOW SETTINGS :
@chara_select[0]=400 # X Axis Position
@chara_select[1]=0 # Y Axis Position
$chara_select[0]="Tahoma" # Font Type
$chara_select[1]=0 # Font Color
$chara_select[5]=22 # Font Size
$chara_select[2]=255 # Window Border Opacity
$chara_select[3]=130 # Window Background Opacity
$chara_select[4]="001-Blue01" # Window Skin to use
#--------------------------------------------------------------------------------------------------

end
#--------------------------------------------------------------------------
# پ? ?پ?C??ڈ??
#--------------------------------------------------------------------------
def main

# Show Player Location Feature:
if @show_location_window==true
@window_location = Window_Location.new
@window_location.x = @window_position[0]
@window_location.y = @window_position[1]
@window_location.opacity = @window_opacity[0]
@window_location.back_opacity = @window_opacity[1]
end
#End of Show Player Location

# ?X?v???C?g?Z?b?g??چ? ?
@spriteset = Spriteset_Map.new
# ?R?}???h?E?B???h?E??چ? ?
px = $game_player.screen_x - 15
py = $game_player.screen_y - 24
@command_window = Window_RingMenu.new(px,py)
@command_window.index = @menu_index
# ?pپ[?e?B l ??? 0 l??ڈ?چ?
if $game_party.actors.size == 0
# ?A?C?e??پA?X?L??پA????پA?X?eپ[?^?X????????
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
@command_window.z = 100
# ?Zپ[?u??~??ڈ?چ?
if $game_system.save_disabled
# ?Zپ[?u???????????
@command_window.disable_item(4)
end
# ?X?eپ[?^?X?E?B???h?E??چ? ?
@status_window = Window_RingMenuStatus.new
@status_window.x = @chara_select[0]
@status_window.y = @chara_select[1]
@status_window.z = 200
@status_window.opacity=$chara_select[2]
@status_window.back_opacity=$chara_select[3]
@status_window.visible = false
# ?g?????W?V??????چs
Graphics.transition
# ?پ?C????پ[?v
loop do
# ?Qپ[???????چX V
Graphics.update
# ????ڈ?????چX V
Input.update
# ?t??پ[??چX V
update
# ????? ???????????پ[?v?????f
if $scene != self
break
end
end
# ?g?????W?V????ڈ???
Graphics.freeze
# ?X?v???C?g?Z?b?g??????
@spriteset.dispose
# ?E?B???h?E??????
if @show_location_window==true
@window_location.dispose
end
@command_window.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
# پ? ?t??پ[??چX V
#--------------------------------------------------------------------------
def update
# ?E?B???h?E??چX V
if @show_location_window==true
@window_location.update
end
@command_window.update
@status_window.update
# ?R?}???h?E?B???h?E???A?N?e?B?u??ڈ?چ?: update_command ?????
if @command_window.active
update_command
return
end
# ?X?eپ[?^?X?E?B???h?E???A?N?e?B?u??ڈ?چ?: update_status ?????
if @status_window.active
update_status
return
end
end
#--------------------------------------------------------------------------
# پ? ?t??پ[??چX V (?R?}???h?E?B???h?E???A?N?e?B?u??ڈ?چ?)
#--------------------------------------------------------------------------
def update_command
# B ?{?^??????????ڈ?چ?
if Input.trigger?(Input::B)
# ?L?????Z?? SE ?????t
$game_system.se_play($data_system.cancel_se)
# ?}?b?v????? ?????
$scene = Scene_Map.new
return
end
# C ?{?^??????????ڈ?چ?
if Input.trigger?(Input::C)
# ?pپ[?e?B l ??? 0 l??پA?Zپ[?uپA?Qپ[??ڈI????O??R?}???h??ڈ?چ?
if $game_party.actors.size == 0 and @command_window.index < 4
# ?u?Uپ[ SE ?????t
$game_system.se_play($data_system.buzzer_se)
return
end
# ?R?}???h?E?B???h?E??Jپ[?\????u?????
case @command_window.index
when 0 # ?A?C?e??
# ???? SE ?????t
$game_system.se_play($data_system.decision_se)
# ?A?C?e??????? ?????
$scene = Scene_Item.new
when 1 # ?X?L??
# ???? SE ?????t
$game_system.se_play($data_system.decision_se)
# ?X?eپ[?^?X?E?B???h?E???A?N?e?B?u?????
@command_window.active = false
@status_window.active = true
@status_window.visible = true
@status_window.index = 0
when 2 # ????
# ???? SE ?????t
$game_system.se_play($data_system.decision_se)
# ?X?eپ[?^?X?E?B???h?E???A?N?e?B?u?????
@command_window.active = false
@status_window.active = true
@status_window.visible = true
@status_window.index = 0
when 3 # ?X?eپ[?^?X
# ???? SE ?????t
$game_system.se_play($data_system.decision_se)
# ?X?eپ[?^?X?E?B???h?E???A?N?e?B?u?????
@command_window.active = false
@status_window.active = true
@status_window.visible = true
@status_window.index = 0
when 4 # ?Qپ[??ڈI??
# ???? SE ?????t
$game_system.se_play($data_system.decision_se)
# ?Qپ[??ڈI??????? ?????
$scene = Scene_Quest.new
when 5 # ?Qپ[??ڈI??
# ???? SE ?????t
$game_system.se_play($data_system.decision_se)
# ?Qپ[??ڈI??????? ?????
$scene = Scene_Map.new
$game_switches[67] = true

when 6 # ?Zپ[?u
# ?Zپ[?u??~??ڈ?چ?
if $game_system.save_disabled
# ?u?Uپ[ SE ?????t
$game_system.se_play($data_system.buzzer_se)
return
end
# ???? SE ?????t
$game_system.se_play($data_system.decision_se)
# ?Zپ[?u????? ?????
$scene = Scene_Save.new
when 7 # ?Qپ[??ڈI??
# ???? SE ?????t
$game_system.se_play($data_system.decision_se)
# ?Qپ[??ڈI??????? ?????
$scene = Scene_End.new
end
return
end
# ?A?j?پپ[?V??????????Jپ[?\????ڈ?? ??چs?????
return if @command_window.animation?
# پ?orپ? ?{?^??????????ڈ?چ?
if Input.press?(Input::UP) or Input.press?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
@command_window.setup_move_move(Window_RingMenu::MODE_MOVEL)
return
end
# پ?orپ? ?{?^??????????ڈ?چ?
if Input.press?(Input::DOWN) or Input.press?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
@command_window.setup_move_move(Window_RingMenu::MODE_MOVER)
return
end
end
#--------------------------------------------------------------------------
# پ? ?t??پ[??چX V (?X?eپ[?^?X?E?B???h?E???A?N?e?B?u??ڈ?چ?)
#--------------------------------------------------------------------------
def update_status
# B ?{?^??????????ڈ?چ?
if Input.trigger?(Input::B)
# ?L?????Z?? SE ?????t
$game_system.se_play($data_system.cancel_se)
# ?R?}???h?E?B???h?E???A?N?e?B?u?????
@command_window.active = true
@status_window.active = false
@status_window.visible = false
@status_window.index = -1
return
end
# C ?{?^??????????ڈ?چ?
if Input.trigger?(Input::C)
case @command_window.index
when 1 # ?X?L??
# ????A?N?^پ[??چs?? ????? 2 ??ڈ???ڈ?چ?
if $game_party.actors[@status_window.index].restriction >= 2
# ?u?Uپ[ SE ?????t
$game_system.se_play($data_system.buzzer_se)
return
end
# ???? SE ?????t
$game_system.se_play($data_system.decision_se)
# ?X?L??????? ?????
$scene = Scene_Skill.new(@status_window.index)


when 2 # ????
# ???? SE ?????t
$game_system.se_play($data_system.decision_se)
# ????????? ?????
$scene = Scene_Equip.new(@status_window.index)
when 3 # ?X?eپ[?^?X
# ???? SE ?????t
$game_system.se_play($data_system.decision_se)
# ?X?eپ[?^?X????? ?????
$scene = Scene_Status.new(@status_window.index)
end
return
end
end
end

#===================================================
# ▲ CLASS Scene_Menu Ends
#===================================================


#===================================================
# ▼ CLASS Window_RingMenu Begins
#===================================================
class Window_RingMenu < Window_Base
#--------------------------------------------------------------------------
# پ? ?N???X?? ?
#--------------------------------------------------------------------------
STARTUP_FRAMES = 20
MOVING_FRAMES = 5
RING_R = 64
ICON_ITEM = RPG::Cache.icon("034-Item03")
ICON_SKILL = RPG::Cache.icon("044-Skill01")
ICON_EQUIP = RPG::Cache.icon("001-Weapon01")
ICON_STATUS = RPG::Cache.icon("050-Skill07")
ICON_QUEST = RPG::Cache.icon("039-Item08")
ICON_MAIN = RPG::Cache.icon("046-Skill03")
ICON_SAVE = RPG::Cache.icon("038-Item07")
ICON_EXIT = RPG::Cache.icon("046-Skill03")
ICON_DISABLE= RPG::Cache.icon("")
SE_STARTUP = "056-Right02"
MODE_START = 1
MODE_WAIT = 2
MODE_MOVER = 3
MODE_MOVEL = 4
#--------------------------------------------------------------------------
# پ? ?A?N?Z?T
#--------------------------------------------------------------------------
attr_accessor :index
#--------------------------------------------------------------------------
# پ? ?I?u?W?F?N?gڈ?????
#--------------------------------------------------------------------------
def initialize( center_x, center_y )
super(0, 0, 640, 480)
self.contents = Bitmap.new(width-32, height-32)
self.contents.font.name = $ring_menu_text[0]
self.contents.font.color = text_color($ring_menu_text[11])
self.contents.font.size = $ring_menu_text[10]
self.opacity = 0
self.back_opacity = 0
s1 = $ring_menu_text[1]
s2 = $ring_menu_text[2]
s3 = $ring_menu_text[3]
s4 = $ring_menu_text[4]
s5 = $ring_menu_text[5]
s6 = $ring_menu_text[6]
s7 = $ring_menu_text[7]
s8 = $ring_menu_text[8]
@commands = [ s1, s2, s3, s4, s5, s6, s7, s8 ]
@item_max = 7
@index = 0
@items = [ ICON_ITEM, ICON_SKILL, ICON_EQUIP, ICON_STATUS, ICON_QUEST, ICON_SAVE, ICON_EXIT ]
@disabled = [ false, false, false, false, false, false ]
@cx = center_x - 16
@cy = center_y - 16
setup_move_start
refresh
end
#--------------------------------------------------------------------------
# پ? ?t??پ[??چX V
#--------------------------------------------------------------------------
def update
super
refresh
end
#--------------------------------------------------------------------------
# پ? ????چ?`??
#--------------------------------------------------------------------------
def refresh
self.contents.clear
# ?A?C?R?????`??
case @mode
when MODE_START
refresh_start
when MODE_WAIT
refresh_wait
when MODE_MOVER
refresh_move(1)
when MODE_MOVEL
refresh_move(0)
end
# ?A?N?e?B?u??R?}???h???\??
rect = Rect.new(@cx - 272, @cy + 24, self.contents.width-32, 32)
self.contents.draw_text(rect, @commands[@index],1)
end
#--------------------------------------------------------------------------
# پ? ????چ?`??(ڈ???????)
#--------------------------------------------------------------------------
def refresh_start
d1 = 2.0 * Math::PI / @item_max
d2 = 1.0 * Math::PI / STARTUP_FRAMES
r = RING_R - 1.0 * RING_R * @steps / STARTUP_FRAMES
for i in 0...@item_max
j = i - @index
d = d1 * j + d2 * @steps
x = @cx + ( r * Math.sin( d ) ).to_i
y = @cy - ( r * Math.cos( d ) ).to_i
draw_item(x, y, i)
end
@steps -= 1
if @steps < 1
@mode = MODE_WAIT
end
end
#--------------------------------------------------------------------------
# پ? ????چ?`??(??@??)
#--------------------------------------------------------------------------
def refresh_wait
d = 2.0 * Math::PI / @item_max
for i in 0...@item_max
j = i - @index
x = @cx + ( RING_R * Math.sin( d * j ) ).to_i
y = @cy - ( RING_R * Math.cos( d * j ) ).to_i
draw_item(x, y, i)
end
end
#--------------------------------------------------------------------------
# پ? ????چ?`??(???]??)
# mode : 0=?????v???? 1=???v????
#--------------------------------------------------------------------------
def refresh_move( mode )
d1 = 2.0 * Math::PI / @item_max
d2 = d1 / MOVING_FRAMES
d2 *= -1 if mode != 0
for i in 0...@item_max
j = i - @index
d = d1 * j + d2 * @steps
x = @cx + ( RING_R * Math.sin( d ) ).to_i
y = @cy - ( RING_R * Math.cos( d ) ).to_i
draw_item(x, y, i)
end
@steps -= 1
if @steps < 1
@mode = MODE_WAIT
end
end
#--------------------------------------------------------------------------
# پ? چ????`??
# x :
# y :
# i : چ????چ?
#--------------------------------------------------------------------------
def draw_item(x, y, i)
#p "x=" + x.to_s + " y=" + y.to_s + " i=" + @items[i].to_s
rect = Rect.new(0, 0, @items[i].width, @items[i].height)
if @index == i
self.contents.blt( x, y, @items[i], rect )
if @disabled[@index]
self.contents.blt( x, y, ICON_DISABLE, rect )
end
else
self.contents.blt( x, y, @items[i], rect, 128 )
if @disabled[@index]
self.contents.blt( x, y, ICON_DISABLE, rect, 128 )
end
end
end
#--------------------------------------------------------------------------
# پ? چ?????????????
# index : چ????چ?
#--------------------------------------------------------------------------
def disable_item(index)
@disabled[index] = true
end
#--------------------------------------------------------------------------
# پ? ڈ??????A?j?پپ[?V??????ڈ???
#--------------------------------------------------------------------------
def setup_move_start
@mode = MODE_START
@steps = STARTUP_FRAMES
if SE_STARTUP != nil and SE_STARTUP != ""
Audio.se_play("Audio/SE/" + SE_STARTUP, 80, 100)
end
end
#--------------------------------------------------------------------------
# پ? ???]?A?j?پپ[?V??????ڈ???
#--------------------------------------------------------------------------
def setup_move_move(mode)
if mode == MODE_MOVER
@index -= 1
@index = @items.size - 1 if @index < 0
elsif mode == MODE_MOVEL
@index += 1
@index = 0 if @index >= @items.size
else
return
end
@mode = mode
@steps = MOVING_FRAMES
end
#--------------------------------------------------------------------------
# پ? ?A?j?پپ[?V?????????????
#--------------------------------------------------------------------------
def animation?
return @mode != MODE_WAIT
end
end

#===================================================
# ▲ CLASS Window_RingMenu Ends
#===================================================


#===================================================
# ▼ CLASS Window_RingMenuStatus Begins
#===================================================

class Window_RingMenuStatus < Window_Selectable
#--------------------------------------------------------------------------
# پ? ?I?u?W?F?N?gڈ?????
#--------------------------------------------------------------------------
def initialize
super(204, 64, 232, 352)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.size = $chara_select[5]
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# پ? ???t???b?V??
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.windowskin = RPG::Cache.windowskin($chara_select[4])
self.contents.font.name = $chara_select[0]
self.contents.font.color = text_color($chara_select[1])
@item_max = $game_party.actors.size
for i in 0...$game_party.actors.size
x = 80
y = 80 * i
actor = $game_party.actors[i]
draw_actor_graphic(actor, x - 40, y + 80)
draw_actor_name(actor, x, y + 24)
end
end
#--------------------------------------------------------------------------
# پ? ?Jپ[?\??????`چX V
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(0, @index * 80, self.width - 32, 80)
end
end
end
#===================================================
# ▲ CLASS Window_RingMenuStatus Ends
#===================================================


#===================================================
# ▼ CLASS Game_Map Additional Code Begins
#===================================================
class Game_Map

#Dubealex Addition (from XRXS) to show Map Name on screen
def name
$map_infos[@map_id]
end
end

#===================================================
# ▲ CLASS Game_Map Additional Code Ends
#===================================================


#===================================================
# ▼ CLASS Scene_Title Additional Code Begins
#===================================================
class Scene_Title

#Dubealex Addition (from XRXS) to show Map Name on screen
$map_infos = load_data("Data/MapInfos.rxdata")
for key in $map_infos.keys
$map_infos[key] = $map_infos[key].name
end
end

#===================================================
# ▲ CLASS Scene_Title Additional Code Ends
#===================================================


#===================================================
# ▼ CLASS Window_Location Begins
#===================================================

class Window_Location < Window_Base

def initialize
super(0, 0, $window_size[0], $window_size[1])
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $location_text[0]
self.contents.font.size = $location_text[1]
refresh
end

def refresh
self.contents.clear
self.windowskin = RPG::Cache.windowskin($window_location_skin)
self.contents.font.color = text_color($location_text[2])
self.contents.draw_text(4, 0, 120, 32, $location_text[3])
self.contents.font.color = text_color($location_text[4])
self.contents.draw_text(4, 32, 120, 32, $game_map.name, 2)
end
end
#===================================================
# ▲ CLASS Window_Location Ends
#===================================================

#===================================================
# ▲ Ring Menu - Show Player Location R1 - Ends
#===================================================

Spoiler:
#===============================================================================
# ** Player : Swap Dead Actor 2.5 by Kain Nobel
#===============================================================================

#-------------------------------------------------------------------------------
# * SDK Log
#-------------------------------------------------------------------------------
#SDK.log('Player.SwapDeadActor', 'Kain Nobel ©️', 2.5, '12.10.2008')
#-------------------------------------------------------------------------------
# * SDK Enabled Test : BEGIN
#-------------------------------------------------------------------------------
#if SDK.enabled?('Player.SwapDeadActor')

#===============================================================================
# ** Scene_Map
#===============================================================================

class Scene_Map
#-----------------------------------------------------------------------------
# * Alias Listings
#-----------------------------------------------------------------------------
alias_method :swap_dead_leader_scene_map_update, :update
#-----------------------------------------------------------------------------
# * Update
#-----------------------------------------------------------------------------

def update
swap_dead_leader_scene_map_update
unless $game_party.actors.empty?
if ($game_party.actors[0].hp).zero?
unless $game_party.all_dead?
$game_party.actors << $game_party.actors.shift
$game_player.refresh
if @sthero != nil
@sthero.dispose
@sthero = Window_HUD.new
@sthero.x = XAS_HUD::XASHUD_X
@sthero.y = XAS_HUD::XASHUD_Y
if $game_switches[XAS_HUD::DISABLE_STATUS_HUD_SWITCH] == false
@sthero.visible = true
else
@sthero.visible = false
end
@sthero.update
end
else ; $game_temp.gameover = true
end
end
end
end
end

#-------------------------------------------------------------------------------
# * SDK Enabled Test : END
#-------------------------------------------------------------------------------
#end

Spoiler:
#------------------#
#Dod Change Leader #
#by:Dodoop #
#version:1.0 #
#------------------#
#
# Edited by: Night_Runner
# Date: 15/Sept/09
#
# Designed to: Turn on the switch corresponding with the leading player's ID
# (and turn off the switch from the last leading player). And update the
# leading player before battle (designed to be compatable with MOG XAS Hud
# V2.6.
#
#-----------------#
#Muda o líder quando uma certa tecla for pressionada no mapa.
module Dodoop
#Tecla que devera ser pressiona para mudar o líder.
CHANGE_LEADER_INPUT = Input::L
end
class Scene_Map
alias change_leader update
def update
change_leader
if Input.trigger?(Dodoop::CHANGE_LEADER_INPUT)
leader_read
end
$game_variables[$game_party.actors[0].id] = $game_system.xas_skill_id
$game_switches[$game_party.actors[0].id] = true # Turns on the switch of
# the leading hero
end

def leader_read
$game_switches[$game_party.actors[0].id] = false # Turns off the switch of
# the last hero
@actors = []
for i in 0...$game_party.actors.size
@actors[i] = $game_party.actors[i]
end
for i in [You must be registered and logged in to see this link.]
$game_party.actors[i - 1] = @actors[i]
end

$game_party.actors[@actors.size - 1] = @actors[0]
$game_player.refresh
$game_party.refresh # Needed to update the party order.
@sthero.refresh # Only to be used with MOG's XAS, refreshes the HUD.
@sthero.update if @sthero != nil
@sthero.refresh if @sthero != nil
@sthero.update if @sthero != nil
if @sthero != nil

@sthero.dispose
last_act = $game_party.actors.shift
$game_party.add_actor (last_act.id)
$game_player.refresh


$game_system.xas_item_id = 0

$scene = Scene_Map.new
$game_system.xas_skill_id = $game_variables[$game_party.actors[0].id]

@sthero = Window_HUD.new
@sthero.x = XAS_HUD::XASHUD_X
@sthero.y = XAS_HUD::XASHUD_Y
if $game_switches[XAS_HUD::DISABLE_STATUS_HUD_SWITCH] == false
@sthero.visible = true
else
@sthero.visible = false
end
@sthero.update
$game_switches[25] = true
end
end
end

#================================================#
# Game_Party
#================================================#

class Game_Party
def remove_actor(actor_id)
# Delete actor
@actors.delete($game_actors[actor_id])
# Refresh player
$game_player.refresh
$game_switches[actor_id] = false # If the actor is removed, they cannot
# be the leading hero.
end
end
ACTIVATED
Show Signature
ACTIVATED
EVENTALIST
EVENTALIST
#10 Re: XAS - Respawn Timer
Loading

mr_wiggles

avatar
EVENTALIST
 EVENTALIST
EVENTALIST
profile
It shouldn't be conflicting with those scripts, and the error just told me that the array i have set up in system did not get set up. so that i why i was wondering what other script you where using.

Is the re-spawn script above or bellow those?
EVENTALIST
Show Signature
EVENTALIST
ACTIVATED
ACTIVATED
#11 Re: XAS - Respawn Timer
Loading

rpg-dutch

ACTIVATED
ACTIVATED
ACTIVATED
profile
I have added this script above and below everything, but still no go.

I did try something similar in the past

Under the "Battler" script I added...

-----------------------
DEFEAT_SELFSWITCH_IDS = {
1=>"A",
2=>"C"
}
--------------

under "System" I added


-------
selfswitch_id = XAS_BA_ENEMY::DEFEAT_SELFSWITCH_IDS[self.enemy_id]
if selfswitch_id != nil
$game_self_switches[[$game_map.map_id, self.id, selfswitch_id]] = true
$game_map.refresh
end
-------------

Would this add any conflicts?
ACTIVATED
Show Signature
ACTIVATED
EVENTALIST
EVENTALIST
#12 Re: XAS - Respawn Timer
Loading

mr_wiggles

avatar
EVENTALIST
 EVENTALIST
EVENTALIST
profile
do you have my most recently updated script in the first post?
EVENTALIST
Show Signature
EVENTALIST
ACTIVATED
ACTIVATED
#13 Re: XAS - Respawn Timer
Loading

rpg-dutch

ACTIVATED
ACTIVATED
ACTIVATED
profile
yeah tried entering it again and still no go...

Sad
ACTIVATED
Show Signature
ACTIVATED
Community Moderator
Community Moderator
#14 Re: XAS - Respawn Timer
Loading

GeMinEye

avatar
Community Moderator
Community Moderator
Community Moderator
profile
This is awesome Wiggles, I am going to use it if you're ok with it. Very Happy
Community Moderator
Show Signature


Check out my story:
[You must be registered and logged in to see this link.]
[You must be registered and logged in to see this image.]


Community Moderator


[You must be registered and logged in to see this image.] [You must be registered and logged in to see this image.] [You must be registered and logged in to see this image.] [You must be registered and logged in to see this image.] [You must be registered and logged in to see this image.]
WE WILL RULE THE WORLD!
Community Moderator
http://dezrealah.tumblr.com/
EVENTALIST
EVENTALIST
#15 Re: XAS - Respawn Timer
Loading

mr_wiggles

avatar
EVENTALIST
 EVENTALIST
EVENTALIST
profile
I looked at your scripts that you posted that your using again, do you have SDK (you don't need it and its not compatible with XAS)? also have you tired to position the re spawn timer script bellow all of your add on scripts? (some times its just a matter of placement)

Whats happening is that the variable in the game system is not being set, so i was looking at any thing that may have been preventing it. i can't find any thing, also those edits that you said you did you didn't need to do those. (why did you need to do it for that other script any ways?)

it may take time but don't worry we'll find a way to make this work for you. Very Happy

@gem - of course you can use it, that's why i posted it.

[edit]
i just realized that you where asking this about the same time that XAS 3.7 came out and this is for XAS 3.6 (does this at all change any thing?)

*script has been updated* Very Happy

(let me know if this fixed the error you where having with it)
EVENTALIST
Show Signature
EVENTALIST
ACTIVATED
ACTIVATED
#16 Re: XAS - Respawn Timer
Loading

rpg-dutch

ACTIVATED
ACTIVATED
ACTIVATED
profile
I have added it above, middle and bellow my additional addon scripts

I am using XAS 3.6

and i do have SDK if I remove it the game doesn't work any thoughts?

Check the spoiler

Spoiler:
#==============================================================================
# ** RMXP Standard Development Kit (SDK)
#------------------------------------------------------------------------------
# Build Date - 2005-11-22
# Version 1.0 - Near Fantastica - 2005-11-22
# Version 1.1 - SephirothSpawn - 2005-12-18 - (Near Fantastica)
# Version 1.2 - Near Fantastica - 2005-12-18
# Version 1.3 - Wachunga - 2005-12-19
# Version 1.4 - Prexus - 2006-03-02
# Version 1.5 - Jimme Reashu - 2006-03-25 - (Near Fantastica)
#------------------------------------------------------------------------------
=begin
1.0 - Outline

The Standard Development Kit (SDK) aims to increase compatibility between
RGSS scripts by:

a) defining a set of scripting standards (see section 3)
b) restructuring often-used default classes and methods (see section 4)
c) providing a scripting tools module (see section 5)
#------------------------------------------------------------------------------
2.0 - Modifications to the RMXP Standard Development Kit

Since edits to the SDK may cause massive capability errors, any and all
modifications must first be approved by a member of the RMXP SDK Team.

The author of any modifications must be sure to update all relevant
documentation. This also includes the header, where the author is to put
the next version number with his or her name and the name of the approval
member (from the SDK Team) under the latest version in the following format.

Version # - Name - Date - (Approval Member Name)
#------------------------------------------------------------------------------
3.0 - Coding Standards

To be compliant with the SDK, a script must compy with the following
coding standards:

3.1 - Commenting
3.2 - Classes
3.3 - Variables
3.4 - Aliases
3.5 - Strings
3.6 - Line Length
3.7 - White Space
3.8 - Constants
3.9 - Parentheses
#------------------------------------------------------------------------------
3.1 - Commenting

scripts must begin with the following header:

#==============================================================================
# ** script Name
#------------------------------------------------------------------------------
# Your Name
# Version
# Date
#==============================================================================

All classes and methods must have a comment describing the process or what
was added. All code added to methods that can not be aliased must be
formatted as follows:

#------------------------------------------------------------------------------
# Begin script Name Edit
#------------------------------------------------------------------------------
[Code]
#------------------------------------------------------------------------------
# End script Name Edit
#------------------------------------------------------------------------------

Single line comments should precede the described block of code and should be
indented at the same level. Code that is not self-documenting should be
commented.

However, very short comments can appear on the same line as the described
code, but should be shifted far enough to separate them from the statements.
If more than one short comment appears in a chunk of code, they should all be
indented to the same tab setting. Attribute declarations should always have a
trailing comment.
#------------------------------------------------------------------------------
3.2 - Classes

All classes must be named consistently with the default code, namely:

Data - Any class that holds data
Game - Any class that processes data
Sprite - Any class that defines a sprite
Spriteset - Any class that defines multiple sprites
Window - Any class that defines a window
Arrow - Any class that defines an arrow
Scene - Any class that defines a scene
#------------------------------------------------------------------------------
3.3 - Variables

All variable names must be reasonably descriptive. Use of class and global
variables should be limited. Any variable used by the default system can not
have its use changed.
#------------------------------------------------------------------------------
3.4 - Aliases

Aliasing a method is preferable to overriding it; an alias should be used
whenever possible to increase compatibility with other scripts. All alias
names must have the following format:

yourname_scriptname_classname_methodname
#------------------------------------------------------------------------------
3.5 – Strings

Strings should normally be defined with single quotes ('example'); this
decreases the processing time of the engine. Double quotes are useful when
using the following features:
a) substitutions, i.e. sequences that start with a backslash character
(e.g. \n for the newline character)
b) expression interpolation, i.e. #{ expression } is replaced by the value
of expression
#------------------------------------------------------------------------------
3.6 - Line Length

Lines should not cause the the viewer to have to scroll sideways to view them
in the script editor. When the line needs to be broken, it should follow the
following guidelines, in preferential order:

Break after a comma.
Break before an operator.
Prefer higher-level breaks to lower-level breaks.
Align the new line with the beginning of the expression at the same level
on the previous line.

If the above rules lead to confusing code or to code that’s squished up
against the right margin, just indent 4 spaces instead.
#------------------------------------------------------------------------------
3.7 - White Space

A blank line(s) should be used in the following places:

Between sections of a source file
Between class and module definitions
Between attributes and the class definition
Between methods
Between the local variables in a method and its first statement
Before a block or single-line comment
Between logical sections inside a method to improve readability

Blank spaces should be used in the following places:

A keyword followed by a parenthesis, e.g. if (some_boolean_statements)
After commas in argument lists, e.g. def method (arg1, arg2, ...)
All binary operators except '.', e.g. a + b; c = 1
#------------------------------------------------------------------------------
3.8 - Constants

New numerical values should not be "hard-coded", except for -1, 0, and 1,
which can appear in for loops as counter values. Instead, these numerical
values should be made into constant variables and these used instead.
#------------------------------------------------------------------------------
3.9 - Parentheses

It is generally a good idea to use parentheses liberally in expressions
involving mixed operators to avoid operator precedence problems. Even if
the operator precedence seems clear to you, it might not be to others -— you
shouldn’t assume that other programmers know precedence as well as you do.
#------------------------------------------------------------------------------
4.0 - Engine Updates

The following is a list of classes and methods that have been updated by the
SDK to help improve compatibility:

Game_Map - setup
Game_Map - update
Game_Character - update
Game_Event - refresh
Game_Player - update
Sprite_Battler - update
Spriteset_Map - initialize
Spriteset_Map - update
Scene_Tile - main
Scene_Map - main
Scene_Map - update
Scene_Save - write_save_data
Scene_Load - read_save_data
Scene_Menu - initialize
Scene_Menu - main
Scene_Menu - update & command input
Scene_Battle - main
Scene_Battle - update
Scene_Battle - update_phase3_basic_command
Scene_Battle - make_basic_action_result
#------------------------------------------------------------------------------
5.0 - SDK Tools

The following tools are included in the SDK to help improve the development
process:

5.1 - Logging scripts
5.2 - Enabling/Disabling scripts
5.3 - script Dependencies
5.4 - Standard Text Box Input
5.5 - Standard Event Comment Input
#------------------------------------------------------------------------------
5.1 – Logging scripts

All SDK-compliant scripts should be logged. This is done by calling the
SDK.log(script, name, ver, date) method, where

script = script name
name = your name
ver = version
date = date last updated
#------------------------------------------------------------------------------
5.2 – Enabling/Disabling scripts

When a script is logged it is also enabled. A script can be enabled and
disabled using the following calls:

SDK.enable('script Name')
SDK.disable('script Name')

All non-default scripts (and code added to default scripts) must be enclosed
in an if statement that checks whether or not they have been enabled, as
follows:

#--------------------------------------------------------------------------
# Begin SDK Enabled Check
#--------------------------------------------------------------------------
if SDK.state('script Name') == true
[script or Code]
end
#--------------------------------------------------------------------------
# End SDK Enabled Test
#--------------------------------------------------------------------------

Keep in mind that this if statement can not continue on to other pages and
every page needs its own if statement testing the state of the script. As
well every script should have its own test.
#------------------------------------------------------------------------------
5.3 – script Dependencies

Any script that requires (i.e. has a dependency on) another script can check
if that dependency is met provided that the required script is set up before
the script in question. This would be done in the following way:

p 'script Name not found' if SDK.state('script Name') != true
#------------------------------------------------------------------------------
5.4 – Standard Text Box Input

Any script that requires input from a database text field should use the
following:

SDK.text_box_input(element, index)

where:
element = an object of the text field
index = the index in which your script call falls

The text field should be formatted in the following way:

"Default value | script call | script call"
#------------------------------------------------------------------------------
5.5 – Standard Event Comment Input

Any script that requires input from an event comment should use the
following:

SDK.event_comment_input(event, elements, trigger)

where:
event = an object of the event
elements = the number of elements the method is to process
trigger = the text value triggering the script to start processing

or

SDK.event_comment_input(page, elements, trigger)

where:
page = an object of the event.page
elements = the number of elements the method is to process
trigger = the text value triggering the script to start processing

The method returns nil if the trigger can not be found; otherwise, it
returns a list of the parameters from the event.
#==============================================================================
=end

module SDK
@list = {}
@enabled = {}
#--------------------------------------------------------------------------
# * Logs a custom script
#--------------------------------------------------------------------------
def self.log(script, name, ver, date)
@list[script] = [name,ver,date]
@enabled[script] = true
end
#--------------------------------------------------------------------------
# * Returns a list of custom scripts
#--------------------------------------------------------------------------
def self.print(script = '')
if script == ''
return @list
else
return @list[script]
end
end
#--------------------------------------------------------------------------
# * Writes a list of the custom scripts to a file
#--------------------------------------------------------------------------
def self.write
file = File.open('scripts List.txt', 'wb')
for key in @list.keys
file.write("#{@list[key][0]} : #{key} Version #{@list[key][1]}\n")
end
file.close
end
#--------------------------------------------------------------------------
# * Returns the state of the passed script
#--------------------------------------------------------------------------
def self.state(script)
return @enabled[script]
end
#--------------------------------------------------------------------------
# * Enables the passed script
#--------------------------------------------------------------------------
def self.enable(script)
@enabled[script] = true
end
#--------------------------------------------------------------------------
# * Disables the passed script
#--------------------------------------------------------------------------
def self.disable(script)
@enabled[script] = false
end
#--------------------------------------------------------------------------
# * Evals text from an input source
#--------------------------------------------------------------------------
def self.text_box_input(element, index)
return if index == 0
commands = element.split('|')
eval(commands[index])
end
#--------------------------------------------------------------------------
# * Returns a list of parameters from an event's comments
#--------------------------------------------------------------------------
def self.event_comment_input(*args)
parameters = []
list = *args[0].list
elements = *args[1]
trigger = *args[2]
return nil if list == nil
return nil unless list.is_a?(Array)
for item in list
next if item.code != 108
if item.parameters[0] == trigger
start = list.index(item) + 1
finish = start + elements
for id in start...finish
next if !list[id]
parameters.push(list[id].parameters[0])
end
return parameters
end
end
return nil
end
end

#==============================================================================
# ** Object
#------------------------------------------------------------------------------
# automatic_dispose looks after disposing all windows and sprites in a scene
# when called.
#==============================================================================

class Object
#--------------------------------------------------------------------------
# * Automatic Dispose
#--------------------------------------------------------------------------
def automatic_dispose
self.instance_variables.each do |item|
eval("#{item}.dispose if (#{item}.is_a?(Sprite) or #{item}.is_a?(Window_Base)) and (!#{item}.disposed?)")
end
end
end

#==============================================================================
# ** Game_Map
#------------------------------------------------------------------------------
# This class handles the map. It includes scrolling and passable determining
# functions. Refer to "$game_map" for the instance of this class.
#==============================================================================

class Game_Map
#--------------------------------------------------------------------------
# * Setup
# map_id : map ID
#--------------------------------------------------------------------------
def setup(map_id)
setup_map_id(map_id)
setup_load
setup_tileset
setup_display
setup_refresh
setup_events
setup_common_events
setup_fog
setup_scroll
end
#--------------------------------------------------------------------------
# * Setup Map ID
#--------------------------------------------------------------------------
def setup_map_id(map_id)
# Put map ID in @map_id memory
@map_id = map_id
end
#--------------------------------------------------------------------------
# * Load Map Data
#--------------------------------------------------------------------------
def setup_load
# Load map from file and set @map
@map = load_data(sprintf("Data/Map%03d.rxdata", @map_id))
end
#--------------------------------------------------------------------------
# * Setup Tileset
#--------------------------------------------------------------------------
def setup_tileset
# set tile set information in opening instance variables
tileset = $data_tilesets[@map.tileset_id]
@tileset_name = tileset.tileset_name
@autotile_names = tileset.autotile_names
@panorama_name = tileset.panorama_name
@panorama_hue = tileset.panorama_hue
@fog_name = tileset.fog_name
@fog_hue = tileset.fog_hue
@fog_opacity = tileset.fog_opacity
@fog_blend_type = tileset.fog_blend_type
@fog_zoom = tileset.fog_zoom
@fog_sx = tileset.fog_sx
@fog_sy = tileset.fog_sy
@battleback_name = tileset.battleback_name
@passages = tileset.passages
@priorities = tileset.priorities
@terrain_tags = tileset.terrain_tags
end
#--------------------------------------------------------------------------
# * Setup Display
#--------------------------------------------------------------------------
def setup_display
# Initialize displayed coordinates
@display_x = 0
@display_y = 0
end
#--------------------------------------------------------------------------
# * Setup Refresh
#--------------------------------------------------------------------------
def setup_refresh
# Clear refresh request flag
@need_refresh = false
end
#--------------------------------------------------------------------------
# * Setup Events
#--------------------------------------------------------------------------
def setup_events
# Set map event data
@events = {}
for i in @map.events.keys
@events[i] = Game_Event.new(@map_id, @map.events[i])
end
end
#--------------------------------------------------------------------------
# * Setup Common Events
#--------------------------------------------------------------------------
def setup_common_events
# Set common event data
@common_events = {}
for i in 1...$data_common_events.size
@common_events[i] = Game_CommonEvent.new(i)
end
end
#--------------------------------------------------------------------------
# * Setup Fog
#--------------------------------------------------------------------------
def setup_fog
# Initialize all fog information
@fog_ox = 0
@fog_oy = 0
@fog_tone = Tone.new(0, 0, 0, 0)
@fog_tone_target = Tone.new(0, 0, 0, 0)
@fog_tone_duration = 0
@fog_opacity_duration = 0
@fog_opacity_target = 0
end
#--------------------------------------------------------------------------
# * Setup Scroll
#--------------------------------------------------------------------------
def setup_scroll
# Initialize scroll information
@scroll_direction = 2
@scroll_rest = 0
@scroll_speed = 4
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
update_refresh
update_scrolling
update_events
update_common_events
update_fog_scroll
update_fog_colour
update_fog
end
#--------------------------------------------------------------------------
# * Refresh Game Map
#--------------------------------------------------------------------------
def update_refresh
# Refresh map if necessary
if $game_map.need_refresh
refresh
end
end
#--------------------------------------------------------------------------
# * Update Scrolling
#--------------------------------------------------------------------------
def update_scrolling
# If scrolling
if @scroll_rest > 0
# Change from scroll speed to distance in map coordinates
distance = 2 ** @scroll_speed
# Execute scrolling
case @scroll_direction
when 2 # Down
scroll_down(distance)
when 4 # Left
scroll_left(distance)
when 6 # Right
scroll_right(distance)
when 8 # Up
scroll_up(distance)
end
# Subtract distance scrolled
@scroll_rest -= distance
end
end
#--------------------------------------------------------------------------
# * Update Events
#--------------------------------------------------------------------------
def update_events
# Update map event
for event in @events.values
event.update
end
end
#--------------------------------------------------------------------------
# * Update Common Events
#--------------------------------------------------------------------------
def update_common_events
# Update common event
for common_event in @common_events.values
common_event.update
end
end
#--------------------------------------------------------------------------
# * Update Fog Scroll
#--------------------------------------------------------------------------
def update_fog_scroll
# Manage fog scrolling
@fog_ox -= @fog_sx / 8.0
@fog_oy -= @fog_sy / 8.0
end
#--------------------------------------------------------------------------
# * Update Fog Color
#--------------------------------------------------------------------------
def update_fog_colour
# Manage change in fog color tone
if @fog_tone_duration >= 1
d = @fog_tone_duration
target = @fog_tone_target
@fog_tone.red = (@fog_tone.red * (d - 1) + target.red) / d
@fog_tone.green = (@fog_tone.green * (d - 1) + target.green) / d
@fog_tone.blue = (@fog_tone.blue * (d - 1) + target.blue) / d
@fog_tone.gray = (@fog_tone.gray * (d - 1) + target.gray) / d
@fog_tone_duration -= 1
end
end
#--------------------------------------------------------------------------
# * Update Fog
#--------------------------------------------------------------------------
def update_fog
# Manage change in fog opacity level
if @fog_opacity_duration >= 1
d = @fog_opacity_duration
@fog_opacity = (@fog_opacity * (d - 1) + @fog_opacity_target) / d
@fog_opacity_duration -= 1
end
end
end

#==============================================================================
# ** Game_Character
#------------------------------------------------------------------------------
# This class deals with characters. It's used as a superclass for the
# Game_Player and Game_Event classes.
#==============================================================================

class Game_Character
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
unless update_wait == true
update_movement_type
update_animation
return if update_force? == true
return if update_event_execution? == true
update_movement
end
end
#--------------------------------------------------------------------------
# * Update Movement Type
#--------------------------------------------------------------------------
def update_movement_type
# Branch with jumping, moving, and stopping
if jumping?
update_jump
elsif moving?
update_move
else
update_stop
end
end
#--------------------------------------------------------------------------
# * Update Animation
#--------------------------------------------------------------------------
def update_animation
# If animation count exceeds maximum value
# * Maximum value is move speed * 1 taken from basic value 18
if @anime_count > 18 - @move_speed * 2
# If stop animation is OFF when stopping
if not @step_anime and @stop_count > 0
# Return to original pattern
@pattern = @original_pattern
# If stop animation is ON when moving
else
# Update pattern
@pattern = (@pattern + 1) % 4
end
# Clear animation count
@anime_count = 0
end
end
#--------------------------------------------------------------------------
# * Update Wait
#--------------------------------------------------------------------------
def update_wait
# Reduce wait count
@wait_count -= 1 if @wait_count > 0
return (@wait_count > 0)
end
#--------------------------------------------------------------------------
# * Update Force
#--------------------------------------------------------------------------
def update_force?
# If move route is forced
if @move_route_forcing
# Custom move
move_type_custom
return true
end
return false
end
#--------------------------------------------------------------------------
# * Update Event Execution
#--------------------------------------------------------------------------
def update_event_execution?
# When waiting for event execution or locked
if @starting or lock?
# Not moving by self
return true
end
return false
end
#--------------------------------------------------------------------------
# * Update Movement
#--------------------------------------------------------------------------
def update_movement
# If stop count exceeds a certain value (computed from move frequency)
if @stop_count > (40 - @move_frequency * 2) * (6 - @move_frequency)
# Branch by move type
case @move_type
when 1 # Random
move_type_random
when 2 # Approach
move_type_toward_player
when 3 # Custom
move_type_custom
end
end
end
end

#==============================================================================
# ** Game_Event
#------------------------------------------------------------------------------
# This class deals with events. It handles functions including event page
# switching via condition determinants, and running parallel process events.
# It's used within the Game_Map class.
#==============================================================================

class Game_Event < Game_Character
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
# Initialize local variable: new_page
new_page = nil
# If not temporarily erased
unless @erased
new_page = refresh_trigger_conditions
end
# If event page is the same as last time
if new_page == @page
# End method
return
end
# Set @page as current event page
@page = new_page
# Clear starting flag
clear_starting
# If no page fulfills conditions
if @page == nil
# Reset values
refresh_reset
# End method
return
end
# Set page variables
refresh_set_page
# Check parallel processing
refresh_check_process
# Auto event start determinant
check_event_trigger_auto
end
#--------------------------------------------------------------------------
# * Refresh Trigger Conditions
#--------------------------------------------------------------------------
def refresh_trigger_conditions
# Check in order of large event pages
for page in @event.pages.reverse
# Make possible referrence for event condition with c
c = page.condition
# Switch 1 condition confirmation
if c.switch1_valid
if $game_switches[c.switch1_id] == false
next
end
end
# Switch 2 condition confirmation
if c.switch2_valid
if $game_switches[c.switch2_id] == false
next
end
end
# Variable condition confirmation
if c.variable_valid
if $game_variables[c.variable_id] < c.variable_value
next
end
end
# Self switch condition confirmation
if c.self_switch_valid
key = [@map_id, @event.id, c.self_switch_ch]
if $game_self_switches[key] != true
next
end
end
# Set local variable: new_page
new_page = page
# Remove loop
break
end
# Return new page
return new_page
end
#--------------------------------------------------------------------------
# * Refresh Reset
#--------------------------------------------------------------------------
def refresh_reset
# Set each instance variable
@tile_id = 0
@character_name = ""
@character_hue = 0
@move_type = 0
@through = true
@trigger = nil
@list = nil
@interpreter = nil
end
#--------------------------------------------------------------------------
# * Refresh Set Page
#--------------------------------------------------------------------------
def refresh_set_page
# Set each instance variable
@tile_id = @page.graphic.tile_id
@character_name = @page.graphic.character_name
@character_hue = @page.graphic.character_hue
if @original_direction != @page.graphic.direction
@direction = @page.graphic.direction
@original_direction = @direction
@prelock_direction = 0
end
if @original_pattern != @page.graphic.pattern
@pattern = @page.graphic.pattern
@original_pattern = @pattern
end
@opacity = @page.graphic.opacity
@blend_type = @page.graphic.blend_type
@move_type = @page.move_type
@move_speed = @page.move_speed
@move_frequency = @page.move_frequency
@move_route = @page.move_route
@move_route_index = 0
@move_route_forcing = false
@walk_anime = @page.walk_anime
@step_anime = @page.step_anime
@direction_fix = @page.direction_fix
@through = @page.through
@always_on_top = @page.always_on_top
@trigger = @page.trigger
@list = @page.list
@interpreter = nil
end
#--------------------------------------------------------------------------
# * Refresh Check Process
#--------------------------------------------------------------------------
def refresh_check_process
# If trigger is [parallel process]
if @trigger == 4
# Create parallel process interpreter
@interpreter = Interpreter.new
end
end
end

#==============================================================================
# ** Game_Player
#------------------------------------------------------------------------------
# This class handles the player. Its functions include event starting
# determinants and map scrolling. Refer to "$game_player" for the one
# instance of this class.
#==============================================================================

class Game_Player < Game_Character
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Remember whether or not moving in local variables
last_moving = moving?
# If moving, event running, move route forcing, and message window
# display are all not occurring
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing
update_player_movement
end
# Remember coordinates in local variables
last_real_x = @real_x
last_real_y = @real_y
super
# Scroll map
update_scroll_down(last_real_y)
update_scroll_left(last_real_x)
update_scroll_right(last_real_x)
update_scroll_up(last_real_y)
# If not moving
unless moving?
# If player was moving last time
if last_moving
update_encounter
end
update_action_trigger
end
end
#--------------------------------------------------------------------------
# * Player Movement Update
#--------------------------------------------------------------------------
def update_player_movement
# Move player in the direction the directional button is being pressed
case Input.dir4
when 2
move_down
when 4
move_left
when 6
move_right
when 8
move_up
end
end
#--------------------------------------------------------------------------
# * Scroll Down
#--------------------------------------------------------------------------
def update_scroll_down(last_real_y)
# If character moves down and is positioned lower than the center
# of the screen
if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
# Scroll map down
$game_map.scroll_down(@real_y - last_real_y)
end
end
#--------------------------------------------------------------------------
# * Scroll Left
#--------------------------------------------------------------------------
def update_scroll_left(last_real_x)
# If character moves left and is positioned more let on-screen than
# center
if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
# Scroll map left
$game_map.scroll_left(last_real_x - @real_x)
end
end
#--------------------------------------------------------------------------
# * Scroll Right
#--------------------------------------------------------------------------
def update_scroll_right(last_real_x)
# If character moves right and is positioned more right on-screen than
# center
if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
# Scroll map right
$game_map.scroll_right(@real_x - last_real_x)
end
end
#--------------------------------------------------------------------------
# * Scroll Up
#--------------------------------------------------------------------------
def update_scroll_up(last_real_y)
# If character moves up and is positioned higher than the center
# of the screen
if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
# Scroll map up
$game_map.scroll_up(last_real_y - @real_y)
end
end
#--------------------------------------------------------------------------
# * Update Action Trigger
#--------------------------------------------------------------------------
def update_action_trigger
# If C button was pressed
if Input.trigger?(Input::C)
# Same position and front event determinant
check_event_trigger_here([0])
check_event_trigger_there([0,1,2])
end
end
#--------------------------------------------------------------------------
# * Scroll Encounter
#--------------------------------------------------------------------------
def update_encounter
# Event determinant is via touch of same position event
result = check_event_trigger_here([1,2])
# If event which started does not exist
if result == false
# Disregard if debug mode is ON and ctrl key was pressed
unless $DEBUG and Input.press?(Input::CTRL)
# Encounter countdown
if @encounter_count > 0
@encounter_count -= 1
end
end
end
end
end

#==============================================================================
# ** Sprite_Battler
#------------------------------------------------------------------------------
# This sprite is used to display the battler.It observes the Game_Character
# class and automatically changes sprite conditions.
#==============================================================================

class Sprite_Battler
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
super
# If battler is nil
if @battler == nil
remove_battler
return
end
# If file name or hue are different than current ones
redraw_battler
# If animation ID is different than current one
loop_anim
# If actor which should be displayed
adjust_actor_opacity
# Blink
adjust_blink
# If invisible
adjust_visibility
# If visible
if @battler_visible
# Escape
sprite_escape
# White flash
sprite_white_flash
# Animation
sprite_animation
# Damage
sprite_damage
# Collapse
sprite_collapse
end
# Set sprite coordinates
self.x = @battler.screen_x
self.y = @battler.screen_y
self.z = @battler.screen_z
end
#--------------------------------------------------------------------------
# * Remove Battler
#--------------------------------------------------------------------------
def remove_battler
self.bitmap = nil
loop_animation(nil)
end
#--------------------------------------------------------------------------
# * Redraw Battler
#--------------------------------------------------------------------------
def redraw_battler
if @battler.battler_name != @battler_name or
@battler.battler_hue != @battler_hue
# Get and set bitmap
@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
# Change opacity level to 0 when dead or hidden
if @battler.dead? or @battler.hidden
self.opacity = 0
end
end
end
#--------------------------------------------------------------------------
# * Loop Sprite Animation
#--------------------------------------------------------------------------
def loop_anim
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
end
#--------------------------------------------------------------------------
# * Adjust Actor Opacity
#--------------------------------------------------------------------------
def adjust_actor_opacity
if @battler.is_a?(Game_Actor) and @battler_visible
# Bring opacity level down a bit when not in main phase
if $game_temp.battle_main_phase
self.opacity += 3 if self.opacity < 255
else
self.opacity -= 3 if self.opacity > 207
end
end
end
#--------------------------------------------------------------------------
# * Adjust Blink
#--------------------------------------------------------------------------
def adjust_blink
if @battler.blink
blink_on
else
blink_off
end
end
#--------------------------------------------------------------------------
# * Adjust Visibility
#--------------------------------------------------------------------------
def adjust_visibility
unless @battler_visible
# Appear
if not @battler.hidden and not @battler.dead? and
(@battler.damage == nil or @battler.damage_pop)
appear
@battler_visible = true
end
end
end
#--------------------------------------------------------------------------
# * Sprite: Escape
#--------------------------------------------------------------------------
def sprite_escape
if @battler.hidden
$game_system.se_play($data_system.escape_se)
escape
@battler_visible = false
end
end
#--------------------------------------------------------------------------
# * Sprite: White Flash
#--------------------------------------------------------------------------
def sprite_white_flash
if @battler.white_flash
whiten
@battler.white_flash = false
end
end
#--------------------------------------------------------------------------
# * Sprite: Animation
#--------------------------------------------------------------------------
def sprite_animation
if @battler.animation_id != 0
animation = $data_animations[@battler.animation_id]
animation(animation, @battler.animation_hit)
@battler.animation_id = 0
end
end
#--------------------------------------------------------------------------
# * Sprite: Damage
#--------------------------------------------------------------------------
def sprite_damage
if @battler.damage_pop
damage(@battler.damage, @battler.critical)
@battler.damage = nil
@battler.critical = false
@battler.damage_pop = false
end
end
#--------------------------------------------------------------------------
# * Sprite: Collapse
#--------------------------------------------------------------------------
def sprite_collapse
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
end

#==============================================================================
# ** Spriteset_Map
#------------------------------------------------------------------------------
# This class brings together map screen sprites, tilemaps, etc.
# It's used within the Scene_Map class.
#==============================================================================

class Spriteset_Map
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
init_viewports
init_tilemap
init_panorama
init_fog
init_characters
init_player
init_weather
init_pictures
init_timer
# Frame update
update
end
#--------------------------------------------------------------------------
# * Viewport Initialization
#--------------------------------------------------------------------------
def init_viewports
# Make viewports
@viewport1 = Viewport.new(0, 0, 640, 480)
@viewport2 = Viewport.new(0, 0, 640, 480)
@viewport3 = Viewport.new(0, 0, 640, 480)
@viewport2.z = 200
@viewport3.z = 5000
end
#--------------------------------------------------------------------------
# * Tilemap Initialization
#--------------------------------------------------------------------------
def init_tilemap
# Make tilemap
@tilemap = Tilemap.new(@viewport1)
@tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name)
for i in 0..6
autotile_name = $game_map.autotile_names[i]
@tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
end
@tilemap.map_data = $game_map.data
@tilemap.priorities = $game_map.priorities
end
#--------------------------------------------------------------------------
# * Panorama Initialization
#--------------------------------------------------------------------------
def init_panorama
# Make panorama plane
@panorama = Plane.new(@viewport1)
@panorama.z = -1000
end
#--------------------------------------------------------------------------
# * Fog Initialization
#--------------------------------------------------------------------------
def init_fog
# Make fog plane
@fog = Plane.new(@viewport1)
@fog.z = 3000
end
#--------------------------------------------------------------------------
# * Character Sprite Initialization
#--------------------------------------------------------------------------
def init_characters
# Make character sprites
@character_sprites = []
for i in $game_map.events.keys.sort
sprite = Sprite_Character.new(@viewport1, $game_map.events[i])
@character_sprites.push(sprite)
end
end
#--------------------------------------------------------------------------
# * Player Initialization
#--------------------------------------------------------------------------
def init_player
@character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
end
#--------------------------------------------------------------------------
# * Weather Initialization
#--------------------------------------------------------------------------
def init_weather
# Make weather
@weather = RPG::Weather.new(@viewport1)
end
#--------------------------------------------------------------------------
# * Picture Initialization
#--------------------------------------------------------------------------
def init_pictures
# Make picture sprites
@picture_sprites = []
for i in 1..50
@picture_sprites.push(Sprite_Picture.new(@viewport2,
$game_screen.pictures[i]))
end
end
#--------------------------------------------------------------------------
# * Timer Initialization
#--------------------------------------------------------------------------
def init_timer
# Make timer sprite
@timer_sprite = Sprite_Timer.new
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
update_panorama
update_fog
update_tilemap
update_panorama_plane
update_fog_plane
update_character_sprites
update_weather
update_picture_sprites
# Update timer sprite
@timer_sprite.update
# Set screen color tone and shake position
@viewport1.tone = $game_screen.tone
@viewport1.ox = $game_screen.shake
# Set screen flash color
@viewport3.color = $game_screen.flash_color
# Update viewports
@viewport1.update
@viewport3.update
end
#--------------------------------------------------------------------------
# * Update Panorama
#--------------------------------------------------------------------------
def update_panorama
# If panorama is different from current one
if @panorama_name != $game_map.panorama_name or
@panorama_hue != $game_map.panorama_hue
@panorama_name = $game_map.panorama_name
@panorama_hue = $game_map.panorama_hue
if @panorama.bitmap != nil
@panorama.bitmap.dispose
@panorama.bitmap = nil
end
if @panorama_name != ""
@panorama.bitmap = RPG::Cache.panorama(@panorama_name, @panorama_hue)
end
Graphics.frame_reset
end
end
#--------------------------------------------------------------------------
# * Update Fog
#--------------------------------------------------------------------------
def update_fog
# If fog is different than current fog
if @fog_name != $game_map.fog_name or @fog_hue != $game_map.fog_hue
@fog_name = $game_map.fog_name
@fog_hue = $game_map.fog_hue
if @fog.bitmap != nil
@fog.bitmap.dispose
@fog.bitmap = nil
end
if @fog_name != ""
@fog.bitmap = RPG::Cache.fog(@fog_name, @fog_hue)
end
Graphics.frame_reset
end
end
#--------------------------------------------------------------------------
# * Update Tilemap
#--------------------------------------------------------------------------
def update_tilemap
# Update tilemap
@tilemap.ox = $game_map.display_x / 4
@tilemap.oy = $game_map.display_y / 4
@tilemap.update
end
#--------------------------------------------------------------------------
# * Update Panorama Plane
#--------------------------------------------------------------------------
def update_panorama_plane
# Update panorama plane
@panorama.ox = $game_map.display_x / 8
@panorama.oy = $game_map.display_y / 8
end
#--------------------------------------------------------------------------
# * Update Fog Plane
#--------------------------------------------------------------------------
def update_fog_plane
# Update fog plane
@fog.zoom_x = $game_map.fog_zoom / 100.0
@fog.zoom_y = $game_map.fog_zoom / 100.0
@fog.opacity = $game_map.fog_opacity
@fog.blend_type = $game_map.fog_blend_type
@fog.ox = $game_map.display_x / 4 + $game_map.fog_ox
@fog.oy = $game_map.display_y / 4 + $game_map.fog_oy
@fog.tone = $game_map.fog_tone
end
#--------------------------------------------------------------------------
# * Update Character Sprites
#--------------------------------------------------------------------------
def update_character_sprites
# Update character sprites
for sprite in @character_sprites
sprite.update
end
end
#--------------------------------------------------------------------------
# * Update Weather
#--------------------------------------------------------------------------
def update_weather
# Update weather graphic
@weather.type = $game_screen.weather_type
@weather.max = $game_screen.weather_max
@weather.ox = $game_map.display_x / 4
@weather.oy = $game_map.display_y / 4
@weather.update
end
#--------------------------------------------------------------------------
# * Update Picture Sprites
#--------------------------------------------------------------------------
def update_picture_sprites
# Update picture sprites
for sprite in @picture_sprites
sprite.update
end
end
end

#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
# This class performs title screen processing.
#==============================================================================

class Scene_Title
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
return if main_battle_test?
main_database
main_background
main_menu
main_test_continue
main_audio
# Execute transition
Graphics.transition
# Main loop
loop do
main_loop
break if main_scenechange?
end
# Prepare for transition
Graphics.freeze
main_dispose
end
#--------------------------------------------------------------------------
# * Battle Test Check
#--------------------------------------------------------------------------
def main_battle_test?
# If battle test
if $BTEST
battle_test
return true
end
return false
end
#--------------------------------------------------------------------------
# * Load Database
#--------------------------------------------------------------------------
def main_database
# Load database
$data_actors = load_data("Data/Actors.rxdata")
$data_classes = load_data("Data/Classes.rxdata")
$data_skills = load_data("Data/Skills.rxdata")
$data_items = load_data("Data/Items.rxdata")
$data_weapons = load_data("Data/Weapons.rxdata")
$data_armors = load_data("Data/Armors.rxdata")
$data_enemies = load_data("Data/Enemies.rxdata")
$data_troops = load_data("Data/Troops.rxdata")
$data_states = load_data("Data/States.rxdata")
$data_animations = load_data("Data/Animations.rxdata")
$data_tilesets = load_data("Data/Tilesets.rxdata")
$data_common_events = load_data("Data/CommonEvents.rxdata")
$data_system = load_data("Data/System.rxdata")
# Make system object
$game_system = Game_System.new
end
#--------------------------------------------------------------------------
# * Background Initialization
#--------------------------------------------------------------------------
def main_background
# Make title graphic
@sprite = Sprite.new
@sprite.bitmap = RPG::Cache.title($data_system.title_name)
end
#--------------------------------------------------------------------------
# * Main Menu Initialization
#--------------------------------------------------------------------------
def main_menu
# Make command window
s1 = "New Game"
s2 = "Continue"
s3 = "Shutdown"
@command_window = Window_Command.new(192, [s1, s2, s3])
@command_window.back_opacity = 160
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 288
end
#--------------------------------------------------------------------------
# * Main Test Initialization
#--------------------------------------------------------------------------
def main_test_continue
# Continue enabled determinant
# Check if at least one save file exists
# If enabled, make @continue_enabled true; if disabled, make it false
@continue_enabled = false
for i in 0..3
if FileTest.exist?("Save#{i+1}.rxdata")
@continue_enabled = true
end
end
# If continue is enabled, move cursor to "Continue"
# If disabled, display "Continue" text in gray
if @continue_enabled
@command_window.index = 1
else
@command_window.disable_item(1)
end
end
#--------------------------------------------------------------------------
# * Main Audio Initialization
#--------------------------------------------------------------------------
def main_audio
# Play title BGM
$game_system.bgm_play($data_system.title_bgm)
# Stop playing ME and BGS
Audio.me_stop
Audio.bgs_stop
end
#--------------------------------------------------------------------------
# * Main Loop
#--------------------------------------------------------------------------
def main_loop
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
end
#--------------------------------------------------------------------------
# * Main Scene Scene Change
#--------------------------------------------------------------------------
def main_scenechange?
# Abort loop if screen is changed
if $scene != self
return true
end
return false
end
#--------------------------------------------------------------------------
# * Main Dispose
#--------------------------------------------------------------------------
def main_dispose
automatic_dispose
end
end

#==============================================================================
# ** Scene_Map
#------------------------------------------------------------------------------
# This class performs map screen processing.
#==============================================================================

class Scene_Map

ACTIVATED
Show Signature
ACTIVATED
ACTIVATED
ACTIVATED
#17 Re: XAS - Respawn Timer
Loading

rpg-dutch

ACTIVATED
ACTIVATED
ACTIVATED
profile
part 2 of sdk

Spoiler:
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
main_draw
# Main loop
loop do
main_loop
break if main_scenechange?
end
main_dispose
main_tiletrigger
end
#--------------------------------------------------------------------------
# * Main Draw
#--------------------------------------------------------------------------
def main_draw
# Make sprite set
@spriteset = Spriteset_Map.new
# Make message window
@message_window = Window_Message.new
# Transition run
Graphics.transition
end
#--------------------------------------------------------------------------
# * Main Loop
#--------------------------------------------------------------------------
def main_loop
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
end
#--------------------------------------------------------------------------
# * Main Scene Change
#--------------------------------------------------------------------------
def main_scenechange?
# Abort loop if screen is changed
if $scene != self
return true
end
return false
end
#--------------------------------------------------------------------------
# * Main Dispose
#--------------------------------------------------------------------------
def main_dispose
Graphics.freeze
@spriteset.dispose
automatic_dispose
end
#--------------------------------------------------------------------------
# * Main Tiletrigger
#--------------------------------------------------------------------------
def main_tiletrigger
# If switching to title screen
if $scene.is_a?(Scene_Title)
# Fade out screen
Graphics.transition
Graphics.freeze
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Loop
loop do
update_systems
# Abort loop if player isn't place moving
unless $game_temp.player_transferring
break
end
# Run place move
transfer_player
# Abort loop if transition processing
if $game_temp.transition_processing
break
end
end
update_graphics
return if update_game_over? == true
return if update_to_title? == true
# If transition processing
if $game_temp.transition_processing
# Clear transition processing flag
$game_temp.transition_processing = false
# Execute transition
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
# If showing message window
if $game_temp.message_window_showing
return
end
# If encounter list isn't empty, and encounter count is 0
if $game_player.encounter_count == 0 and $game_map.encounter_list != []
# If event is running or encounter is not forbidden
unless $game_system.map_interpreter.running? or
$game_system.encounter_disabled
# Confirm troop
n = rand($game_map.encounter_list.size)
troop_id = $game_map.encounter_list[n]
# If troop is valid
if $data_troops[troop_id] != nil
# Set battle calling flag
$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
update_call_menu
update_call_debug
# If player is not moving
unless $game_player.moving?
update_scene
end
end
#--------------------------------------------------------------------------
# * Update Systems
#--------------------------------------------------------------------------
def update_systems
# Update map, interpreter, and player order
# (this update order is important for when conditions are fulfilled
# to run any event, and the player isn't provided the opportunity to
# move in an instant)
$game_map.update
$game_system.map_interpreter.update
$game_player.update
# Update system (timer), screen
$game_system.update
$game_screen.update
end
#--------------------------------------------------------------------------
# * Update Graphics
#--------------------------------------------------------------------------
def update_graphics
# Update sprite set
@spriteset.update
# Update message window
@message_window.update
end
#--------------------------------------------------------------------------
# * Update Game Over
#--------------------------------------------------------------------------
def update_game_over?
# If game over
if $game_temp.gameover
# Switch to game over screen
$scene = Scene_Gameover.new
return true
end
return false
end
#--------------------------------------------------------------------------
# * Update To Title
#--------------------------------------------------------------------------
def update_to_title?
# If returning to title screen
if $game_temp.to_title
# Change to title screen
$scene = Scene_Title.new
return true
end
return false
end
#--------------------------------------------------------------------------
# * Update Menu Call
#--------------------------------------------------------------------------
def update_call_menu
# If B button was pressed
if Input.trigger?(Input::B)
# If event is running, or menu is not forbidden
unless $game_system.map_interpreter.running? or
$game_system.menu_disabled
# Set menu calling flag or beep flag
$game_temp.menu_calling = true
$game_temp.menu_beep = true
end
end
end
#--------------------------------------------------------------------------
# * Update Debug Call
#--------------------------------------------------------------------------
def update_call_debug
# If debug mode is ON and F9 key was pressed
if $DEBUG and Input.press?(Input::F9)
# Set debug calling flag
$game_temp.debug_calling = true
end
end
#--------------------------------------------------------------------------
# * Update Scene
#--------------------------------------------------------------------------
def update_scene
# Run calling of each screen
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

#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs menu screen processing.
#==============================================================================

class Scene_Menu
#--------------------------------------------------------------------------
# * Object Initialization
# menu_index : command cursor's initial position
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
commands_init
end
#--------------------------------------------------------------------------
# * Set Commands
#--------------------------------------------------------------------------
def commands_init
@commands = []
s1 = $data_system.words.item
s2 = $data_system.words.skill
s3 = $data_system.words.equip
s4 = "Status"
s5 = "Save"
s6 = "End Game"
@commands.push(s1, s2, s3, s4, s5, s6).flatten!
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
main_command_window
main_windows
# Execute transition
Graphics.transition
# Main loop
loop do
main_loop
break if main_scenechange?
end
# Refresh map
$game_map.refresh
# Prepare for transition
Graphics.freeze
main_dispose
end
#--------------------------------------------------------------------------
# * Main Command Window
#--------------------------------------------------------------------------
def main_command_window
@command_window = Window_Command.new(160, @commands)
@command_window.index = @menu_index
@command_window.height = 224
# If number of party members is 0
if $game_party.actors.size == 0
# Disable items, skills, equipment, and status
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
# If save is forbidden
if $game_system.save_disabled
# Disable save
@command_window.disable_item(4)
end
end
#--------------------------------------------------------------------------
# * Main Command Window
#--------------------------------------------------------------------------
def main_windows
# Make play time window
@playtime_window = Window_PlayTime.new
@playtime_window.x = 0
@playtime_window.y = 224
# Make steps window
@steps_window = Window_Steps.new
@steps_window.x = 0
@steps_window.y = 320
# Make gold window
@gold_window = Window_Gold.new
@gold_window.x = 0
@gold_window.y = 416
# Make status window
@status_window = Window_MenuStatus.new
@status_window.x = 160
@status_window.y = 0
end
#--------------------------------------------------------------------------
# * Main Loop
#--------------------------------------------------------------------------
def main_loop
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
end
#--------------------------------------------------------------------------
# * Scene Change
#--------------------------------------------------------------------------
def main_scenechange?
# Abort loop if screen is changed
if $scene != self
return true
end
return false
end
#--------------------------------------------------------------------------
# * Main Dispose
#--------------------------------------------------------------------------
def main_dispose
# Dispose of windows
@command_window.dispose
@playtime_window.dispose
@steps_window.dispose
@gold_window.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@command_window.update
@playtime_window.update
@steps_window.update
@gold_window.update
@status_window.update
# If command window is active: call update_command
if @command_window.active
update_command
return
end
# If status window is active: call update_status
if @status_window.active
update_status
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when command window is active)
#--------------------------------------------------------------------------
def update_command
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to map screen
$scene = Scene_Map.new
return
end
# If C button was pressed
if Input.trigger?(Input::C)
update_command_check
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when status window is active)
#--------------------------------------------------------------------------
def update_status
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Make command window active
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
# If C button was pressed
if Input.trigger?(Input::C)
buzzer_check
update_status_check unless buzzer_check
return
end
end
#--------------------------------------------------------------------------
# * Buzzer Check
#--------------------------------------------------------------------------
def buzzer_check
# If command other than save or end game, and party members = 0
if $game_party.actors.size == 0 and @command_window.index < 4
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return true
end
end
#--------------------------------------------------------------------------
# * Update Command Check
#--------------------------------------------------------------------------
def update_command_check
# Loads Current Command
command = @commands[@command_window.index]
# Checks Commands
if command == $data_system.words.item
command_item
elsif command == $data_system.words.skill
command_start_skill
elsif command == $data_system.words.equip
command_start_equip
elsif command == 'Status'
command_start_status
elsif command == 'Save'
command_save
elsif command == 'End Game'
command_endgame
end
end
#--------------------------------------------------------------------------
# * Update Status Check
#--------------------------------------------------------------------------
def update_status_check
# Loads Current Command
command = @commands[@command_window.index]
# Checks Command By Name
if command == $data_system.words.skill
command_skill
elsif command == $data_system.words.equip
command_equip
elsif command == 'Status'
command_status
end
end
#--------------------------------------------------------------------------
# * Command Item
#--------------------------------------------------------------------------
def command_item
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to item screen
$scene = Scene_Item.new
end
#--------------------------------------------------------------------------
# * Command Start Skill
#--------------------------------------------------------------------------
def command_start_skill
activate_status
end
#--------------------------------------------------------------------------
# * Command Skill
#--------------------------------------------------------------------------
def command_skill
# If this actor's action limit is 2 or more
if $game_party.actors[@status_window.index].restriction >= 2
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to skill screen
$scene = Scene_Skill.new(@status_window.index)
end
#--------------------------------------------------------------------------
# * Command Start Equip
#--------------------------------------------------------------------------
def command_start_equip
activate_status
end
#--------------------------------------------------------------------------
# * Command Equip
#--------------------------------------------------------------------------
def command_equip
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to equipment screen
$scene = Scene_Equip.new(@status_window.index)
end
#--------------------------------------------------------------------------
# * Command Start Status
#--------------------------------------------------------------------------
def command_start_status
activate_status
end
#--------------------------------------------------------------------------
# * Command Status
#--------------------------------------------------------------------------
def command_status
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to status screen
$scene = Scene_Status.new(@status_window.index)
end
#--------------------------------------------------------------------------
# * Command Save
#--------------------------------------------------------------------------
def command_save
# If saving is forbidden
if $game_system.save_disabled
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to save screen
$scene = Scene_Save.new
end
#--------------------------------------------------------------------------
# * Command End Game
#--------------------------------------------------------------------------
def command_endgame
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to end game screen
$scene = Scene_End.new
end
#--------------------------------------------------------------------------
# * Activate Status Window
#--------------------------------------------------------------------------
def activate_status
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
end
end

#==============================================================================
# ** Scene_Save
#------------------------------------------------------------------------------
# This class performs save screen processing.
#==============================================================================

class Scene_Save < Scene_File
#--------------------------------------------------------------------------
# * Write Save Data
# file : write file object (opened)
#--------------------------------------------------------------------------
def write_save_data(file)
write_characters(file)
write_frame(file)
write_setup(file)
write_data(file)
end
#--------------------------------------------------------------------------
# * Make Character Data
#--------------------------------------------------------------------------
def write_characters(file)
# Make character data for drawing save file
characters = []
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
characters.push([actor.character_name, actor.character_hue])
end
# Write character data for drawing save file
Marshal.dump(characters, file)
end
#--------------------------------------------------------------------------
# * Write Frame Count
#--------------------------------------------------------------------------
def write_frame(file)
# Wrire frame count for measuring play time
Marshal.dump(Graphics.frame_count, file)
end
#--------------------------------------------------------------------------
# * Write Setup
#--------------------------------------------------------------------------
def write_setup(file)
# Increase save count by 1
$game_system.save_count += 1
# Save magic number
# (A random value will be written each time saving with editor)
$game_system.magic_number = $data_system.magic_number
end
#--------------------------------------------------------------------------
# * Write Data
#--------------------------------------------------------------------------
def write_data(file)
# Write each type of game object
Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
end
end

#==============================================================================
# ** Scene_Load
#------------------------------------------------------------------------------
# This class performs load screen processing.
#==============================================================================

class Scene_Load < Scene_File
#--------------------------------------------------------------------------
# * Read Save Data
# file : file object for reading (opened)
#--------------------------------------------------------------------------
def read_save_data(file)
read_characters(file)
read_frame(file)
read_data(file)
read_edit
read_refresh
end
#--------------------------------------------------------------------------
# * Read Character Data
#--------------------------------------------------------------------------
def read_characters(file)
# Read character data for drawing save file
characters = Marshal.load(file)
end
#--------------------------------------------------------------------------
# * Read Frame Count
#--------------------------------------------------------------------------
def read_frame(file)
# Read frame count for measuring play time
Graphics.frame_count = Marshal.load(file)
end
#--------------------------------------------------------------------------
# * Read Data
#--------------------------------------------------------------------------
def read_data(file)
# Read each type of game object
$game_system = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_screen = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)
end
#--------------------------------------------------------------------------
# * Read Edit
#--------------------------------------------------------------------------
def read_edit
# If magic number is different from when saving
# (if editing was added with editor)
if $game_system.magic_number != $data_system.magic_number
# Load map
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
end
#--------------------------------------------------------------------------
# * Refresh Game Party
#--------------------------------------------------------------------------
def read_refresh
# Refresh party members
$game_party.refresh
end
end

#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# This class performs battle screen processing.
#==============================================================================

class Scene_Battle
#--------------------------------------------------------------------------
# * Object Initialization
# menu_index : command cursor's initial position
#--------------------------------------------------------------------------
def initialize
commands_init
end
#--------------------------------------------------------------------------
# * Set Commands
#--------------------------------------------------------------------------
def commands_init
@commands = []
s1 = $data_system.words.attack
s2 = $data_system.words.skill
s3 = $data_system.words.guard
s4 = $data_system.words.item
@commands.push(s1, s2, s3, s4).flatten!
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
main_temp
main_troop
main_command
main_windows
main_spriteset
main_transition
# Start pre-battle phase
start_phase1
# Execute transition
Graphics.transition
# Main loop
loop do
main_loop
break if main_scenechange?
end
# Refresh map
$game_map.refresh
# Prepare for transition
Graphics.freeze
main_dispose
main_end
end
#--------------------------------------------------------------------------
# * Game Temp Variable Setup
#--------------------------------------------------------------------------
def main_temp
# Initialize each kind of temporary battle data
$game_temp.in_battle = true
$game_temp.battle_turn = 0
$game_temp.battle_event_flags.clear
$game_temp.battle_abort = false
$game_temp.battle_main_phase = false
$game_temp.battleback_name = $game_map.battleback_name
$game_temp.forcing_battler = nil
# Initialize battle event interpreter
$game_system.battle_interpreter.setup(nil, 0)
end
#--------------------------------------------------------------------------
# * Troop Setup
#--------------------------------------------------------------------------
def main_troop
# Prepare troop
@troop_id = $game_temp.battle_troop_id
$game_troop.setup(@troop_id)
end
#--------------------------------------------------------------------------
# * Main Command Setup
#--------------------------------------------------------------------------
def main_command
@actor_command_window = Window_Command.new(160, @commands)
@actor_command_window.height = 160
@actor_command_window.y = 160
@actor_command_window.back_opacity = 160
@actor_command_window.active = false
@actor_command_window.visible = false
end
#--------------------------------------------------------------------------
# * Scene Window Setup
#--------------------------------------------------------------------------
def main_windows
# Make other windows
@party_command_window = Window_PartyCommand.new
@help_window = Window_Help.new
@help_window.back_opacity = 160
@help_window.visible = false
@status_window = Window_BattleStatus.new
@message_window = Window_Message.new
end
#--------------------------------------------------------------------------
# * Spriteset Setup
#--------------------------------------------------------------------------
def main_spriteset
# Make sprite set
@spriteset = Spriteset_Battle.new
# Initialize wait count
@wait_count = 0
end
#--------------------------------------------------------------------------
# * Main Transition
#--------------------------------------------------------------------------
def main_transition
# Execute transition
if $data_system.battle_transition == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$data_system.battle_transition)
end
end
#--------------------------------------------------------------------------

# * Main Loop
#--------------------------------------------------------------------------
def main_loop
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
end
#--------------------------------------------------------------------------
# * Scene Change
#--------------------------------------------------------------------------
def main_scenechange?
# Abort loop if screen is changed
if $scene != self
return true
end
return false
end
#--------------------------------------------------------------------------
# * Main Dispose
#--------------------------------------------------------------------------
def main_dispose
# Dispose of windows
@actor_command_window.dispose
@party_command_window.dispose
@help_window.dispose
@status_window.dispose
@message_window.dispose
@skill_window.dispose unless @skill_window == nil
@item_window.dispose unless @item_window == nil
@result_window.dispose unless @result_window == nil
# Dispose of sprite set
@spriteset.dispose
end
#--------------------------------------------------------------------------
# * Main End
#--------------------------------------------------------------------------
def main_end
# If switching to title screen
if $scene.is_a?(Scene_Title)
# Fade out screen
Graphics.transition
Graphics.freeze
end
# If switching from battle test to any screen other than game over screen
if $BTEST and not $scene.is_a?(Scene_Gameover)
$scene = nil
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
update_event
update_system
update_objects
update_transition
# If message window is showing
if $game_temp.message_window_showing
return
end
# If effect is showing
if @spriteset.effect?
return
end
update_scene_exit
update_abort
update_waiting
update_phase
end
#--------------------------------------------------------------------------
# * Event Update
#--------------------------------------------------------------------------
def update_event
# If battle event is running
if $game_system.battle_interpreter.running?
# Update interpreter
$game_system.battle_interpreter.update
# If a battler which is forcing actions doesn't exist
if $game_temp.forcing_battler == nil
# If battle event has finished running
unless $game_system.battle_interpreter.running?
# Rerun battle event set up if battle continues
unless judge
setup_battle_event
end
end
# If not after battle phase
if @phase != 5
# Refresh status window
@status_window.refresh
end
end
end
end
#--------------------------------------------------------------------------
# * System Update
#--------------------------------------------------------------------------
def update_system
# Update system (timer) and screen
$game_system.update
$game_screen.update
# If timer has reached 0
if $game_system.timer_working and $game_system.timer == 0
# Abort battle
$game_temp.battle_abort = true
end
end
#--------------------------------------------------------------------------
# * Windows and Sprites Update
#--------------------------------------------------------------------------
def update_objects
# Update windows
@help_window.update
@party_command_window.update
@actor_command_window.update
@status_window.update
@message_window.update
# Update sprite set
@spriteset.update
end
#--------------------------------------------------------------------------
# * Transition Update
#--------------------------------------------------------------------------
def update_transition
# If transition is processing
if $game_temp.transition_processing
# Clear transition processing flag
$game_temp.transition_processing = false
# Execute transition
if $game_temp.transition_name == ""
Graphics.transition(20)
else
Graphics.transition(40, "Graphics/Transitions/" +
$game_temp.transition_name)
end
end
end
#--------------------------------------------------------------------------
# * Scene Exit Update
#--------------------------------------------------------------------------
def update_scene_exit
# If game over
if $game_temp.gameover
# Switch to game over screen
$scene = Scene_Gameover.new
return
end
# If returning to title screen
if $game_temp.to_title
# Switch to title screen
$scene = Scene_Title.new
return
end
end
#--------------------------------------------------------------------------
# * Abort Update
#--------------------------------------------------------------------------
def update_abort
# If battle is aborted
if $game_temp.battle_abort
# Return to BGM used before battle started
$game_system.bgm_play($game_temp.map_bgm)
# Battle ends
battle_end(1)
return
end
end
#--------------------------------------------------------------------------
# * Waiting Update
#--------------------------------------------------------------------------
def update_waiting
# If waiting
if @wait_count > 0
# Decrease wait count
@wait_count -= 1
return
end
# If battler forcing an action doesn't exist,
# and battle event is running
if $game_temp.forcing_battler == nil and
$game_system.battle_interpreter.running?
return
end
end
#--------------------------------------------------------------------------
# * Phase Update
#--------------------------------------------------------------------------
def update_phase
# Branch according to phase
case @phase
when 1 # pre-battle phase
update_phase1
when 2 # party command phase
update_phase2
when 3 # actor command phase
update_phase3
when 4 # main phase
update_phase4
when 5 # after battle phase
update_phase5
end
end
#--------------------------------------------------------------------------
# * Frame Update (actor command phase : basic command)
#--------------------------------------------------------------------------
def update_phase3_basic_command
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Go to command input for previous actor
phase3_prior_actor
return
end
# If C button was pressed
if Input.trigger?(Input::C)
check_commands
return
end
end
#--------------------------------------------------------------------------
# * Check Commands
#--------------------------------------------------------------------------
def check_commands
# Loads Current Command
command = @commands[@actor_command_window.index]
# Branches Possible Commands
if command == $data_system.words.attack
update_phase3_command_attack
elsif command == $data_system.words.skill
update_phase3_command_skill
elsif command == $data_system.words.guard
update_phase3_command_guard
elsif command == $data_system.words.item
update_phase3_command_item
end
end
#--------------------------------------------------------------------------
# * Command : Attack
#--------------------------------------------------------------------------
def update_phase3_command_attack
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 0
# Start enemy selection
start_enemy_select
end
#--------------------------------------------------------------------------
# * Command : Skill
#--------------------------------------------------------------------------
def update_phase3_command_skill
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.kind = 1
# Start skill selection
start_skill_select
end
#--------------------------------------------------------------------------
# * Command : Guard
#--------------------------------------------------------------------------
def update_phase3_command_guard
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.kind = 0
@active_battler.current_action.basic = 1
# Go to command input for next actor
phase3_next_actor
end
#--------------------------------------------------------------------------
# * Command : Item
#--------------------------------------------------------------------------
def update_phase3_command_item
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set action
@active_battler.current_action.kind = 2
# Start item selection
start_item_select
end
#--------------------------------------------------------------------------
# * Make Basic Action Results
#--------------------------------------------------------------------------
def make_basic_action_result
# If attack
if @active_battler.current_action.basic == 0
make_basic_action_result_attack
return
end
# If guard
if @active_battler.current_action.basic == 1
make_basic_action_result_guard
return
end
# If escape
if @active_battler.is_a?(Game_Enemy) and
@active_battler.current_action.basic == 2
make_basic_action_result_escape
return
end
# If doing nothing
if @active_battler.current_action.basic == 3
make_basic_action_result_nothing
return
end
end
#--------------------------------------------------------------------------
# * Make Basic Action Results - Attack
#--------------------------------------------------------------------------
def make_basic_action_result_attack
# Set anaimation ID
@animation1_id = @active_battler.animation1_id
@animation2_id = @active_battler.animation2_id
# If action battler is enemy
if @active_battler.is_a?(Game_Enemy)
if @active_battler.restriction == 3
target = $game_troop.random_target_enemy
elsif @active_battler.restriction == 2
target = $game_party.random_target_actor
else
index = @active_battler.current_action.target_index
target = $game_party.smooth_target_actor(index)
end
end
# If action battler is actor
if @active_battler.is_a?(Game_Actor)
if @active_battler.restriction == 3
target = $game_party.random_target_actor
elsif @active_battler.restriction == 2
target = $game_troop.random_target_enemy
else
index = @active_battler.current_action.target_index
target = $game_troop.smooth_target_enemy(index)
end
end
# Set array of targeted battlers
@target_battlers = [target]
# Apply normal attack results
for target in @target_battlers
target.attack_effect(@active_battler)
end
end
#--------------------------------------------------------------------------
# * Make Basic Action Results - Guard
#--------------------------------------------------------------------------
def make_basic_action_result_guard
# Display "Guard" in help window
@help_window.set_text($data_system.words.guard, 1)
end
#--------------------------------------------------------------------------
# * Make Basic Action Results - Escape
#--------------------------------------------------------------------------
def make_basic_action_result_escape
# Display "Escape" in help window
@help_window.set_text("Escape", 1)
# Escape
@active_battler.escape
end
#--------------------------------------------------------------------------
# * Make Basic Action Results - Nothing
#--------------------------------------------------------------------------
def make_basic_action_result_nothing
# Clear battler being forced into action
$game_temp.forcing_battler = nil
# Shift to step 1
@phase4_step = 1
end
end
ACTIVATED
Show Signature
ACTIVATED
EVENTALIST
EVENTALIST
#18 Re: XAS - Respawn Timer
Loading

mr_wiggles

avatar
EVENTALIST
 EVENTALIST
EVENTALIST
profile
have you used my most recent version of the script i recently updated.

for your SDK problem you have some add on scripts that use it like this one - Swap Dead Actor.
EVENTALIST
Show Signature
EVENTALIST
ACTIVATED
ACTIVATED
#19 Re: XAS - Respawn Timer
Loading

rpg-dutch

ACTIVATED
ACTIVATED
ACTIVATED
profile
Yeah tried your most recent version, still no luck
ACTIVATED
Show Signature
ACTIVATED
EVENTALIST
EVENTALIST
#20 Re: XAS - Respawn Timer
Loading

mr_wiggles

avatar
EVENTALIST
 EVENTALIST
EVENTALIST
profile
well im sorry i have no clue then if the script was set up correctly in your data base it will work fine, i have tested this script in both 3.7 and 3,6 and it works in both of them. is it still the same problem?

(can you take a screen shot of what your database looks like?)
example:

[You must be registered and logged in to see this image.]

*also still thinking it was my code, i tested more then once and even made a minor update with cleaner code.
EVENTALIST
Show Signature
EVENTALIST
ACTIVATED
ACTIVATED
#21 Re: XAS - Respawn Timer
Loading

rpg-dutch

ACTIVATED
ACTIVATED
ACTIVATED
profile
Spoiler:
[You must be registered and logged in to see this image.]

Tried the updated code, no luck.
ACTIVATED
Show Signature
ACTIVATED
ACTIVATED
ACTIVATED
#22 Re: XAS - Respawn Timer
Loading

Entis

ACTIVATED
ACTIVATED
ACTIVATED
profile
The script does not work for me correctly
the timer works but not the never respawn
I have the script in version 3.7f under the XRXS - Damage pop
now when I kill a monster and then leave the map and then re-enter
all monster respawnd
I made a comment on the first event page
NEVER_RESPAWN
and no other script in the project
I hope you can help me

ps. sorry for the bad english I'm German
ACTIVATED
Show Signature
ACTIVATED
http://www.legendoferthia.com/
EVENTALIST
EVENTALIST
#23 Re: XAS - Respawn Timer
Loading

mr_wiggles

avatar
EVENTALIST
 EVENTALIST
EVENTALIST
profile
yea i was aware of this, the reason is that i don't have the re-spawn start until the enemy is "fully" dead (meaning that it has went through the process of fading away or what have you)


when I found the time I was gonna see about another way of starting the enemy's spawn timer instead of going through Game_Map remove token.

Also when i get the time i see that this script needs a demo to help with the questions of its use.


I found some time, made a demo, and i also made a few updates to the script. The update along with the demo should help with any further questions. Also i did fix the re-spawning problem when leaving the map before the enemy finished its defeat process.

I have also fixed the never re-spawn problem.
EVENTALIST
Show Signature
EVENTALIST
ACTIVATED
ACTIVATED
#24 Re: XAS - Respawn Timer
Loading

Entis

ACTIVATED
ACTIVATED
ACTIVATED
profile
thanks the script works
ACTIVATED
Show Signature
ACTIVATED
http://www.legendoferthia.com/
Active Member
Active Member
#25 Re: XAS - Respawn Timer
Loading

LiTTleDRAgo

avatar
Active Member
Active Member
Active Member
profile
I inserted the script below XRXS - Animated Char and the script seems have no effect
(currently using XAS 3.9.1)

the enemies not respawning

please help
Active Member
Show Signature
Active Member
http://littledrago.blogspot.com
EVENTALIST
EVENTALIST
#26 Re: XAS - Respawn Timer
Loading

mr_wiggles

avatar
EVENTALIST
 EVENTALIST
EVENTALIST
profile
Well i don't have 3.91 on my computer at the moment, but it seems i will need to take a closer look at the system its self. My internet is slow and i doubt i can complete a download but when i find a more reliable source i will download 3.91 and take a look at writing a version for it.
EVENTALIST
Show Signature
EVENTALIST
Active Member
Active Member
#27 Re: XAS - Respawn Timer
Loading

kimono

avatar
Active Member
Active Member
Active Member
profile
You respawn timer script is very useful, I set the enemy with the comment NEVER_RESPAWN and I've got a small graphical bug: the enemy doesn't entirely disappear, I can see him at 50 opacity approximately.

I use the 3.91 current version of XAS.

Active Member
Show Signature
Active Member
EVENTALIST
EVENTALIST
#28 Re: XAS - Respawn Timer
Loading

mr_wiggles

avatar
EVENTALIST
 EVENTALIST
EVENTALIST
profile
*updated* code
EVENTALIST
Show Signature
EVENTALIST
Active Member
Active Member
#29 Re: XAS - Respawn Timer
Loading

kimono

avatar
Active Member
Active Member
Active Member
profile
Just use -1 as the returned default value for the enemy id tags.
Active Member
Show Signature
Active Member
EVENTALIST
EVENTALIST
#30 Re: XAS - Respawn Timer
Loading

mr_wiggles

avatar
EVENTALIST
 EVENTALIST
EVENTALIST
profile
... well this is odd.. Embarassed

Hey gface i accidentally hit edit button instead of the quote button.

^ so that is what i said, in this post but accidentally changed yours. Embarassed
EVENTALIST
Show Signature
EVENTALIST
ACTIVATED
ACTIVATED
#31 XAS 3.9.1 Version !! XAS respown Timer error
Loading

otakuloko

avatar
ACTIVATED
ACTIVATED
ACTIVATED
profile
I have the 3.9.1 version of XAS ! and the script say error in the line :
XAS_BA_::ITEM_ENEMY...

This error is because XAS 3.9.1 not work with ITEM_ENEMY...

plz Helpme Smile
ACTIVATED
Show Signature
ACTIVATED
EVENTALIST
EVENTALIST
#32 Re: XAS - Respawn Timer
Loading

mr_wiggles

avatar
EVENTALIST
 EVENTALIST
EVENTALIST
profile
Line 78 elsif XAS_BA_ENEMY::ITEM_ENEMY.include?(self.battler.id)
Line 79 respawn = Respawn_Settings::ITEM_RESPAWN_TIME

add # before both lines to turn the text green. should fix it.
EVENTALIST
Show Signature
EVENTALIST
ACTIVATED
ACTIVATED
#33 XAS 3.9.1 Version !! XAS respown Timer error
Loading

otakuloko

avatar
ACTIVATED
ACTIVATED
ACTIVATED
profile
Thanks por reply, sorry my little ingles,but iam from Chile Smile

The script say me error again, this is because the version i have is the 3.9.1 of XAS ABS, the error is in the line :
elsif XAS_BA_ENEMY::ITEM_ENEMY.include
(self.battler.id) (line 78 )

Ok, this line say error because, the version 3.9.1 of Xas not still using
ITEM_ENEMY, I look in the demo and this existing in the other MOG. Plz helpme
ACTIVATED
Show Signature
ACTIVATED
ACTIVATED
ACTIVATED
#34 Re: XAS - Respawn Timer
Loading

otakuloko

avatar
ACTIVATED
ACTIVATED
ACTIVATED
profile
Wow !! sorry, i added # in the lines and it fix Smile thanks for all MR_wiggles !! you are the best Wink
ACTIVATED
Show Signature
ACTIVATED
ACTIVATED
ACTIVATED
#35 Any chance a version for VX ACE
Loading

lazzyydogg1212

avatar
ACTIVATED
ACTIVATED
ACTIVATED
profile
Was wondering if there's a version for vx ace, this is exactly what I need and have been looking for.
ACTIVATED
Show Signature
ACTIVATED

Sponsored content

profile

View previous topic View next topic Back to top Message [Page 1 of 1]

 

Chatbox system disabled
Personal messaging disabled