Advanced: Creating Events During Gameplay?

Status
Not open for further replies.

JoePro

None Newb
Veteran
Joined
May 29, 2014
Messages
78
Reaction score
17
First Language
English
Primarily Uses
If it is always the same event that disappears, it might be rewriting the event with the same id on the current map. Try naming your spawnable event something unique.
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
You can use these methods:

x = $game_map.round_x_with_direction($game_player.x, $game_player.direction)y = $game_map.round_y_with_direction($game_player.y, $game_player.direction) then make your event spawn at the point designated by x and y.  However, that could be ANYWHERE on the map - on a tree, on the wall of a house, on a cliff or hill, in the water.  There is no check that the tile in front of the player is a VALID tile for a particular event to spawn on.  You would have to do that check yourself, using whatever rules you need for the purpose you have in mind.
Yeah, that would.Which is why I made it so the event spawns directly on the position of $game_player (using $game_player.x for the X value and $game_player.y for the Y value).

That way, there is no way to spawn it into an impassable tile ever.

For this to work, a line in the script must be commented out (line: 74).

Either do this, if it is a suitable solution (wouldn't look so bad with a portal, I guess), or make a new method in the script which makes the event not spawn if it would go into an impassable tile.

As for the disappearing events, there are multiple possible reasons for that.

One (and the most common) of these reasons is that when you spawn this new event on another map, the spawned event's ID changes to the last event made in the database on that map +1 (!).

Which is why you can not use any event command inside these events which directly specifies the spawned event's own ID, because that ID might not even be valid on the map you are spawning it or it will point to another event on that map.

Use "This Event" where possible to overcome this issue.

If it is not possible to use the "This Event" option, these commands can be replaced with the script equivalent of the commands with using '@event_id' for the ID of the event.

If that is not what happening, share the event commands inside your spawn event with us. That might help a bit more in solving the issue.

I made a functional bomb tool with using Yanfly's Spawn Events script without any issue.

The bomb spawns where the player stands and explodes after a set time, and if any event is inside the specified range from the bomb, it can trigger an effect.

Then I found a script with a complete pack of dungeon tools and discarded my silly bomb event.

But I was quite proud when I made that bomb event back then... Memories... :D
 

Dymdez

Newbie-in-Chief
Veteran
Joined
Feb 4, 2014
Messages
752
Reaction score
154
First Language
English
Primarily Uses
Sixth, is this the line you said to comment out? "map_id = @map_id if map_id == 0"

I'm having some difficulty in figuring out the event problem. The event I am spawning has an ID of 1 and it on Map ID of 3. I deleted any event with an ID of 1 on the map I want to spawn my event, but then Event 2 just disappears.
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
No, don't comment out that one, lol! :D


Strange, I don't remember editing anything else in that script...


Ohh, well, so the correct line to comment out for making it possible to spawn events on the player is:

return if dx == $game_player.x && dy == $game_player.yShow me a screenshot of the event page setups you want to spawn. I want to take a look at that event, maybe it's just a misplaced event command.
And what happens if you try to spawn that event on an event-less map?
 
Last edited by a moderator:

Dymdez

Newbie-in-Chief
Veteran
Joined
Feb 4, 2014
Messages
752
Reaction score
154
First Language
English
Primarily Uses
No, don't comment out that one, lol! :D

Strange, I don't remember editing anything else in that script...

Ohh, well, so the correct line to comment out for making it possible to spawn events on the player is:

return if dx == $game_player.x && dy == $game_player.yShow me a screenshot of the event page setups you want to spawn. I want to take a look at that event, maybe it's just a misplaced event command.And what happens if you try to spawn that event on an event-less map?
The event I'm spawning has no move route its just set to random. Its just a dog with random movement set (to test the script). On an event-less map, it works fine.
 
Last edited by a moderator:

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
That is interesting.


I am now testing my old bomb event and it works flawlessly.


On all my maps, all event IDs are sequential numbers, meaning there are no missing numbers in the sequence. So, they start at ID 1 and to ID X without missing any number between each IDs.


If you delete some events, and do not put any new event on the map, there will be a missing event ID.


So, try to fill all the gaps, if not by something else, than with just a few dummy events.


Maybe the missing IDs are confusing the script.


Judging by this line in the script:

Code:
key_id = @events.keys.max + 1
It is very possible that that is the source of the problem.
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
It works for me in your demo too.


Do note that it will not spawn the event if there is an event already on the spawned event's location.


So if you stand in front of the event which gave you the item, it will not spawn when you use the item.


You must move away, so that nothing blocks the spawned event.


This is another reason why I made my event spawn directly on the player, because regardless if the item was successfully used or not (spawned or not), it will be consumed after usage.


And make the scope for your teleport item to "None". :p


And WTFruit, thanks a lot for the "extra" in the demo!


I thought nobody upgrades that script anymore. o_O


The new rules really work (elemental, families)? If so, I must upgrade my version too! *-*


Now I can remake my album edit again. >.>
 

Dymdez

Newbie-in-Chief
Veteran
Joined
Feb 4, 2014
Messages
752
Reaction score
154
First Language
English
Primarily Uses
It works for me in your demo too.

Do note that it will not spawn the event if there is an event already on the spawned event's location.

So if you stand in front of the event which gave you the item, it will not spawn when you use the item.

You must move away, so that nothing blocks the spawned event.

This is another reason why I made my event spawn directly on the player, because regardless if the item was successfully used or not (spawned or not), it will be consumed after usage.

And make the scope for your teleport item to "None". :p

And WTFruit, thanks a lot for the "extra" in the demo!

I thought nobody upgrades that script anymore. o_O

The new rules really work (elemental, families)? If so, I must upgrade my version too! *-*

Now I can remake my album edit again. >.>
I came here for script help and only achieved updating your Triple Triad? HHAHAHAHAHA :D

In the demo I sent you - When I use the "Wobbajack" the shade sprite disappears. That doesn't happen to you? do you have the patch?
 
Last edited by a moderator:

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
Nop, nothing disappears, everything works as intended.


What patch? o.o


And, just to be sure, I checked again before I posted.


Yes, it will disappear if you have an empty event ID on your map because of the line I showed you above.


I will try to explain this more clearly...


So, make a new map to test this...


On this new map, make 5 events, doesn't really matter what kind of events, they can even be copy/pasted events.


Check their IDs. On a completely clean map, making 5 new events would yield 5 event IDs. These would be: 1, 2, 3, 4 and 5.


The total amount of events on the map is 5.


Now, when you made them, delete the event with the ID of 2.


After this move, do not make any new events.


Checking the event IDs on the map, we will get only 4 numbers, those are: 1, 3, 4 and 5. Do note the missing number here (number 2)!


The total number of events on the map now is only 4.


After this, when you try out the new map, and try to spawn an event, it will delete the event with ID 5 on the map. Why? Because of that little line I showed before:

key_id = @events.keys.max + 1What this piece of code does exactly?
It checks for the number of events placed on the map, and adds +1 to that number. The result will be the new, spawned event's ID.


So, if an event with that ID is already present, than that event will be completely replaced by the spawned event.


If you tested the above example with the 5 events, you now know why it happened. There were only 4 events on the map, but the last event ID was 5 and not 4. When the spawned event was created, the spawned event's ID became 5 (4 total events on map + 1 = 5), resulting in the deletion of the original event with ID 5 on the map.


That is what I tried to explain in one of my post above.


Always check the IDs of the events on your maps, and if you got a missing number from the sequence, just select the event with the highest ID and do a cut/paste on it. That will fill in a gap in the sequence. If you got more gaps, repeat the process until you have no more gaps left.


I hope I described everything well enough.


Just fill in the gaps in the event ID sequence, and everything should work fine.
 

Dymdez

Newbie-in-Chief
Veteran
Joined
Feb 4, 2014
Messages
752
Reaction score
154
First Language
English
Primarily Uses
Nop, nothing disappears, everything works as intended.

What patch? o.o

And, just to be sure, I checked again before I posted.

Yes, it will disappear if you have an empty event ID on your map because of the line I showed you above.

I will try to explain this more clearly...

So, make a new map to test this...

On this new map, make 5 events, doesn't really matter what kind of events, they can even be copy/pasted events.

Check their IDs. On a completely clean map, making 5 new events would yield 5 event IDs. These would be: 1, 2, 3, 4 and 5.

The total amount of events on the map is 5.

Now, when you made them, delete the event with the ID of 2.

After this move, do not make any new events.

Checking the event IDs on the map, we will get only 4 numbers, those are: 1, 3, 4 and 5. Do note the missing number here (number 2)!

The total number of events on the map now is only 4.

After this, when you try out the new map, and try to spawn an event, it will delete the event with ID 5 on the map. Why? Because of that little line I showed before:

key_id = @events.keys.max + 1What this piece of code does exactly?It checks for the number of events placed on the map, and adds +1 to that number. The result will be the new, spawned event's ID.

So, if an event with that ID is already present, than that event will be completely replaced by the spawned event.

If you tested the above example with the 5 events, you now know why it happened. There were only 4 events on the map, but the last event ID was 5 and not 4. When the spawned event was created, the spawned event's ID became 5 (4 total events on map + 1 = 5), resulting in the deletion of the original event with ID 5 on the map.

That is what I tried to explain in one of my post above.

Always check the IDs of the events on your maps, and if you got a missing number from the sequence, just select the event with the highest ID and do a cut/paste on it. That will fill in a gap in the sequence. If you got more gaps, repeat the process until you have no more gaps left.

I hope I described everything well enough.

Just fill in the gaps in the event ID sequence, and everything should work fine.
Alright, thank you. It works now. I replaced line 74

key_id = @events.keys.max || -1 + 1

with

key_id = @events.keys.max + 1

and now nothing disappears. Thanks.
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
Wait, now that you mention it, it really was '|| -1 + 1' in your demo. o_O


Did you edit that yourself or was it like that by default?


I had a simple +1 there in my project, and I don't remember editing that line. :D


Well, at least your issue got solved. :)
 

