Orange Custom Events

Hudell

Dog Lord
Veteran
Joined
Oct 2, 2014
Messages
3,517
Reaction score
3,652
First Language
Java's Crypt
Primarily Uses
RMMZ
Great plugin!


I wanted to be able to use the plugin command "copy event [1] from map 7 to region 2."


I edited line 323 so that I could reference RPG Maker variables to determine the event ID to copy:


    var eventIdOrigin = parseInt(args[1], 10);


CHANGED TO:


    var eventIdOrigin = this.getNumericValue(args[1]);


Will this cause any problems down the road?  The result looks great.


Thanks again!


That will work :)


I'll include that change on the plugin.
 

Jonforum

Veteran
Veteran
Joined
Mar 28, 2016
Messages
1,623
Reaction score
1,431
First Language
French
Primarily Uses
RMMV
Awsome plugin , tank you a lot , you are good dog :p


Tanks for this plugin Hudell


Have nice day
 

Jonforum

Veteran
Veteran
Joined
Mar 28, 2016
Messages
1,623
Reaction score
1,431
First Language
French
Primarily Uses
RMMV
Hi  Hudell


I use


copy event 1 from map 3 to region 2



When I click on this event, is do


delete this event



Then if I call again


copy event 1 from map 3 to region 2



This no longer works.
The event no longer appears
Do you have a solution ?
only one title have region 2
thank you
 
Last edited by a moderator:

mimi-min

Will draw for food.
Member
Joined
Apr 24, 2016
Messages
16
Reaction score
9
First Language
English
Primarily Uses
RMMV
Hello! Thanks for this awesome plugin, today is my first time using RPG Maker and I'm already pretty close to what I want to achieve thanks to you. :)


I'm sorry if this has been answered already, but I was wondering how I should go about spawning events that aren't affected when you interact with another event it was copied from. I just saw that you can add it with a separate ID, but I was hoping for the player to be able to spawn lots of them and have them all be unique events. Right now I'm testing it using a tree that changes to a snowy tree when interacted with, and if I interact with one it changes both.


Are we able to use variables as the parameters for this? I was thinking maybe it could work if I spawned it with an ID that uses it's location (ex. (05,12 would have an ID of 0512). I know that's a lot of variables, though...


I also want to use the player's location to determine where to spawn the event, so even if the event ID thing is impractical I would still like to be able to use them.


I'm also thinking it might work to see if I can figure out some sort of variable to store the amount of events that have been created and then set the ID to that +1 (or just that, with it having already added the +1).


At any rate, thank you.


