Clone Events

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,640
Reaction score
13,245
First Language
English
Primarily Uses
RMMV
Clone Events
2018.01.13
by Shaz

Introduction
This plugin allows you to copy events from a base map onto the current map. It is NOT an event spawning plugin - it replaces a 'placeholder' event on the current map with a 'source' event from the cloned map. All event content except location and id are replaced.

How to use
Add plugin to your js/plugins folder - name must be Shaz_CloneEvents.js
Enable in plugin manager, and enter the map id where all the source events will be held into the plugin parameter.
Create your source events on the clone map with all the event pages and content required. Give it a unique name (no two events on this map should have the same name - one will overwrite the other if that happens).
Create your placeholder events on the game map. Put <clone:eventName> into the note box. eventName is the unique name of the event from the source map that you want to clone. This is the only thing you should do to the placeholder event.

When playing the game, when the map is loaded, the source event will be copied from the clone map and placed at the placeholder event's location.

Plugin
Download from pastebin
make sure to save it as Shaz_CloneEvents.js

Credit
- Shaz

Terms
- free for use in commercial games

Notes
 
Last edited:

EpicFILE

Epic Member
Veteran
Joined
Sep 27, 2017
Messages
294
Reaction score
1,140
First Language
Indonesia
Primarily Uses
RMMV
Hello! I already tried this one out, but I can't really get it to work.
I've created an original event and typed Snake in the name box.
I put it on the base map. (set the base map ID as 6, because that's where I put the events)
Tried to clone the event by typing <clone:Snake> on the notetags of new event.
But I can't seem to get it to work.

Is there something I'm missing?
Thank you in advance! :D
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,640
Reaction score
13,245
First Language
English
Primarily Uses
RMMV
Did you save the plugin with the correct name?
If you hit F8 and go to the console tab, are there any error messages?

Could you please provide screenshots of your plugin manager, with this plugin selected, your event named Snake, and the event where you have <clone...> in the note box?
 

EpicFILE

Epic Member
Veteran
Joined
Sep 27, 2017
Messages
294
Reaction score
1,140
First Language
Indonesia
Primarily Uses
RMMV
I'll put the screenshots inside the spoilers.









 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,640
Reaction score
13,245
First Language
English
Primarily Uses
RMMV
Yes, your plugin is not named correctly. The effect is that the game behaves as if it isn't even installed (and you got some errors in the console for the same reason).

It must be called Shaz_CloneEvents.js as per the instructions in the first post.

Add plugin to your js/plugins folder - name must be Shaz_CloneEvents.js
The pastebin page shows a more readable name, but unfortunately when you download, it gives it a slightly altered version of that name.

To fix, delete the plugin from the plugin list, go to your plugin folder and rename the file, then add back to the plugin manager.
 

EpicFILE

Epic Member
Veteran
Joined
Sep 27, 2017
Messages
294
Reaction score
1,140
First Language
Indonesia
Primarily Uses
RMMV
Thanks! Works like a charm.
This is a very useful plugin to easily recreate complex, repeated events.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,640
Reaction score
13,245
First Language
English
Primarily Uses
RMMV
Like common events, but with event pages, conditions, and sprites :)
 

_Shadow_

Tech Magician Level:
Moderator
Joined
Mar 2, 2014
Messages
4,014
Reaction score
2,624
First Language
Greek
Primarily Uses
RMMV
Just noticed! Thank you squirrel for making this for MV <3
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,418
Reaction score
669
First Language
Portuguese - Br
Primarily Uses
RMMV
Hello!
Its working great so far!
But i want to know if there a way for me to activate the clone event via script call/ comment tag or plugin command, instead of using the notebox.
because this will help me with a compatibility issue of another plugin who already use a notebox.

So basicaly i want to when a switch is on, then the clone process will be active.

Despite of this, its very simple and easy to use! Thanks!
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,640
Reaction score
13,245
First Language
English
Primarily Uses
RMMV
What about the event name? If you give the event the name
Clone: SourceEvent

