Location Scrpt V.2
#1
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.


Hey if you like seeing where you are your giong to like this.
It's just a fix of Prexus's Domain script but now it shows a map's name.
Here it is.

Code:
#-------------------------------------------------------------------------------
# Location Script V.2
#-------------------------------------------------------------------------------
#  Made By Tony&Prexus
#-------------------------------------------------------------------------------
$character_change = true
$window_show = true
$window_thickness = 0

class Game_Player < Game_Character
alias domeff_g_player_refresh refresh
def refresh
   domeff_g_player_refresh
   if $character_change == true
     for i in 0...$game_party.actors.size
       if $game_party.actors[i] != nil
         actor = $game_party.actors[i]
         if actor.hp > 0
           @character_name = actor.character_name
           @character_hue = actor.character_hue
           @opacity = 255
           @blend_type = 0
           return
         end
       end
     end
   end
end
end

class String # By Astro_Mech
def find(s1, s2)
   return "outline" unless self.include?(s1)
   sz = s1.length
   a = []
   str = ""
   index = 0
   for i in self.split(//)
     index += 1
     a.push(i)
     if a.join[index-sz, sz] == s1
       break
     end
   end
   a.clear
   sz = s2.length
   newindex = 0
   for i in self.split(//)[index, self.size-1]
     newindex += 1
     a.push(i)
     if a.join[newindex-sz, sz] == s2
       for i in 0...sz
         a.pop
       end
       str = a.join
       break
     end
   end
   return str
end
end

class Game_Map # By Astro_Mech
alias domeff_g_map_refresh refresh
def refresh
   domeff_g_map_refresh
   if $scene.is_a?(Scene_Map)
     if $scene.domain_window != nil
       $scene.domain_window.refresh
     end
   end
end
def get_info
   map_data = load_data("Data/MapInfos.rxdata")[@map_id]
   return map_data.name.find("[", "]").to_s
end
end

class Interpreter
   def command_355
   script = @list[@index].parameters[0] + "\n"
   loop do
     if @list[@index+1].code == 655
       script += @list[@index+1].parameters[0] + "\n"
     else
       break
     end
     @index += 1
   end
   script += "return"
   result = toto(script)
   if result == false
     return false
   end
   return true
end
end

class Window_Domain < Window_Base
attr_accessor :old_chance
def initialize
   super(-16, -16, 240, 112)
   self.contents = Bitmap.new(width-32, height-32)
   self.opacity = 0
   @old_chance = 0
   refresh
end
def refresh
   self.contents.clear
   if $window_text ==
     self.contents.font.color = Color.new(0,0,0,255)
     self.contents.draw_text(7 + $window_thickness, 7 + $window_thickness, self.contents.width-8, 32, "Location: " + $game_map.get_info.to_s)
   elsif $window_text == "outline"
  
   end
   self.contents.font.color = normal_color
   self.contents.draw_text(7, 7, self.contents.width-8, 32, "Location: " + � $game_map.get_info.to_s)
   case $game_map.get_info.upcase
   when "POISON"
     if $scene.is_a?(Scene_Map)
       chance = $scene.chance.to_s
     else
       chance = "Unknown"
     end
     if $window_text == "outline"
       self.contents.font.color = Color.new(0,0,0,255)
       self.contents.draw_text(7 + $window_thickness, 39 + $window_thickness, self.contents.width-8, 32, "Affliction Rate: " + chance.to_s + "%")
     elsif $window_text == "outline"
       self.contents.font.color = Color.new(0,0,0,255)
       self.contents.draw_text(7 + $window_thickness, 39 + $window_thickness, self.contents.width-8, 32, "Affliction Rate: " + chance.to_s + "%")
       self.contents.draw_text(7 + $window_thickness, 39 - $window_thickness, self.contents.width-8, 32, "Affliction Rate: " + chance.to_s + "%")
       self.contents.draw_text(7 - $window_thickness, 39 + $window_thickness, self.contents.width-8, 32, "Affliction Rate: " + chance.to_s + "%")
       self.contents.draw_text(7 - $window_thickness, 39 - $window_thickness, self.contents.width-8, 32, "Affliction Rate: " + chance.to_s + "%")
     end
     self.contents.font.color = normal_color
     self.contents.draw_text(7, 39, self.contents.width-8, 32, "Affliction Rate: " + chance.to_s + "%")
   end
end
def update
   if $scene.is_a?(Scene_Map)
     if $scene.chance.to_i != @old_chance.to_i and $game_map.get_info.upcase == "POISON"
       refresh
       @old_chance = $scene.chance
     end
   end
end
end

class Scene_Map
alias domeff_s_map_transfer_player transfer_player
def transfer_player
   domeff_s_map_transfer_player
   if @domain_window != nil
     @domain_window.refresh
   end
end
end

#===================================================
# - CLASS Your_Scene Begins
#===================================================
class Your_Scene
  
#---------------------------------------------------------------------------------
  def initialize
  end
#---------------------------------------------------------------------------------

def main
    @window1 = Window1.new
    @window1.x =0
    @window1.y =0
    @window1.height = 55
    @window1.width = 182
   #@window1.z = 200    
     Graphics.transition
    loop do
      Graphics.update
      Input.update
     #update
      if $scene != self
        break
      end
    end

    Graphics.freeze
  
  end
#---------------------------------------------------------------------------------

#---------------------------------------------------------------------------------
  def update
  @window1.update
  end
#---------------------------------------------------------------------------------

end
#===================================================
# - CLASS Your_Scene Ends
#===================================================



#===================================================
# - CLASS Window1 Begins
#===================================================

class Window1 < Window_Base

#---------------------------------------------------------------------------------
  def initialize
    super(0, 0, 182,55)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = "Tahoma"
    self.contents.font.size = 22
    self.contents.font.color = text_color(0)
    self.contents.draw_text(0, 0, 33, 33, "1")
  end
#---------------------------------------------------------------------------------

end
#===================================================
# - CLASS Window1 Ends
#===================================================
# -- For [FIRE] --
# Info:
# Fire is a damage over time effect. It can be changed to mean other things, but
# as it is, it synthesizes a situation where extreme heat is taking its toll on
# the party's bodies. This causes the skin and such to bubble and burst, harming
# the members of the party. Fire resistant armor will defend against this.
#
# Option can be set to direct or percentage.
# - Direct will decrease the amount of HP by the value in Damage
# - Percentage will decrease the HP by the percentage in damage.
# Lethal will decide whether or not the damage can kill.
# - true will make it able to kill
# - false will make sure the HP is set to 1 rather than kill
# Damage can be set to a value that corresponds with Direct
# Protection can be set to the element ID of Fire.
#
# Definables::

$fire_option = "none" # Set to either "direct" or "percentage".
$fire_lethal = true # Set to true if you want it to be able to kill and false if not.
$fire_damage = 10 # Set to the value of damage.
$fire_protection = 0 # Set to the element ID of Fire.

# ::End

# -- For [CURE] --
# Info:
# Sometimes the Gods intervene and create a holy place where one has his wounds
# tended to by invisible angels. Over time, one can recover all his strength.
#
# Definables::

$cure_option = "direct" # Set to either "direct" or "percentage"
$cure_heal = 10 # Set to the value of healing
$cure_states = true # Set to true if you want cure domains to recover status effects including death.

# ::End

# -- For [POISON] --
# Info:
# Toxic gases can inflict a bad state of being through a variety of means. One
# such method is being through inhaling the toxic gas. This synthesizes this
# situation by checking a certain range around the player for tiles with an ID,
# these tiles representing tiles where toxic gases would be emitted from.
# In a situation where one is pretty distant from the source, the chance of
# being afflicted with a bad state of being is minimal however when one is close
# to the source, or close to many sources, the chances are much greater.
#
# Definables::

$poison_range = 2 # Set to the amount of squares from which one can inhale toxins.
$poison_tileID = 1 # Set to the Terrain Tag ID of toxic sources.
$poison_id = 3 # Set to the ID of Poison in the Status tab of the database.
$poison_chance = 5 # Set this to the percentage chance of inflicting..

# Note about Chance, make it lower if the range is higher.
# ::End

# -- For [COLD] --
# Info:
# Cold is a slowing effect. When matter becomes cold, the molecules slow down.
# This causes a lapse in reaction time and speed.
#
# Protection can be set to the element ID of Ice/Cold.
#
# Definables::

$cold_protection = 2 # Set to the element ID of Ice/Cold.

# ::End

class Scene_Map
attr_accessor :domain_window
attr_accessor :chance
alias domeff_s_map_main main
alias domeff_s_map_update update
def main
   @domain_window = Window_Domain.new
   @map_counter = 0
   @chance = 0
   domeff_s_map_main
   @domain_window.dispose
end
def update
   domeff_s_map_update
   if @domain_window.visible
     @domain_window.update
   end
   @domain_window.visible = $window_show
   map_type = $game_map.get_info.upcase
   case map_type
   when "FIRE"
     if @map_counter > 20
       @map_counter = 0
       $game_screen.start_flash(Color.new(0,0,0,0), 10)
       for i in 0...$game_party.actors.size
         actor = $game_party.actors[i]
         # Shield Protection
         armor = $data_armors[actor.armor1_id]
         if armor != nil
           next if armor.guard_element_set.include?($fire_protection)
         end
         # Head Protection
         armor = $data_armors[actor.armor2_id]
         if armor != nil
           next if armor.guard_element_set.include?($fire_protection)
         end
         # Armor Protection
         armor = $data_armors[actor.armor3_id]
         if armor != nil
           next if armor.guard_element_set.include?($fire_protection)
         end
         # Accessory Protection
         armor = $data_armors[actor.armor4_id]
         if armor != nil
           next if armor.guard_element_set.include?($fire_protection)
         end
         if $fire_option.upcase == "DIRECT"
           if $fire_lethal == true
             next if actor.hp == 0
             actor.hp -= $fire_damage
             if actor.hp == 0
               $game_system.se_play($data_system.actor_collapse_se)
               $game_temp.gameover = $game_party.all_dead?
             end
           else
             if (actor.hp - $fire_damage) <= 0
               actor.hp = 1
             end
           end
         elsif $fire_option.upcase == "PERCENTAGE"
           if $fire_lethal == true
             next if actor.hp == 0
             actor.hp -= (actor.maxhp / $fire_damage).floor
             if actor.hp == 0
               $game_system.se_play($data_system.actor_collapse_se)
               $game_temp.gameover = $game_party.all_dead?
             end
           else
             if (actor.hp -= (actor.maxhp / $fire_damage).floor) <= 0
               actor.hp = 1
             end
           end
         end
       end
       $game_map.need_refresh
       $game_player.refresh
     else
       @map_counter += 1
     end
   when "CURE"
     if @map_counter > 20
       @map_counter = 0
       $game_screen.start_flash(Color.new(0,0,0,0), 5)
       for i in 0...$game_party.actors.size
         actor = $game_party.actors[i]
         if $cure_option.upcase == "DIRECT"
           actor.hp += $cure_heal
         elsif $cure_option.upcase == "PERCENTAGE"
           actor.hp += (actor.maxhp / $cure_heal).floor
         end
         if $cure_states
           for k in actor.states.clone
             actor.remove_state(k)
           end
         end
       end
       $game_map.need_refresh
       $game_player.refresh
     else
       @map_counter += 1
     end
when "POISON"
     if @map_counter > 20
       @map_counter = 0
       check_poison
     else
       @map_counter += 1
     end
   end
end
def check_poison
   @chance = 0
   range = $poison_range
   if $game_map.terrain_tag($game_player.x, $game_player.y) == $poison_tileID
     @chance += 0
   end
   for i in 1..range
     if $game_map.terrain_tag($game_player.x + i, $game_player.y) == $poison_tileID
       @chance += $poison_chance * (range + 1 - i)
     end
     if $game_map.terrain_tag($game_player.x - i, $game_player.y) == $poison_tileID
       @chance += $poison_chance * (range + 1 - i)
     end
     if $game_map.terrain_tag($game_player.x, $game_player.y + i) == $poison_tileID
       @chance += $poison_chance * (range + 1 - i)
     end
     if $game_map.terrain_tag($game_player.x, $game_player.y - i) == $poison_tileID
       @chance += $poison_chance * (range + 1 - i)
     end
     if $game_map.terrain_tag($game_player.x + i, $game_player.y + i) == $poison_tileID
       @chance += $poison_chance * (range + 1 - i)
     end
     if $game_map.terrain_tag($game_player.x - i, $game_player.y - i) == $poison_tileID
       @chance += $poison_chance * (range + 1 - i)
     end
     if $game_map.terrain_tag($game_player.x - i, $game_player.y + i) == $poison_tileID
       @chance += $poison_chance * (range + 1 - i)
     end
     if $game_map.terrain_tag($game_player.x + i, $game_player.y - i) == $poison_tileID
       @chance += $poison_chance * (range + 1 - i)
     end
   end
   if @chance > (rand(100) + 1)
     for i in 0..$game_party.actors.size
       if $game_party.actors[i] != nil
         $game_party.actors[i].add_state($poison_id)
       end
     end
   end
end
end
class Game_Character
alias domeff_g_character_initialize initialize
alias domeff_g_character_update update
def initialize
   domeff_g_character_initialize
   @default_speed = 4
   @default_frequency = 6
end
def update
   if self.is_a?(Game_Player)
     @move_speed = @default_speed
     @move_frequency = @default_frequency
     map_type = $game_map.get_info.upcase
     case map_type
     when "COLD"
       for i in 0..$game_party.actors.size
         actor = $game_party.actors[i]
         if actor != nil
           # Shield Protection
           armor = $data_armors[actor.armor1_id]
           if armor != nil
             next if armor.guard_element_set.include?($cold_protection)
           end
           # Head Protection
           armor = $data_armors[actor.armor2_id]
           if armor != nil
             next if armor.guard_element_set.include?($cold_protection)
           end
           # Armor Protection
           armor = $data_armors[actor.armor3_id]
           if armor != nil
             next if armor.guard_element_set.include?($cold_protection)
           end
           # Accessory Protection
           armor = $data_armors[actor.armor4_id]
           if armor != nil
             next if armor.guard_element_set.include?($cold_protection)
           end
         end
       end
     end
   end
   domeff_g_character_update
end
end

Don't forget to put your maps name in these []

Credit to Prexus and Tony
}


Possibly Related Threads…
Thread Author Replies Views Last Post
  Location Window Eccid 0 2,447 09-11-2005, 01:00 PM
Last Post: Eccid
  Different Location Script KaotiX 0 2,618 09-02-2005, 01:00 PM
Last Post: KaotiX
  Location Tony 0 2,320 06-28-2005, 01:00 PM
Last Post: Tony



Users browsing this thread: 2 Guest(s)