Edit: I'm an idiot and just found the thing about the variables in the brackets thingy. Derp. Not sure how I managed to miss that. I still can't seem to get it to make them individual though :(


Edit v2: I really am a derp, it's because I had the image change based on a switch, and if I interacted with one it would change that switch. I can't believe myself ahaha I'm sorry
 
Last edited by a moderator:

mimi-min

Will draw for food.
Member
Joined
Apr 24, 2016
Messages
16
Reaction score
9
First Language
English
Primarily Uses
RMMV
Maybe this is the wrong place to ask, but it's semi-related.


I'm trying to build a thing where players can place and remove objects and such anywhere on the map. I've figured out how to get the objects to appear, and all have different IDs etc. using an ID variable that increments each time the player creates an object.


I started to worry about the IDs going crazy, though; especially if the player can erase them and create new ones; and wanted to see if I could have the ID based on it's coordinates, so it'd be easier to change and reference them later on. Basically what I'm trying to do is simulate a 2D array using the map coordinates so that tiles can be placed and removed, then easily referenced without tripping over each other.


My first idea was to set the ID to the X coordinate, then multiply it by 100, then add the Y coordinate (so (15, 3) would become 1503). Events to actually be used in the game would be stored in IDs that won't be used, for example if I set a limit of 30 tiles vertically all NPCs etc. would be stored in IDs 031+. I want to check and see if that actually works, considering supposedly IDs can only go up to 999, but I have no idea how to get an event to say it's own ID.


So my first question, for the purpose of testing this and seeing for myself, is how would I get the event to say it's own ID when I interact with it?


I've tried using $gameVariables.setValue(13, event_id); where 13 is the ID variable; I got the event_id from another thread and have tried other things like eventId etc. but they all come up with "Reference Error: ~~~ is not defined".


My second idea is to have each tile correspond to an "ID", but rather than having the ID be xxyy, it would start in the upper left and be incremented one each time until the end of the row, at which point it would continue from the first tile of the second row; so for example with a map 15 x 10, the top right corner would be ID 015, then (0,1) be ID 016, but I think that would require modulus and I have no idea how modulus works in RPG maker!


So the second question is if there's any post explaining how to get the Mod option to work. I've looked around a little but couldn't really find anything helpful.
 


My final question: I want to be able to change the result of placing an object based on whether something is going to be next to it. Is there a way to check if an event already exists in a certain spot? And is it possible to have those events react to the one that was just created (e.g. change a self-switch)?


Thank you very much for your help. I know that's a lot of questions, I'm sorry for being such a noob ; A ;
 

Hudell

Dog Lord
Veteran
Joined
Oct 2, 2014
Messages
3,517
Reaction score
3,652
First Language
Java's Crypt
Primarily Uses
RMMZ
Hi  Hudell


I use



copy event 1 from map 3 to region 2



When I click on this event, is do



delete this event



Then if I call again



copy event 1 from map 3 to region 2



This no longer works.
The event no longer appears
Do you have a solution ?
only one title have region 2
thank you


There shouldn't be a problem, I'll test this soon and get back to you.

Maybe this is the wrong place to ask, but it's semi-related.


I'm trying to build a thing where players can place and remove objects and such anywhere on the map. I've figured out how to get the objects to appear, and all have different IDs etc. using an ID variable that increments each time the player creates an object.


I started to worry about the IDs going crazy, though; especially if the player can erase them and create new ones; and wanted to see if I could have the ID based on it's coordinates, so it'd be easier to change and reference them later on. Basically what I'm trying to do is simulate a 2D array using the map coordinates so that tiles can be placed and removed, then easily referenced without tripping over each other.


My first idea was to set the ID to the X coordinate, then multiply it by 100, then add the Y coordinate (so (15, 3) would become 1503). Events to actually be used in the game would be stored in IDs that won't be used, for example if I set a limit of 30 tiles vertically all NPCs etc. would be stored in IDs 031+. I want to check and see if that actually works, considering supposedly IDs can only go up to 999, but I have no idea how to get an event to say it's own ID.


So my first question, for the purpose of testing this and seeing for myself, is how would I get the event to say it's own ID when I interact with it?


I've tried using $gameVariables.setValue(13, event_id); where 13 is the ID variable; I got the event_id from another thread and have tried other things like eventId etc. but they all come up with "Reference Error: ~~~ is not defined".


My second idea is to have each tile correspond to an "ID", but rather than having the ID be xxyy, it would start in the upper left and be incremented one each time until the end of the row, at which point it would continue from the first tile of the second row; so for example with a map 15 x 10, the top right corner would be ID 015, then (0,1) be ID 016, but I think that would require modulus and I have no idea how modulus works in RPG maker!


So the second question is if there's any post explaining how to get the Mod option to work. I've looked around a little but couldn't really find anything helpful.
 


My final question: I want to be able to change the result of placing an object based on whether something is going to be next to it. Is there a way to check if an event already exists in a certain spot? And is it possible to have those events react to the one that was just created (e.g. change a self-switch)?


Thank you very much for your help. I know that's a lot of questions, I'm sorry for being such a noob ; A ;


There's no limit to event IDs. Maybe you can only place 999 events on  the map when you're working on rpg maker, but when the game is running, there's no limit. The plugin is also smart enough to reuse IDs from deleted events.


Because of the way RM is made, if you set an event ID to x * 100, your game will probably lag, because there will be hundreds of unused events ID in between but even if they are not used, RM goes from ID 1 to the max ID one by one, so that's a lot of extra steps on several points of the code.


To make an event say it's own ID, use this script call:


$gameMessage.add('My Id is ' + this._eventId);


What is the Mod option?


For the last question, it surely is possible (I did that on my own game to simulate grass autotiles when the grass grows around the field randomly). You can use this script call on a conditional branch to check if an event exists on a position:


$gameMap.eventsXy($gameVariables.value(1), $gameVariables.value(2)).length > 0


Just replace the number 1 by he number of the variable that holds your X position and the number 2 by the number of the variable that holds your Y position.


And yes, it's possible to make an event react to another event next to it, but that will need extra lines of script, probably new lines for each specific type of object you place there that you want to interact.
 

mimi-min

Will draw for food.
Member
Joined
Apr 24, 2016
Messages
16
Reaction score
9
First Language
English
Primarily Uses
RMMV
What is the Mod option?


For the last question, it surely is possible (I did that on my own game to simulate grass autotiles when the grass grows around the field randomly).


When I say Mod option I mean the last option you can use when you alter a variable (there's Set, Add, Sub, etc. and then finally Mod), I was assuming it meant modulus (the % in most programming) where it returns the remainder of a quotient. It's useful if you want to know if one number is divisible by another (eg if x % y = 0), and I was thinking it could be used to find coordinates from a single integer; the Y would be the result of the division and the X would be remainder. I just realized that when you use those operations you're basically using the variable itself as one of the numbers in the equation (similar to x += y is the same thing as x = x+y). That's probably how it works.


Actually, that's basically what I'm trying to do with the last question; simulate autotiles with the generated objects. Thanks for the little snippets! :) As well as the advice on jumping around and using such high IDs. It's good to know that it won't run out of IDs... I just really worry about it when it comes to referring back to a particular placed object. I think I will try the second idea I had, and use an easy number to work with (a multiple of 10 or something).


Again, thank you for your help. I'll see what I can do!
 
Last edited by a moderator:

mimi-min

Will draw for food.
Member
Joined
Apr 24, 2016
Messages
16
Reaction score
9
First Language
English
Primarily Uses
RMMV
Sorry for posting again, but I tested what I wanted to try and I don't think it worked. Not sure if this is a bug or I'm misunderstanding how it works.


So I'm using


copy event 1 from map 1 to position [11] [12] with id 099




and then testing the snippet you gave to pull the event's ID (I tried passing both a variable, an integer on it's own and an integer with the leading 0's).


However, they don't seem to be using the ID I tried to give them. If it's the first one placed on the map it returns 1. Second returns 2, etc. If there were already events it will start from where that was left off; 4, 5 etc. Did I misunderstand something?
 

Hudell

Dog Lord
Veteran
Joined
Oct 2, 2014
Messages
3,517
Reaction score
3,652
First Language
Java's Crypt
Primarily Uses
RMMZ
Hmm, try removing the leading 0 from 099 to 99.
 

mimi-min

Will draw for food.
Member
Joined
Apr 24, 2016
Messages
16
Reaction score
9
First Language
English
Primarily Uses
RMMV
Hmm, try removing the leading 0 from 099 to 99.


That didn't help it at all, unfortunately. :(


Also, it doesn't seem like using "save" at the end keeps the objects there when leaving and returning to the map, either.


What it looks like right now:


copy event 1 from map 1 to position [11] [12] with id 99 save


Would it be easier if I was using it in script rather than a plugin command? ^^;
 
Last edited by a moderator:

Hudell

Dog Lord
Veteran
Joined
Oct 2, 2014
Messages
3,517
Reaction score
3,652
First Language
Java's Crypt
Primarily Uses
RMMZ
I just updated OrangeCustomEvents and OrangeCustomEventCreator. Try downloading the updated versions of both plugins (if you use both) and try again.
 

mimi-min

Will draw for food.
Member
Joined
Apr 24, 2016
Messages
16
Reaction score
9
First Language
English
Primarily Uses
RMMV
I just updated OrangeCustomEvents and OrangeCustomEventCreator. Try downloading the updated versions of both plugins (if you use both) and try again.


Yeah, it (both the ID setting and the save) works now! Thank you so much! :D It even uses the ID if it's something like 1005. Awesome!


Edit: Ah, the IDs do reset if you leave the map. But the objects themselves do stay there. I think I remember something being mentioned about that being the case just in case someone added something else after they've been created? Hmm, hmm. I wonder if there is any way to just have the coordinates attached to the objects, instead of relying on their IDs. (Now that I think about it, why did I want to use their IDs again...?)


At any rate, let me know if you ever need a help with a little art or anything in exchange for your help, especially character designs. That's my specialty. :)
 
Last edited by a moderator:

Jonforum

Veteran
Veteran
Joined
Mar 28, 2016
Messages
1,623
Reaction score
1,431
First Language
French
Primarily Uses
RMMV
I use



copy event 1 from map 3 to region 2



When I click on this event, is do



delete this event



Then if I call again



copy event 1 from map 3 to region 2



This no longer works.
The event no longer appears
Do you have a solution ?
only one title have region 2
thank you


hi hudel , did you found solution for me ?


Do i need to make video ?
 
Last edited by a moderator:

ramza

Lunatic Coder
Veteran
Joined
Jan 28, 2013
Messages
705
Reaction score
430
First Language
English
Primarily Uses
RMMV
hi hudel , did you found solution for me ?


Do i need to make video ?
I just started using this plugin, and noticed this issue as well. The problem seems to be that the plugin counts the tile that had been occupied by a deleted copied event as if the event was still there. If you leave the map and return, the spawning works as expected.
 

takashi1kun

spaghetti god code
Veteran
Joined
Jul 27, 2014
Messages
104
Reaction score
39
First Language
Spain Spanish
Primarily Uses
When i try to copy a event

Game_2016-06-29_14-14-03.png
 

Necromedes

Artist, Composer and Eventer
Member
Joined
Jan 6, 2013
Messages
19
Reaction score
1
First Language
English
Primarily Uses
How would one use this script to copy the event to variable coords?


Oh dear, I missed that in the explanations. My apologies XP.
 
Last edited by a moderator:

Martin

Veteran
Veteran
Joined
Apr 8, 2015
Messages
191
Reaction score
46
First Language
swe
Primarily Uses
RMMV
Hudell! Thanks :)

