Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Event Cloning Script not updating?, Events disappearing! Please check 3rd post. :)
Erangot
post Jan 26 2012, 06:23 PM
Post #1


Level 2
Group Icon

Group: Member
Posts: 19
Type: Artist
RM Skill: Skilled




I am using DrakoShade's Self-Variable Script and whenever I start, it gives an error like this:



It mentioned there that it's incompatible with anything else that alters the conditions_met? method of Game_Event.
Is there any way someone could fix this? Thank you guys so much :'>

Here's his code:
CODE
#==============================================================================
# ** Game_SelfVariables
#------------------------------------------------------------------------------
#  This class handles self variables. It's a wrapper for the built-in class
#  "Hash." Refer to "$game_self_variables" for the instance of this class.
#==============================================================================

class Game_SelfVariables
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    @data = {}
  end
  #--------------------------------------------------------------------------
  # * Get Self Variable
  #     key : key
  #--------------------------------------------------------------------------
  def [](key)
    return @data[key] == nil ? 0 : @data[key]
  end
  #--------------------------------------------------------------------------
  # * Set Self Variable
  #     key   : key
  #     value : the variable's value
  #--------------------------------------------------------------------------
  def []=(key, value)
    @data[key] = [[value, -99999999].max, 99999999].min
  end
end


#==============================================================================
# ** Self Variable Interpreter
#------------------------------------------------------------------------------
# This class handles the translation of $game_self_variables into an array
# so that any individual event can treat its own self_variables as such.  It's
# pretends to be an Array, so far as the interaction requires.
#==============================================================================

class SelfVarInterpreter
  attr_accessor :key
  #---------------------------------------------------------------------------
  # * Object Initialization
  #     key = [$game_map.map_id, @event_id]
  #---------------------------------------------------------------------------
  def initialize
    @key = [0, 0]
  end
  #---------------------------------------------------------------------------
  # * Get Self Variable
  #     variable_id : variable's ID
  #---------------------------------------------------------------------------
  def [](variable_id)
    key = [@key[0], @key[1], variable_id]
    return $game_self_variables[key]
  end
  #---------------------------------------------------------------------------
  # * Set Self Variable
  #     variable_id : variable's ID
  #     value       : the variable's value
  #---------------------------------------------------------------------------
  def []=(variable_id, value)
    key = [@key[0], @key[1], variable_id]
    $game_self_variables[key] = value
    $game_map.need_refresh = true
  end
end


#==============================================================================
# ** Game_Interpreter
#==============================================================================

class Game_Interpreter

  #---------------------------------------------------------------------------
  # * Initialize
  #---------------------------------------------------------------------------
  alias ds_self_variables_initialize initialize
  def initialize(depth = 0, main = false)
    @self_variables = SelfVarInterpreter.new
    ds_self_variables_initialize(depth, main)
  end
  #---------------------------------------------------------------------------
  # * Setup
  #---------------------------------------------------------------------------
  alias ds_self_variables_setup setup
  def setup(list, event_id)
    ds_self_variables_setup(list, event_id)
    @self_variables.key = [@map_id, @event_id]
  end
end

#==============================================================================
# ** Game_Event
#==============================================================================

class Game_Event

  #--------------------------------------------------------------------------
  # * Determine if Event Page Conditions are Met
  #--------------------------------------------------------------------------
  def conditions_met?(page)
    c = page.condition
    if c.switch1_valid      # Swtich 1
      return false if $game_switches[c.switch1_id] == false
    end
    if c.switch2_valid      # Swtich 2
      return false if $game_switches[c.switch2_id] == false
    end
    if c.variable_valid     # Variable
      #----------------------------------------------------------------------
      # Changes begin here.
      #----------------------------------------------------------------------
      for i in 0...page.list.size
        if page.list[i].code == 108
          if page.list[i].parameters[0].include?("use self variable")
            use_self_variable = true
          end
        end
      end
      if use_self_variable == true
        key = [@map_id, @id, c.variable_id]
        return false if $game_self_variables[key] < c.variable_value
      else
        return false if $game_variables[c.variable_id] < c.variable_value
      end
      #----------------------------------------------------------------------
      # Changes end here.
      #----------------------------------------------------------------------
    end
    if c.self_switch_valid  # Self switch
      key = [@map_id, @event.id, c.self_switch_ch]
      return false if $game_self_switches[key] != true
    end
    if c.item_valid         # Item
      item = $data_items[c.item_id]
      return false if $game_party.item_number(item) == 0
    end
    if c.actor_valid        # Actor
      actor = $game_actors[c.actor_id]
      return false unless $game_party.members.include?(actor)
    end
    return true   # Conditions met
  end
