QUOTE (cometstar @ Dec 15 2011, 12:06 AM)

I want a script to call it to create an even t manually ,which is copied from another mapevent with its command events and give it new graphic or change its ghraphic manually, too
Is this possible ?
Hello Cometstar,
I think it's possible, try this script...
CODE
class Game_Event
attr_accessor :character_name
attr_accessor :character_hue
end
class Spriteset_Map
def add_event(id)
sprite = Sprite_Character.new(@viewport1, $game_map.events[id])
@character_sprites.push(sprite)
end
end
class Scene_Map
attr_reader :spriteset
end
class Game_Map
def copy_event(id,x,y,char_name=nil,char_hue=nil)
if $game_map.events[id] == nil
return -1
end
event = $game_map.events[id].clone
event.moveto(x,y)
if char_name != nil
event.character_name = char_name
end
if char_hue != nil
event.character_hue = char_hue
end
index = $game_map.events.keys.size
$game_map.events[index+1] = event
if $scene.is_a?(Scene_Map)
$scene.spriteset.add_event(index+1)
end
return true
end
end
Call it from script writing
CODE
$game_map.copy_event(id,x,y,char_name,char_hue)
where:
-
id is the id of the event you want to copy;
-
x and
y are the new coordinates;
-
char_name and
char_hue are what their name say and can be left blank.
For example,
$game_map.copy_event(1,5,7)
creates a copy of Event #1 and places it into coordinates (5,7).
I've not made a complete debug yet, please report any bugs...
N.B. It works ONLY in Scene_Map and in this state doesn't save the new event. If you exit the game and resume it again, the new event will disappear...
####
EDIT: actually, you can use this script anywhere, but once you leave the map, events will be reset...
It seems working quite well, although...
Please, let me know if it works...
###
Jens