If I want to spawn that object next to player X,Y. Can I use variables as coordinates?

Code:
$gameMap.copyEventFrom(5, 1, 15, 20, true)
 

Jonforum

Veteran
Veteran
Joined
Mar 28, 2016
Messages
1,623
Reaction score
1,431
First Language
French
Primarily Uses
RMMV
Hudell! Thanks :)

If I want to spawn that object next to player X,Y. Can I use variables as coordinates?



$gameMap.copyEventFrom(5, 1, 15, 20, true)
me too ?
 

Hudell

Dog Lord
Veteran
Joined
Oct 2, 2014
Messages
3,517
Reaction score
3,652
First Language
Java's Crypt
Primarily Uses
RMMZ
Code:
$gameMap.copyEventFrom(5, 1, $gameVariables.value(1), $gameVariables.value(2), true)
 

Martin

Veteran
Veteran
Joined
Apr 8, 2015
Messages
191
Reaction score
46
First Language
swe
Primarily Uses
RMMV
Thank you again for your time Hudell! I know you have to focus on own projects. But I hoped you had some time to look at this.


When I call that event it does not create. Object 58 from map 9.


EDIT: sorry, thanks I just forgot the " ; " at the end of the script! omg wasted a day on it. haha



thanks again :) thumbs up
 
Last edited by a moderator:

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

Latest Posts

Latest Profile Posts

Stream will be live shortly with some Darkest Dungeon! Feel free to drop by!
Ksi
Streaming the Trials of RPG Maker MZ event games! Come join us to see what you can do with ONLY the RPGMakerMZ engine (no plugins included!)
Just a ordinary seller.
I never saw any jrpg story about the chosen one and his companions done very straight to follow all basic jrpg tropes.

Forum statistics

Threads
103,384
Messages
999,193
Members
134,901
Latest member
rustiic
Top