end


#==============================================================================
# ** Scene_Title
#------------------------------------------------------------------------------
# Appropriate aliasing made here to create the $game_self_variables hash.
#==============================================================================
class Scene_Title
  alias ds_self_variables_create_game_objects create_game_objects
  def create_game_objects
    $game_self_variables = Game_SelfVariables.new
    ds_self_variables_create_game_objects
  end
end

#==============================================================================
# ** Scene_File
#------------------------------------------------------------------------------
# Self variables added to save_data and load_data.
#==============================================================================
class Scene_File
  alias ds_self_variables_write_save_data write_save_data
  def write_save_data(file)
    ds_self_variables_write_save_data(file)
    Marshal.dump($game_self_variables, file)
  end

  alias ds_self_variables_read_save_data read_save_data
  def read_save_data(file)
    ds_self_variables_read_save_data(file)
    $game_self_variables = Marshal.load(file)
  end
end
EDIT: Thanks to Kread-Ex for solving! :>

This post has been edited by Erangot: Feb 3 2012, 02:44 AM


__________________________

Go to the top of the page
 
+Quote Post
   
Kread-EX
post Jan 27 2012, 01:09 AM
Post #2


(=___=)/
Group Icon

Group: +Gold Member
Posts: 4,136
Type: Scripter
RM Skill: Undisclosed




In the self-variable script, search for this:
CODE
  #---------------------------------------------------------------------------
  # * Setup
  #---------------------------------------------------------------------------
  alias ds_self_variables_setup setup
  def setup(list, event_id)
    ds_self_variables_setup(list, event_id)
    @self_variables.key = [@map_id, @event_id]
  end

See that line: def setup(list, event_id)?
Replace event_id with event_id = 0 and the issue shouldn't arise anymore.


__________________________
FRACTURE - a SMT inspired game (demo) made by Rhyme, Karsuman and me. Weep and ragequit.

My blog.

Click here for my e-peen


Go to the top of the page
 
+Quote Post
   
Erangot
post Feb 3 2012, 12:23 AM
Post #3


Level 2
Group Icon

Group: Member
Posts: 19
Type: Artist
RM Skill: Skilled




@Kread-EX
Y-you're my life saver! ;o; Dang I've been trying to get this work in forever, it's so simple and now the script is working perfectly! Thanks so much!

I wonder if it's okay for you that I get another help?
I've been using the event cloning script:
FlipelyFlip's Event Cloning Script
#========================================================================
=
=====
# ** Events Cloning Script V1.1
#------------------------------------------------------------------------------
# by FlipelyFlip
#------------------------------------------------------------------------------
# thx goes to: Kread-EX
#==============================================================================
=begin
This little script allows you to copy an event from another map to set it on the
located coordinates. You can also call it by variables. You have to config the
Variables under the module Flipely. So you can set the x and y coordinate at the
variables to random. If the coordinates are on an impassable place, they will be
set one place right and one place down. If this place is also impassable, it will
add again the one place right and one place down.
This Feature is only at the variable available.

To call the script you can chose between
$game_map.add_event(map_id,event_id,x,y)

or you will do it with variables, then you have to set up the variables before
calling it with Flipely.koordinaten .

greetings FlipelyFlip
=end