then you could change these lines:
Code:
        if ($dataMap.events[eventId].meta.clone) {
            this._clone = JsonEx.makeDeepCopy($dataClones[$dataMap.events[eventId].meta.clone]);

to this:
Code:
        if ($dataMap.events[eventId].name.match(/Clone: (\s*)/i) {
            this._clone = JsonEx.makeDeepCopy($dataClones[RegExp.$1]);
and it will clone whatever event you put as SourceEvent. I think you'd have to make sure what you put as SourceEvent is the same case as the event on the clone map.

I haven't tested this, so I might have the syntax wrong (specifically I'm not sure if the \s* part is correct), but I don't want to go to the trouble of testing it if you're going to say you don't want to use the event name.

Using a script call, comment or plugin would be more difficult, because of the introduction of multiple pages and multiple event commands on each page.
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,418
Reaction score
669
First Language
Portuguese - Br
Primarily Uses
RMMV
What about the event name? If you give the event the name
Clone: SourceEvent

then you could change these lines:
Code:
        if ($dataMap.events[eventId].meta.clone) {
            this._clone = JsonEx.makeDeepCopy($dataClones[$dataMap.events[eventId].meta.clone]);

to this:
Code:
        if ($dataMap.events[eventId].name.match(/Clone: (\s*)/i) {
            this._clone = JsonEx.makeDeepCopy($dataClones[RegExp.$1]);
and it will clone whatever event you put as SourceEvent. I think you'd have to make sure what you put as SourceEvent is the same case as the event on the clone map.

I haven't tested this, so I might have the syntax wrong (specifically I'm not sure if the \s* part is correct), but I don't want to go to the trouble of testing it if you're going to say you don't want to use the event name.

Using a script call, comment or plugin would be more difficult, because of the introduction of multiple pages and multiple event commands on each page.
Thank you Chaz! Didnt work either.
No need to worry about, i will found some another way!
Thanks!
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,640
Reaction score
13,245
First Language
English
Primarily Uses
RMMV
Try \w* instead of \s* and make sure you have a space after the :

edit ... here you go - change those lines to this:
Code:
        if ($dataMap.events[eventId].name.match(/Clone:\s*([\w ]*)/i)) {
            this._clone = JsonEx.makeDeepCopy($dataClones[RegExp.$1]);
I'm not a fan of regular expressions - takes so much experimenting to get them right.
 
Last edited:

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,418
Reaction score
669
First Language
Portuguese - Br
Primarily Uses
RMMV
Try \w* instead of \s* and make sure you have a space after the :

edit ... here you go - change those lines to this:
Code:
        if ($dataMap.events[eventId].name.match(/Clone:\s*([\w ]*)/i)) {
            this._clone = JsonEx.makeDeepCopy($dataClones[RegExp.$1]);
I'm not a fan of regular expressions - takes so much experimenting to get them right.
Hi!
It worked with the name of the event!
But i cant do what i want either =/.
But i'm sure not because your plugin, its the other. I think there's no way. Because the other plugin use an note tag in event for "connect" the event with the data of an enemie or a actor. So what i want its to bring other event from other map. But cloned events are link together with the names or notetag.
I think the only way is have a way to only activate the clone with a switch, in ther page for example.
But thats ok Chaz! This plugin i'm used its in development, so i guess i'm have to wait, be more patient.
Thanks for your attention and effort anyway! I'm really apreciate that!
PS: If you are curios, is this plugin: https://forums.rpgmakerweb.com/index.php?threads/tactics-system.97023/
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,640
Reaction score
13,245
First Language
English
Primarily Uses
RMMV
@Eliaquim I think I know what's going on. When you clone an event, the event on the current map is a placeholder only, and is completely replaced by the cloned event. So if you have notetags, they are going to be removed.

Put the notetag for the other plugin in the event on the clone map. (This also means it would have worked just as it was, without the change to use the event name). Then when it's cloned to the current map, it'll have the notetag for the other plugin.

If it doesn't work then, try swapping the order of the two plugins.
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,418
Reaction score
669
First Language
Portuguese - Br
Primarily Uses
RMMV
@Eliaquim I think I know what's going on. When you clone an event, the event on the current map is a placeholder only, and is completely replaced by the cloned event. So if you have notetags, they are going to be removed.

Put the notetag for the other plugin in the event on the clone map. (This also means it would have worked just as it was, without the change to use the event name). Then when it's cloned to the current map, it'll have the notetag for the other plugin.

If it doesn't work then, try swapping the order of the two plugins.
I dont have time to try it yet. But as soon as i get some time, i will try! :D
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,418
Reaction score
669
First Language
Portuguese - Br
Primarily Uses
RMMV
Hi there @Shaz !
Sorry for me take too long. I trying several things with menu now, and it took me a lot of time.

By the way, your last tip doenst work too =/
I think theres no way. I also try with plugins that spam events from other maps to atual map, but didnt work too. :(
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
39,640
Reaction score
13,245
First Language
English
Primarily Uses
RMMV
If you'd like to make up a demo project with all default resources and just the plugins that you have, and create a couple of maps to see if the problem still happens, you could zip it up (ONLY the data and js folders) and send to me, and I can take a look.
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,418
Reaction score
669
First Language
Portuguese - Br
Primarily Uses
RMMV
If you'd like to make up a demo project with all default resources and just the plugins that you have, and create a couple of maps to see if the problem still happens, you could zip it up (ONLY the data and js folders) and send to me, and I can take a look.
Ok!! Thanks a lot man!!
I will do this and upload ot for you :D
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,418
Reaction score
669
First Language
Portuguese - Br
Primarily Uses
RMMV
Hello Shaz!
Here the project with the tests i made.
I try to clone the events with your plugin, and didnt work =/
Try this in the "battle" scene of tactics system and in the normal map, but not working.
I use to the spawner event and copier event of yanfly. Both work in the map scene, but not in the tactical scene.

When i used them i always disable all the plugins and make only one active.

I think i will have to wait the owner of the tactical system plugin make this. Or i will try to make a tactical system by myself with events.
 

Attachments

pasunna

Veteran
Veteran
Joined
Feb 3, 2019
Messages
528
Reaction score
250
First Language
thai
Primarily Uses
RMMV
Eliaquim you can use yanfly event copier instead
but I pass by because I had problem with yanfly version
some how it prevent my player speed to go beyond 6
and for shaz version it's not work along with my other plugin -...-
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Just realized I have a few Steam gifts floating around. Anyone need RPG Maker MV or XP (Steam only)? Send me a message and I will send them on over!

EDIT: Just an RPG Maker MV gift remaining! XP has been taken.
*when you can do the Unity tutorials, but when you actually try and convert it to your own knowledge, it fails horribly*
Hi, I made a game for a competition. I need some players to help play and vote for the best game.

https://ekamu.itch.io/not4ever
don’t forget to rate the game here


Voting is open until 12 August.

Thanks.
Progresses. Tonight: refinemment, column, pitfall, bump and gutter (I'll leave doors for last, they are scary).
What is your favourite rpg maker plugin?

Forum statistics

Threads
100,574
Messages
977,365
Members
132,160
Latest member
mdoracio
Top