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.