class Spriteset_Map
def refresh
$game_map.need_refresh = true
unless @character_sprites == nil
for sprite in @character_sprites
sprite.dispose
end
end
@character_sprites = []
for i in $game_map.events.keys.sort
sprite = Sprite_Character.new(@viewport1, $game_map.events[i])
@character_sprites.push(sprite)
end
@character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
end
end

class Game_Map
def add_event(map_id,id,x,y)
s = 1
(1..@events.size + 1).each{|s|break unless @events.keys.include?(s)}
map = load_data(sprintf("Data/Map%03d.rvdata", map_id))
ev = map.events[id]
ev.id = s
@events[s] = Game_Event.new(@map_id, ev)
@events[s].moveto(x, y)
return @events[s].id
end
end

module Flipely
def self.passable?
return $game_map.passable?($game_variables[id], $game_variables[id], flag = 0x01)
end
end

module Flipely
def self.koordinaten
if Flipely.passable? == true
$game_map.add_event($game_variables[id],$game_variables[id],$game_variables[id],$game_variables[id])
$scene = Scene_Map.new
else
$game_variables[id] += 1 # change it if you want
$game_variables[id] += 1 # change it if you want
Flipely.koordinaten
end
end
end

But the thing is, whenever I leave a map and go back to the original, the cloned events suddenly disappear.

With Sky's script though, he seemed to have fixed that problem but I don't want to use this script altogether, just Flipely's script independently. Here's Sky's:
Sky00Valentine's Decoration Script
#========================================================================
===
#
# Sky's Room Decoration System(Upgraded Event Cloning by Flipelyflip)
# Version 1.1
# July 8th, 2010 Started
# July 14th, 2010 Completed
#
#===========================================================================
#
# Features :
# Version 1.0 - (July 14th, 2010)
# - Full Wall Decoration Compatibility.
# - Floor Tiles
# * Graphics that are larger than 1 tile will
# only work if they are able to be walked
# over. (meaning things like tables won't
# work unless you don't mind being able to
# walk over it.) So you can use them but
# it will just look like a glitch in your
# game
# - Currently unable to place one event on top
# of the other.
# - Currently Doors are unable to be placed with
# a 100% glitch look as they could be place
# high up on a wall.
# - In decoration menu you can preview what the
# decoration will look like.
# - Because of this being event clones if you
# make a decoration event with stuff to do
# the decoration will also do that when
# activated.
# Version 1.1 - (July 15th, 2010)
# - Bug fixes
# *Maps not saving decorations fixed.
#
#===========================================================================
#
# Credit
# Sky00Valentine :creator and editor
# Flipelyflip :for creating the original event clone script
#
#===========================================================================
#
# Terms of Use
# ------------
#
# Crediting Rpgmakervx.net and FlipelyFlip
# is the only thing I ask. However feel free
# to credit Sky00Valentine if you see fit.
#
#===========================================================================
#
# Future improvement
# ------------------
#
# - Adding Full Functioning Floor tiles including Tables.
# - Adding in more ways for setup including but not limited to
# Hash Mode, which will be you editting the hash instead of
# item noteboxes.
#
#===========================================================================
#
# Instructions & Installation
# ---------------------------
# - Get Flipelyflips Event Cloning Script, place under materials
#
# - Get $model_cursor.png(located in demo)
#
# - Place this script under Event Cloning Script
#
# - Edit MAP_ID hash by placing in all map_id's you want to have
# decoration mode. (This should only include inside maps.) As I did
# not make this for outside so there may be some glitches.
#
# - Edit Event Map, change it to the map id where you will store all of
# your decoration evetns.
#
# - Edit Wall_Map, change it to the map id where you will store all of
# your wall tiles.(This is so you can place items on walls.
#
# - Edit the three Buttons to be which buttons you want to press
# to do the given function. By default they will be the A
# key to enter into edit mode, S to change from Placement to Removal mode
# and Vice-Versa, X key to go into the decoration Menu, and Enter
# or Z key to place or remove a decoration. (X key is the only one not
# customizable)
#
# - To setup your items go to your item notebox and place this
# Decoration:event_id: where event id is the event you want
# to be placed on the map when using that decoration/item.
# You will need that item in your party's inventory in order
# to place that decoration in placement mode.
# You will lose 1 of that item each time you place 1 of that
# decoration. And you will gain 1 each time you remove a
# decoration from the map.
# Also you must put this in an items notebox as well,
# <WALL> if you want that decoration to be placed
# on the wall, and <FLOOR> if you want it to be placed on
# the floor.
#
# - Make sure you have created the event map and the wall map.
# Following the model.
#
# - Make sure on the Event Map your first event is a blank event
# no graphic and priority is set to same as characters.
#
#===========================================================================
#
# Compatibility & Bugs
# --------------------
# - Through aliasing this script should be 100% Compatible with
# any script.
#
#============================================================================