Dymdez

Newbie-in-Chief
Veteran
Joined
Feb 4, 2014
Messages
752
Reaction score
154
First Language
English
Primarily Uses
It was like that by default! haha yea, at least you found out we have been updating triple triad now for months :)
 

cjurri

Warper
Member
Joined
Mar 21, 2013
Messages
1
Reaction score
0
First Language
español
Primarily Uses
Hello, I am trying to do this script, but it does not work for me, besides the demonstration does not let download. I am using Yanfly Engine Ace - Spawn Event v1.00 in rpgmaker ace version 1.01a. Can anyone tell me that I have to modify. Cheers
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
7,842
Reaction score
5,228
First Language
Dutch
Primarily Uses
RMXP

@cjurri , please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.


Please make a new thread with your problem.
 
Status
Not open for further replies.

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

Latest Threads

Latest Posts

Latest Profile Posts

"You can thank my later", "But you haven't done anything", "Well, that's why ..."
Are we allowed to post about non-RPG Maker games?
I should realize that error was produced by a outdated version of MZ so that's why it pop up like that
Ami
i can't wait to drink some ice after struggling with my illness in 9 days. 9 days is really bad for me,i can't focus with my shop and even can't do something with my project
How many hours have you got in mz so far?

Forum statistics

Threads
105,884
Messages
1,017,238
Members
137,608
Latest member
Arm9
Top