module Sky
module Decor
MAP_ID = [4,5] # all map id's that you can Enter Decoration Mode on.
#example MAP_ID = [3,5,6] Can only decorate maps 3,5, and 6

Event_Map = 2 #Map ID of the stored events map.
#you store all decoration events on this map

Wall_Map = 1 #Map ID of your wall tiles map.
#you store all you wall tiles here on this map.

Button0 = Input::X #The button you want to press to enter decoration mode
Button1 = Input::C #The button you want to press to place/remove decorations
Button2 = Input::Y #The button you want to press to change to place or remove mode.

end
end

class Game_Event
attr_accessor :event
attr_accessor :through
attr_accessor :d_tag
attr_accessor :item
attr_accessor :pages

alias graphic_initialize initialize
def initialize(map_id, event, cg = false)
@cg = cg
graphic_initialize(map_id,event)
end

alias graphic_setup setup
def setup(new_page)
if @cg
graphic_setup(new_page)
@tile_id = 0
@character_name = $game_party.members[0].character_name
@character_index = $game_party.members[0].character_index
@walk_anime = false
@step_anime = false
@direction = $game_player.direction
else
graphic_setup(new_page)
end
@d_tag = nil
@item = nil
end

alias dont_begin start
def start
dont_begin unless $game_map.edit_mode?
end
end

class Game_Character
alias stop_movement turn_toward_player
def turn_toward_player
unless $game_map.edit_mode?
stop_movement
end
end
end

class Game_Interpreter
def return_event
event = $game_map.events
return event == nil ? nil : event[@event_id]
end
end

class Game_Party
attr_accessor :previous_character
attr_accessor :previous_index
attr_accessor :last_decoration

alias previous_initialize initialize
def initialize
previous_initialize
@previous_character = nil
@previous_index = nil
@last_decoration = 0
end

def set_previous(name,index)
@previous_character = name
@previous_index = index
end

end

class Game_Map
attr_accessor :transfers
attr_accessor :changed_tiles
attr_accessor :current_d_event_id
attr_accessor :d_type

alias edit_mode_initialize initialize
def initialize
@current_d_event_id = 0
@editing = false
@placement = true
@blocking_events = []
@c_through = []
@changed_tiles = {}
edit_mode_initialize
end

alias new_setup setup
def setup(map_id)
new_setup(map_id)
@new_events = {}
if $resaved_maps.include?(@map_id)
@new_events = $resaved_maps[@map_id]
@new_events = {} if @new_events == nil
new_event_setup
end
end

def new_event_setup
for i in @new_events.keys
@events[i] = Game_Event.new(@map_id, @new_events[i][0])
@events[i].moveto(@new_events[i][1], @new_events[i][2])
@events[i].d_tag = @new_events[i][3]
@events[i].item = @new_events[i][4]
end
end

def add_new(event_id,cevent,x,y,d_tag,item)
@new_events[event_id] = [cevent,x,y,d_tag,item]
$resaved_maps[@map_id] = @new_events
end

alias block_transfers_setup setup_events
def setup_events
block_transfers_setup
@transfers = []
for i in @map.events.keys
if @map.events[i].name == "transfer"
@transfers.push(i)
end
end
end

def return_location(x,y,direction)
@return_to_x = x
@return_to_y = y
@return_direction = direction
end

def return_to
$game_player.set_direction(@return_direction)
$game_player.moveto(@return_to_x,@return_to_y)
end

def delete_event(event_id)
if @events[event_id].item != nil
$game_party.gain_item($data_items[@events[event_id].item], 1)
end
@events.delete(event_id)
@new_events.delete(event_id)
$scene = Scene_Map.new
end

def blocking_events
return @blocking_events
end

def edit_mode(switch)
@previous_mode = @editing
@editing = switch
if @previous_mode != @editing and not @editing
placement_mode(true)
end
end

def edit_mode?
return @editing
end

def placement_mode?
return @placement
end

def placement_mode(mode)
@previous_mode = @placement
@placement = mode
if @previous_mode != @placement and not @placement
@c_through = []
end
if not @placement
for i in @events.keys
if not @events[i].through
@c_through.push(i)
@events[i].through = true
end
end
else
for i in @events.keys
if @c_through.include?(i)
@events[i].through = false
end
end
end
end

def change_passibility(map_id,x,y)
nmap = load_data(sprintf("Data/Map%03d.rvdata",map_id))
tile_id = nmap.data[x,y,0]
@changed_tiles[tile_id] = @passages[tile_id] if @passages[tile_id] != 0x00
@passages[tile_id] = 0x00
end

def restore_passage
for i in @changed_tiles.keys
@passages[i] = 0x01
end
refresh
end

def add_event(map_id,id,x,y,cg=false)
s = 1
(1..@events.size + 1).each{|s|break unless @events.keys.include?(s)}
map = load_data(sprintf("Data/Map%03d.rvdata", map_id))
ev = map.events[id]
ev.id = s
if events_xy(x, y).empty? or (events_xy(x,y)[0].event.name == "transfer" and events_xy(x,y).size == 1)
if cg
@events[s] = Game_Event.new(@map_id,ev,true)
@blocking_events.push(@events[s].id)
else
@events[s] = Game_Event.new(@map_id, ev)
@events[s].d_tag = 1 unless @transfers.include?(@events[s].id)
@events[s].item = $game_party.last_decoration unless @transfers.include?(@events[s].id)
$game_party.lose_item($data_items[@events[s].item], 1) unless @transfers.include?(@events[s].id)
end
@events[s].moveto(x, y)
add_new(s,ev,x,y,@events[s].d_tag,@events[s].item)
return @events[s].id
end
end
end

class Scene_Map

alias new_window start
def start
new_window
unless $cd == nil or $cd.disposed?
$cd.dispose
end
if $game_map.edit_mode?
update_current_decoration_window
end
end

def update_current_decoration_window
$cd = Window_Base.new(0,0,190,88) if $cd == nil or $cd.disposed?
$cd.contents.clear
$cd.opacity = 100
if $game_party.last_decoration > 0
decoration = "#{$data_items[$game_party.last_decoration].name}"
else
decoration = "None selected"
end
if $game_map.placement_mode?
mode = "Placement Mode"
else
mode = "Removal Mode"
if $game_map.events_xy($game_player.x,$game_player.y).size > 0 and $game_map.events_xy($game_player.x,
$game_player.y)[0].item != nil
decoration = $data_items[$game_map.events_xy($game_player.x,
$game_player.y)[0].item].name
else
decoration = ""
end
end
$cd.contents.draw_text(0,0,158,24,mode,1)
$cd.contents.draw_text(0,32,158,24,decoration,1)
end

alias extra_event_update update
def update
extra_event_update
unless $game_message.visible
if Sky::Decor::MAP_ID.include?($game_map.map_id)
if Input.trigger?(Sky::Decor::Button0)
if $game_map.edit_mode?
$game_party.members[0].set_graphic($game_party.previous_character,
$game_party.previous_index,$game_party.members[0].face_name,
$game_party.members[0].face_index)
for i in 0...$game_map.blocking_events.size
$game_map.delete_event($game_map.blocking_events[i])
end
$game_map.blocking_events.clear
$game_map.restore_passage
$game_map.return_to
$game_map.edit_mode(false)
else
$game_map.add_event(Sky::Decor::Event_Map,1,$game_player.x,$game_player.y,true)
$game_map.return_location($game_player.x,$game_player.y,$game_player.direction)
$scene = Scene_Map.new
$game_party.set_previous($game_party.members[0].character_name,$game_party.members[0].character_index)
$game_party.members[0].set_graphic("$Model Cursor",0,$game_party.members[0].face_name,$game_party.members[0].face_index)
for i in 0...$game_map.transfers.size
enew_x = $game_map.events[$game_map.transfers[i]].event.x
enew_y = $game_map.events[$game_map.transfers[i]].event.y
$game_map.blocking_events.push($game_map.add_event(Sky::Decor::Event_Map,1,enew_x,enew_y))
end
mapp = load_data(sprintf("Data/Map%03d.rvdata", Sky::Decor::Wall_Map))
for i in 0...mapp.width
unless i % 4 == 0
for a in 0...mapp.height
unless a % 4 == 0
$game_map.change_passibility(Sky::Decor::Wall_Map,i,a)
end
end
end
end
$game_map.edit_mode(true)
update_current_decoration_window
end
$game_player.refresh
elsif Input.trigger?(Sky::Decor::Button2)
if $game_map.edit_mode?
if $game_map.placement_mode?
$game_map.placement_mode(false)
$cd.contents.clear unless $cd == nil or $cd.disposed?
update_current_decoration_window
else
$game_map.placement_mode(true)
$cd.contents.clear unless $cd == nil or $cd.disposed?
update_current_decoration_window
end
end
elsif Input.trigger?(Sky::Decor::Button1)
if $game_map.edit_mode?
if $game_map.placement_mode?
enew_x = $game_player.x
enew_y = $game_player.y
tile_id = $game_map.data[enew_x,enew_y,0]
unless not $game_party.has_item?($data_items[$game_party.last_decoration]) or $game_map.current_d_event_id == 0
if $game_map.changed_tiles.include?(tile_id)
$game_map.add_event(Sky::Decor::Event_Map,($game_map.current_d_event_id),
enew_x,enew_y) if $game_map.d_type == "Wall"
else
$game_map.add_event(Sky::Decor::Event_Map,($game_map.current_d_event_id),
enew_x,enew_y) if $game_map.d_type == "Floor"
end
end
$scene = Scene_Map.new
else
event = $game_map.events_xy($game_player.x,$game_player.y)
unless event == nil or event.size == 0
$game_map.delete_event(event[event.size - 1].id) unless event[event.size - 1].d_tag == nil
end
end
end
end
if $game_map.edit_mode?
update_current_decoration_window
end
end
end
if not $game_party.has_item?($data_items[$game_party.last_decoration])
$game_party.last_decoration = 0
end
end

alias insert_decoration_menu call_menu
def call_menu
unless $game_map.edit_mode?
insert_decoration_menu
else
$game_temp.next_scene = nil
$cd.opacity = 0 unless $cd == nil or $cd.disposed?
$cd.contents_opacity = 0 unless $cd == nil or $cd.disposed?
$scene = Scene_Decoration_Menu.new
end
end
end

class Window_Decoration < Window_Selectable
attr_accessor :data
def initialize
super(0,0,240,416)
self.index = 0
refresh
end

def item
return @data[self.index]
end

def decoration(item)
return if item == nil
notes = item.note
notes.each_line{|x| return x[11,x.rindex(':') - 11]}
end

def type(item)
return if item == nil
notes = item.note
notes.each_line{|x|
if x.include?("<WALL>")
return "Wall"
elsif x.include?("<FLOOR>")
return "Floor"
end
}
end

def refresh
@data = []
for item in $game_party.items
next unless include?(item)
@data.push(item)
if item.id == $game_party.last_decoration
self.index = @data.size - 1
end
end
@data.push(nil) if @data.size == 0
@item_max = @data.size
width = 0
for i in @data
break if i == nil
new_width = self.contents.text_size("#{i.name} ").width
width = new_width if new_width > width
end
self.width = [240, width].max
self.height = [page_row_max * WLH,@item_max * WLH].min + 32
create_contents
for i in 0...@item_max
draw_item(i)
end
end

def include?(item)
return false if item == nil
notes = item.note
notes.each_line{|x| return true if x.include?("Decoration:")}
return false
end

def draw_item(index)
rect = item_rect(index)
item = @data[index]
if item != nil
number = $game_party.item_number(item)
rect.width -= 4
draw_item_name(item, rect.x, rect.y)
self.contents.draw_text(rect, sprintf(":%2d", number), 2)
else
rect.width -= 4
self.contents.draw_text(rect,"- None -",1)
end
end
end

class Scene_Decoration_Menu < Scene_Base
def start
@viewport = Viewport.new(0,0,544,416)
create_menu_background
@decoration = Window_Decoration.new
@image = Window_Base.new(340,0,206,180)
image_update unless @decoration.item == nil
@previous_selection = 0
end

def tileset_bitmap(tile_id)
set_number = tile_id / 256
return Cache.system("TileB") if set_number == 0
return Cache.system("TileC") if set_number == 1
return Cache.system("TileD") if set_number == 2
return Cache.system("TileE") if set_number == 3
return nil
end

def update
@decoration.update
@image.update
if Input.trigger?(Input::B)
dispose
elsif Input.trigger?(Input::C)
$game_party.last_decoration = @decoration.item.id unless @decoration.item == nil
$game_map.current_d_event_id = @decoration.decoration(@decoration.item).to_i
$game_map.d_type = @decoration.type(@decoration.item)
dispose
elsif Input.trigger?(Input::UP) or Input.trigger?(Input::DOWN) or (@previous_selection != @decoration.index)
unless @decoration.item == nil
unless @image.disposed?
image_update
end
end
@previous_selection = @decoration.index
end
end

def image_update
@image.contents.clear
event_id = @decoration.decoration(@decoration.item).to_i
emap = load_data(sprintf("Data/Map%03d.rvdata",Sky::Decor::Event_Map))
tile_id = emap.events[event_id].pages[0].graphic.tile_id
if emap.events[event_id].pages[0].graphic.tile_id == 0
name = emap.events[event_id].pages[0].graphic.character_name
index = emap.events[event_id].pages[0].graphic.character_index
bitmap = Cache.character(name)
sign = name[/^[\!\$]./]
if sign != nil and sign.include?('$')
@cw = bitmap.width / 3
@ch = bitmap.height / 4
else
@cw = bitmap.width / 12
@ch = bitmap.height / 8
end
n = index
x = (@image.contents.width / 2) - (@cw / 2)
y = (@image.contents.height / 2) - (@ch / 2)
src_rect = Rect.new((n%4*3+1)*@cw, (n/4*4)*@ch, @cw, @ch)
@image.contents.blt(x, y, bitmap, src_rect)
else
bitmap = tileset_bitmap(tile_id)
sx = (tile_id / 128 % 2 * 8 + tile_id % 8) * 32;
sy = tile_id % 256 / 8 % 16 * 32;
src_rect = Rect.new(sx, sy, 32, 32)
x = (@image.contents.width / 2) - (32 / 2)
y = (@image.contents.height / 2) - (32 / 2)
@image.contents.blt(x,y,bitmap,src_rect)
end
end
def dispose
@decoration.dispose
@image.dispose
$scene = Scene_Map.new
end
end

class Scene_File

alias place_data write_save_data
def write_save_data(file)
place_data(file)
Marshal.dump($resaved_maps, file)
end

alias get_data read_save_data
def read_save_data(file)
get_data(file)
$resaved_maps = Marshal.load(file)
end

end

class Scene_Title
alias new_array command_new_game
def command_new_game
$resaved_maps = {}
new_array
end
end

Thank you again and good luck! :)


__________________________

Go to the top of the page
 
+Quote Post
   
Kread-EX
post Feb 3 2012, 12:22 PM
Post #4


(=___=)/
Group Icon

Group: +Gold Member
Posts: 4,136
Type: Scripter
RM Skill: Undisclosed




Well, the script really isn't supposed to save the events - instead requiring you to add them with an autorun or parallel process. In any case, I've made a few changes so the cloned events are saved.
Clicky
CODE
#==============================================================================
# ** Events Cloning Script V1.1
#------------------------------------------------------------------------------
# by FlipelyFlip
#------------------------------------------------------------------------------
# thx goes to: Kread-EX
#==============================================================================
=begin
This little script allows you to copy an event from another map to set it on the
located coordinates. You can also call it by variables. You have to config the
Variables under the module Flipely. So you can set the x and y coordinate at the
variables to random. If the coordinates are on an impassable place, they will be
set one place right and one place down. If this place is also impassable, it will
add again the one place right and one place down.
This Feature is only at the variable available.

To call the script you can chose between
$game_map.add_event(map_id,event_id,x,y)

or you will do it with variables, then you have to set up the variables before
calling it with Flipely.koordinaten .

greetings FlipelyFlip
=end

class Spriteset_Map
  def refresh
    $game_map.need_refresh = true
    unless @character_sprites == nil
      for sprite in @character_sprites
        sprite.dispose
      end
    end
    @character_sprites = []
    for i in $game_map.events.keys.sort
      sprite = Sprite_Character.new(@viewport1, $game_map.events[i])
      @character_sprites.push(sprite)
    end
    @character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
  end
end

class Game_Map
  def add_event(map_id,id,x,y)
    s = 1
    (1..@events.size + 1).each{|s|break unless @events.keys.include?(s)}
    map = load_data(sprintf("Data/Map%03d.rvdata", map_id))
    ev = map.events[id]
    ev.id = s
    @events[s] = Game_Event.new(@map_id, ev)
    @events[s].moveto(x, y)
    ## Kread
    $game_party.cloned_events = {} if $game_party.cloned_events.nil?
    if $game_party.cloned_events[@map_id].nil?
      $game_party.cloned_events[@map_id] = []
    end
    unless $game_party.cloned_events[@map_id].include?([map_id, id, x, y])
      $game_party.cloned_events[@map_id].push([map_id, id, x, y])
    end ##
    return @events[s].id
  end
  ## Kread
  alias_method(:krx_clonev_gm_se, :setup_events)
  def setup_events
    krx_clonev_gm_se
    unless $game_party.cloned_events.nil? ||
    $game_party.cloned_events[@map_id].nil?
      $game_party.cloned_events[@map_id].each do |array|
        add_event(array[0], array[1], array[2], array[3])
      end
    end
  end ##
end

module Flipely
  def self.passable?
    return $game_map.passable?($game_variables[id], $game_variables[id], flag = 0x01)
  end
end

module Flipely
  def self.koordinaten
    if Flipely.passable? == true
      $game_map.add_event($game_variables[id],$game_variables[id],$game_variables[id],$game_variables[id])
      $scene = Scene_Map.new
    else
      $game_variables[id] += 1 # change it if you want
      $game_variables[id] += 1 # change it if you want
      Flipely.koordinaten
    end
  end
end

## Kread
class Game_Party < Game_Unit
  attr_accessor  :cloned_events
end ##


__________________________
FRACTURE - a SMT inspired game (demo) made by Rhyme, Karsuman and me. Weep and ragequit.

My blog.

Click here for my e-peen


Go to the top of the page
 
+Quote Post
   
Erangot
post Feb 3 2012, 10:22 PM
Post #5


Level 2
Group Icon

Group: Member
Posts: 19
Type: Artist
RM Skill: Skilled




;o;

You know what, I love you already :'DD
It's working like a charm now!
Thank you very much!!


__________________________

Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 22nd May 2013 - 05:36 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker